External coinc table in kafka alerts doesn't follow schema
I discovered this while producing example files for userguide!146 (merged). We list the value type for gcn_notice_id
as an integer in igwn.alerts.v1_0.ExternalCoincInfo.avsc
, but the notices being generated right now store the value as a string (run code below with attached file)
with open('MS221101t-initial.avro', 'rb') as fo:
reader = fastavro.reader(fo)
record = next(reader)
print(record['external_coinc'])
which returns
{'gcn_notice_id': '1351365267', 'ivorn': 'ivo://lvk.internal/SWIFT#MDC-test_event2022-11-01T19:14:09.028', 'observatory': 'Swift', 'search': 'MDC', 'time_difference': -0.08, 'time_coincidence_far': 4.002690053691012e-18, 'time_sky_position_coincidence_far': 2.396053276042117e-17
This is an easy fix in theory, but I uncovered a bug in hop-client when I found this. When you don't give the hop-client the schema for a packet you want serialized using avro, it generates a schema based on the packet you've provided and uses that to construct the avro packet. When I switch gcn_notice_id
to an integer instead of a string and then serialize / deserialize using hop-client, it switches the value to a float. I'm going to open an issue with them (and will add a link here), but I'm not sure what to do in the meantime.