Skip to content

nasa-gcn/gcn-classic-to-json

Repository files navigation

gcn-classic-to-json

codecov

Convert GCN Classic notices to JSON.

Configuration

The following environment variables may be used to configure the service:

Name Value
KAFKA_* Kafka client configuration as understood by Confluent Platform docker containers

How to contribute

This package uses Poetry for packaging and Python virtual environment management. To get started:

  1. Fork and clone this repository.

  2. Install pre-commit hooks by running the following two commands:

    pip install pre-commit
    pre-commit install
    
  3. Install Poetry by following their installation instructions.

  4. Install this package and its dependencies by running the following command inside your clone of this repository:

    poetry install --all-extras
    
  5. Run the following command to launch a shell that is preconfigured with the project's virtual environment:

    poetry shell
    

How to add notice types

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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 called example.json in your new directory.

  5. Adjust your parser and repeat the previous step until the example.json file is perfect.

  6. Create a pull request to add the new directory.

About

Convert GCN Classic notices to JSON

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages