Skip to content

Fixing a broken parser

Mads Nedergaard edited this page Jan 10, 2023 · 9 revisions

There are sometimes changes to data sources which breaks the parsers. You can find an overview of all parser issues here. If you are looking at a specific zone, you can find the log files on our public logs site: https://storage.googleapis.com/electricitymap-parser-logs/index.html to see if your parser(s) can fetch data successfully. The logs show warnings and errors for all parsers.

It might also be a good idea to look through some old issues on how other contributors have fixed parsers.

Running and testing parsers locally

  1. Set up your local development environment

  2. Ensure dependencies are installed:

    poetry install -E parsers
    
  3. From the root folder, use the test_parser.py command line utility:

    poetry run test_parser FR price  # get latest price parser for France
    poetry run test_parser FR  # defaults to production if no data type is given
    
    # test a specific datetime (parser needs to be able to fetch past datetimes)
    poetry run test_parser DE --target_datetime 2018-01-01T08:00
    poetry run test_parser "CH->FR" exchange # get the exchange data between Switzerland & France

Many of the tests require API keys of the data or web service providers, and therefore fail with an error message like

Exception: No ENTSOE_TOKEN found! Please add it into secrets.env!

In such cases, please browse the website related to the provider and ask for an API key. Once you get hold of the API key, make it an environment variable. This fixes the error.

Clone this wiki locally