-
Notifications
You must be signed in to change notification settings - Fork 15
Add mock scenario
jannisvisser edited this page Jan 17, 2025
·
3 revisions
An integral part of any non-production environment is mock data. This guide explains how to add or update mock scenarios.
NOTE: The setup of the mock data aims to follow the structure of the API-calls being made from a pipeline, as detailed per disasterType
there.
- with most data being on event-basis
- but some data also being across events, outside of event-loop.
- Mock data is
- in the mock-data folder
- then split by
disasterType
- then split by
countryCodeISO3
- The
countryCodeISO3
contains ascenarios.json
(example MWI flash-floods)
- which contains multiple scenarios:
- REQUIRED:
no-trigger
scenario. This does not come withevents
.- This is the scenario that can be loaded from Portal as
No trigger
- And is loaded by
mock/all
when usingtriggered: false
- This is the scenario that can be loaded from Portal as
- REQUIRED:
trigger
scenario, this also hasdefaultScenario: true
.- This is the scenario that can be loaded from Portal as
Trigger
- And is loaded by
mock/all
when usingtriggered: true
- This is the scenario that can be loaded from Portal as
- Any amount of other scenarios can be loaded here.
- These can be separately loaded from Swagger Interface, but currently not from Portal.
- Each scenario (except
no-trigger
) has anevents
array with one or more events.
- an
event
has aneventName
, which can have certain restrictions-
flash-floods
: equal to admin-level 2 area name. -
drought
: equal to<regionName> <seasonName>
as defined indroughtSeasonRegions
ofcountries.json
-
floods
: equal to Glofas station name or Glofas station code. -
malaria
: equal toleadTime
(NOTE: this is a hacky use of events, and is up for refactor) -
typhoon
: no restrictions
-
- and typically a
leadTime
- except for
drought
, where this is calculated based on current month - NOTE: ongoing event should be set by a
0-hour/0-day-0-month
leadTime
- except for
- Per scenario create a folder matching the
scenarioName
- and in it, a folder per event matching the
eventName
, which contains:- json file per dynamic admin-area layer as defined in
indicator-metadata.json
- this file should only include those
placeCodes
that are part of the event.
- this file should only include those
- json filer per dynamically updated points or lines layer (currently
flash-floods
only) - Additonally
- for
typhoon
: addtyphoon-track.json
- for
floods
: add-
glofas-station.json
, contains only the station of this event -
triggers-per-leadtime.json
, contains trigger status for allleadTimes
, thereby indicating duration/complete evolution of the event, instead of just the startingleadTime
-
- for
flash-floods
: dynamic gauge data (ifgauges
layer present)
- for
- json file per dynamic admin-area layer as defined in
- some data is additionally required overall, not per event:
-
floods
:glofas-stations-no-trigger.json
. This contains all stations not part of an event. - raster data: This data is also not per event, but is handled/placed differently because of it's data format. See 5. Mock raster data.
-
- Mock raster data
- Raster data is handled via Geoserver
- Mock raster data is placed in (gitignored)
mock-output
folder in raster-files folder. - Create a
.tif
file per dynamic raster layer. - Name format is
-
<layerName>_<leadTimeUnit>_<countryCodeISO3>
, whereleadTimeUnit
is e.g.day
/hour
/month
- UNLESS the mock setup requires different raster layers per
leadTime
, in which case replaceleadTimeUnit
byleadTime
, e.g.6-hour
.
-
- NOTE: the mock data file you use, should preferably be immediately of the correct bounding box for the country/region, as the Geoserver-layer that is created based on this data bases bounding box on this. So if you do not have the correct data yet, use another raster file of the same country as dummy, and not a copy of another country.
- NOTE 2: Since this mock data is not part of the repo, you have to transfer it to remote environments separately.