Skip to content

idmc-labs/helix-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,892 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helix Server

Build Status Maintainability Test Coverage

Initialize environment

Create a .env file in the project folder. (For development, blank file is fine)

Get started with:

docker compose up

Initialize database

./init.sh

Initialize database (seed)

# Fix the full_name constraint
docker compose exec server python manage.py save_users_dummy
docker compose exec server python manage.py create_dummy_users

docker compose exec server python manage.py loadtestdata <case sensitive model_names> --count 2
# eg.
# docker compose exec server python manage.py loadtestdata Country --count 2
# docker compose exec server python manage.py loadtestdata Resource ResourceGroup --count 2

And navigate to localhost:9000/graphiql to view available graphs. Use localhost:9000/graphql to interact with the server from the client.

One time commands

Save geojson for each country

python manage.py split_geojson

Generate fresh graphql schema.

python manage.py graphql_schema --out schema.graphql

Populate pre 2016 conflict and disaster data for GIDD

python manage.py update_pre_2016_gidd_data.py old_conflict_data.csv old_disaster_data.csv

Populate IDPs SADD estimates table

python manage.py update_idps_sadd_estimates idps_sadd_estimates.csv

Setup S3 buckets

This will create appropriate buckets with required policies based on the .env.

sh deploy/scripts/s3_bucket_setup.sh

To enable two factor authentication (generate statictoken) of admin user from command line

python manage.py addstatictoken -t 123456 "admin@idmcdb.org"

Management Command

There are custom management commands available to facilitate specific tasks.

Populate figure Calculation Logic

./manage.py populate_calculation_logic_field

NOTE: This command populates the calculation_logic field in the Figure Table if there is no existing data in it.

Populate Household Size table and update AHHS data for the year 2024

./manage.py update_ahhs_2024 update_ahhs.csv

NOTE: This command populates the HouseholdSize Table and updates AHHS data in the Figure Table specifically for the year 2024.

Force Update GIDD Data

./manage.py force_update_gidd_data

NOTE: This command forces an update of GIDD data. It's important to note that this command is intended for local development purposes only, so it should be used with caution.

Testing in development machine

Feel free to test in your style. Here, the test-docker-compose.yml doesn't persist data from test.

docker compose -f docker-compose.yml -f test-docker-compose.yml run --rm server pytest --reuse-db

About

Helix IDMC Server

Resources

Stars

0 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors

Languages