Add country - rodekruis/IBF-system GitHub Wiki
Note
Adding a country comes with adding at least one disaster type
. This means we can infer from this guide also how to add a new disaster type
to an existing country. Some elements of the below list can be skipped in that case.
To add a country, we must choose a supported disaster type, map layers, and indicators.
- Add new country configuration
- Add administrative boundaries
- Add dynamic layers
- Add mock data
- Add static layers
- Layer and indicator descriptions
- Configure Geoserver
- Add Early Actions
- Configure notifications
- Add country user
- Create manuals
- Update country-specific code
Add new country configuration to countries.json
. Refer to existing examples for guidance.
- Collect the data from appropriate source and document where/when it was collected. Use mapshaper.org to reduce data size.
- Data format:
geojson
. Allfeatures
should be of typeMultiPolygon
. - File name format:
<countryISO3code>_adm<adminLevel>.json
. Example,MWI_adm3.json
. - Required properties:
ADM<adminLevel>_PCODE
,ADM<adminLevel>_EN
, andADM<adminLevel - 1>_PCODE
(parentPlaceCode). - Add the files to
/services/API-service/src/scripts/git-lfs/admin-boundaries
. Use existing data for reference.
In indicator-metadata.json
, add countryCodeISO3
for:
-
trigger
: this is a required indicator for all countries and disaster-types, indicating trigger status per admin-area. - Also required is the main exposure indicator, as defined per
disasterType
asactionsUnit
indisasters.json
.
Other indicators are optional:
- any other pre-existing indicators that are relevant for this country.
- add any new indicators for this country, in line with existing examples.
- same for pre-existing or new layers in
layer-metadata.json
, in line with existing examples.
- This deals with dynamic raster layers, e.g.
flood_extent
forfloods
. - In
layer-metadata.json
, addcountryCodeISO3
for any pre-existing or new layers withtype=wms
. - You also need to set up the respective Geoserver layers for this. See point (7) below.
- Currently only example is
typhoon_track
fortyphoon
, which comes with custom modules in code, and is not easily extendable.
Note
dynamic
refers here to the location of the points. Static point data (see point 5) can also have dynamically updated properties (e.g. exposure status), but not the location itself.
Add mock data for dynamic layers. Define scenarios trigger
and no-trigger
. In scenario trigger
define at least 1 event. For this event, use mock data guide to create mock data for each dynamic admin-area indicator
and adminLevel
, dynamic raster layers, dynamic point layers, and dynamic line layers.
- Add any pre-existing or new static admin-area layers in
indicators.json
, in line with other examples. - There are no required static layers for a working portal, but typically
populationTotal
per admin-area is added. - Include seed-data for each layer
- Add any pre-existing or new static admin-area layers in
layers.json
withtype=wms
, in line with other examples. - There are no required static layers for a working portal, but typically
population
raster is added. - Include seed-data for every layer in the (gitignored)
input
folder in raster-files folder. - Create a Geoserver layer for each layer, similar to how that is done for dynamic layers in point (7) below.
- Add any pre-existing or new static point or line layers in 'layers.json' with
type=point
, in line with other examples. - Certain layers are mandatory based on disaster type,
disasterType | layer |
---|---|
flood | glofas_stations |
- No other required layers, but typically
red_cross_branches
is added. - Include seed-data for each layer.
- This currently deals with
roads
andbuildings
inflash-floods
only, and comes with specific custom code modules.
Process (dummy) layer descriptions for all added layers and indicators in XLSX
- NOTE: the below is not ideal, but currently needed, as otherwise any changes in
indicator-metadata.json
andlayer-metadata.json
might be overwritten inadvertently. - after adding all indicators and layers, run '_add-info-popup-xlsx-columns.js`
- paste the resulting (gitignored)
new-lines.csv
at the bottom oflayer-popup-info.xlsx
- order all columns again by the first 3 columns (in that order) and save
- run '_convert-layer-info-popup-xlsx-to-json.js`
- open and save
indicator-metadata.json
andlayer-metadata.json
to apply prettier formatting again. - See for more details:
README.md
- For any
wms
layer inlayer-metadata.json
, you need to set up Geoserver stores and layers for every possibleleadTime
- You need some (mock) data to do this, so see
Mock raster data
in Add/update mock scenarios to IBF on where to place this. - Subsequently run the mock
trigger
scenario, which automatically creates a file in theraster-files/output
folder per relevantleadTime
as defined incountries.json
. - Create a Geoserver store+layer per relevant
leadTime
- Use the script
_generate-geoserver-layers.js
to easily generate this. - First adjust the static content of this script for your current country and disaster-type (search for
FILL IN
in the file)- the bounding box and related content
- pick the right styleId
- the right path of the tiff-file
- Run once per required
leadTime
as defined incountries.json
- At the end, run
docker restart ibf-geoserver
for the changes to take effect - Check the result by logging in the local Geoserver interface, through
Layer Preview
and choosingOpenLayers
format.
- Use the script
- If needed, for example if the static bounding box to fill in is unclear, you can create one layer manually and use that as base to update the script.
- Log in to local Geoserver interface
- Create a store based on GeoTiff file source.
- with name
<layerName>_<leadTime>_<countryCodeISO3>
- and pointing to the right location
file:workspaces/ibf-system/ibf-pipeline/output/<subfolder>/<filename.tif>
- Create a layer based on the store with same name and set the right style under
Publishing
- Test if Geoserver layer is correctly found by portal by seeding & mocking and toggling on the respective layer in the portal
- Not needed if
enableEarlyActions=false
incountries.json
- Otherwise, add early actions to EAP-actions.json for right
countryCodeISO3
anddisasterType
-
areaOfFocus.id
relates to areas-of-focus.json - If real data not available yet, dummy data can be added.
- Note that the
month
property is only applicable ifshowMonthlyEapActions=true
incountries.json
.
-
In Mailchimp
- Add a new tag
<countryCodeISO3> Test
to all developer-users in the audience - Add a new segment
<countryCodeISO3> Test
, referring to this new tag - Get the segment ID by
- Go to https://us18.admin.mailchimp.com/lists/segments?id=144018
- right-click right segment > copy link address
- paste it somewhere and deduce the segmentId from the URL
- Add the tag in .env MC_SEGMENTS as
<countryCodeISO3>_<disasterType>:<segmentId>
on local, ibf-test and ibf-demo - You can immediately create the producion tag+segment also as
PROD - <countryCodeISO3> <disasterType>
In code
- Add country in
notification-info.json
- Add trigger statement
- Add logo
- Paste all country logos from
countries.json
together in one.png
- Upload to Mailchimp > Content Studio > My Files > Upload
- Get the URL by selecting the picture > Expand 'View Details' > Copy URL
- Paste it in notification-info.json
- Paste all country logos from
- If applicable: set up WhatsApp or Telegram group, and add the link to join this group via
linkSocialMediaUrl
- Test sending an email by (loading triggered mock data first and) calling the
/api/notification/send
endpoint.
Add new user to users.json.
Upload on Youtube + edit link in bit.ly account (see IBF video manuals in Wiki) This is optional. If not provided, video content will be hidden in IBF dashboard.
Upload to https://510ibfsystem.blob.core.windows.net/manuals/IBF%20Manual-<country>-Published.pdf
Add countryCodeISO3
to country-time-zone-mapping.ts
.
To add a new country in a production instance, we must not use seed scripts as they will overwrite production configurations. Instead, process all the data changes preferably via migration files, or manually using API endpoints,
- Upload country (paste whole
countries.json
or just the new country)
Warning
when pasting whole countries.json
always remove any countries/disaster-types that should remain deactivated
- Update disaster type (paste whole
disaster-types.json
or just the new disaster type) - Update notification-info (paste whole
notification-info.json
or just the new country) - Upload admin boundaries (once per admin level)
Warning
may fail for the defaultAdminLevel if there has ever been a trigger event for this country
- Update indicator-metadata and layer-metadata (paste whole
*.json
) - Update static admin-area data (CSV files)
- Update EAP-actions (paste whole json or just the new actions)
- Update point layers and line layers (red cross branches, glofas stations, etc.)
- Create a new country user and store their password in Bitwarden
Also add new country to any (admin) all-country users:
INSERT INTO "IBF-app".user_countries("user", country) VALUES('<user-email>', '<countryCodeISO3>')