Update ITL JSON parser and exporter

Promote ITL JSON parser to public method (closes #13 (closed)):

>>> parse_json({
>>>     'foo': 'bar',
>>>     'observation_type': 'RIDER',
>>>     'parameters': {
>>>         'quux': 'corge',
>>>     },
>>>     'baz': 'qux',
>>> }, defaults={
>>>     'foo': 'no-used',
>>>     'grault': 'default',
>>> })

{
    # Reorder properties at the top
    'FOO': 'bar',
    'BAZ': 'qux',
    'GRAULT': 'default',
    'OBSERVATION_TYPE': 'RIDER',
    'PRIME': False,
    # Parameters are extracted and put at the bottom
    'QUUX': 'corge',
    # Comments are always last and empty if not provided
    'COMMENTS': '',
}
  • Add support for empty defaults (closes #14 (closed))

  • Temporary fix the timeline missing key in SOC v2 schema (#15):

>>> fmt_json(
>>>     EventWindow(
>>>         'foo',
>>>         t_start='2032-09-23T05:15:45',
>>>         t_end='2032-09-23T05:26:15',
>>>         stack='dummy',
>>>         pointing=None,
>>>     )
>>> )

{
    'name': 'foo',
    'start_time': '2032-09-23T05:15:45.000Z',
    'end_time': '2032-09-23T05:26:15.000Z',
    'stack': 'dummy',
    'pointing': None,
    'type': 'OBSERVATION',  # appended
    'parameters': {},
}

At the moment, the keys are manually extracted from the SOC ITL v2 schema. Ideally, they should be extracted directly from the schema properties.

This will need a proper fix in the future (not in %Version 1.1.1).

Edited by Benoît SEIGNOVERT

Merge request reports

Loading