ECMWFCode4Earth / vAirify

code repository for 2024 Code for Earth project #16
MIT License
1 stars 0 forks source link

Create an API to query in situ data for single city page #47

Closed amehta-scottlogic closed 4 days ago

amehta-scottlogic commented 1 month ago

Acceptance Criteria

For this ticket to be done it must include automation

Test Checklist:

mnyamunda-scottlogic commented 3 weeks ago

Test Analysis

Functionality

Having spoken to Ajay (Mike):

User should be able to enter required parameters which will essentially filter/query the DB and return matches in JSON format. Charter 11: Explore GET air‐pollutant measurements In Situ API with creative parameters and headers to discover surprises

Parameters.

Output

Error

Data

Must be regressed, important query function.

mwalker-scottlogic commented 2 weeks ago

forecast_api_seeded_data_tests.py, forecast_api_validation_tests.py, cams_known_grib_test.py, forecast_calibration_tests.py & open_aq_etl_tests.py tests all passed.

Executed manual test cases, had to make some changes to test assertions, but expected behaviour was observed

mwalker-scottlogic commented 1 week ago

Finding - api_source is in response unexpectedly

Description:

Steps to Reproduce:

  1. Make a Postman call that will return data e.g. in the form /air-pollutant/measurements?date_from=2024-06-21T14%3A00%3A00.000%2B00%3A00&date_to=2024-06-21T16%3A00%3A00.000%2B00%3A00&location_type=city
  2. Observe response and compare to AC

Expected:

Actual:

mwalker-scottlogic commented 1 week ago

Finding - location_names param spelled incorrectly

Expected:

Actual:

mwalker-scottlogic commented 1 week ago

Exploratory testing Findings

Charter 11: Explore GET air‐pollutant measurements In Situ API with creative parameters and headers to discover surprises

mwalker-scottlogic commented 1 week ago

Finding - api_source 500

Steps to reproduce:

Expected:

Actual:

for OpenAQ: 422 status code Image

for openaq: 500 status code

Image

mwalker-scottlogic commented 4 days ago

We discovered that if you send a request to the air-pollutant/measurements endpoint and have seeded in the in_situ database data which has an api_source that also isn't "OpenAQ" you get a 500 response. This has been determined to be expected behaviour so tests have been added for this to make sure this continues. We need to prevent incorrect data entering the database using schema validation which has a ticket in the backlog.

All automated API tests are now passing