Convert GCN Classic notices to JSON.
The following environment variables may be used to configure the service:
Name | Value |
---|---|
KAFKA_* |
Kafka client configuration as understood by Confluent Platform docker containers |
This package uses Poetry for packaging and Python virtual environment management. To get started:
-
Install pre-commit hooks by running the following two commands:
pip install pre-commit pre-commit install
-
Install Poetry by following their installation instructions.
-
Install this package and its dependencies by running the following command inside your clone of this repository:
poetry install --all-extras
-
Run the following command to launch a shell that is preconfigured with the project's virtual environment:
poetry shell
For a mostly complete example, see https://github.com/nasa-gcn/gcn-classic-to-json/tree/main/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK.
-
Create a new subdirectory in https://github.com/nasa-gcn/gcn-classic-to-json/tree/main/gcn_classic_to_json/notices with a name corresponding to the GCN Classic notice type.
-
Save a specimen of the 160-byte format GCN Notice in that directory under the filename
example.bin
. Some directories are pre-populated with recent specimens. -
Add a file called
__init__.py
to that directory. In that file, define a single Python function which takes the an array of 40 4-byte integers as input and returns a dictionary as output. See GCN Classic documentation for an explanation of the binary field layout. -
Run
pytest --generate
to run the test suite with and generate the expected output JSON file for your new notice type. It will create a new file calledexample.json
in your new directory. -
Adjust your parser and repeat the previous step until the
example.json
file is perfect. -
Create a pull request to add the new directory.