- PostgreSQL are installed somewhere.
-
Put the SQL files into the code folder.
-
Import the generated synthetic data into the database:
psql -U your_super_user_name -f dump-synthea-202212120538.sql
This SQL is exported from the PostgreSQL database. The data inside is generated using Synthea 2.7.0 and imported using the ETL tool provided in the reference. The data is generated using the following command (no need to run this):
java -jar .\synthea-with-dependencies.jar -s 12 -p 100 --exporter.csv.export true
- Create 2 users: user1 and readonly:
psql -U your_super_user_name -d synthea -f create_user.sql
- Create a query using table joins and where clause:
psql -U your_super_user_name -d synthea -f create_query.sql
Inside the SQL files there are explanations and optimizations of the query.
- Install relevant dependencies
pip install -r requirements.txt
- Setup environment variables for PostgreSQL, for example:
export synthea_user=test synthea_password=test synthea_host=localhost synthea_port=5432 synthea_database=synthea
- Run main.py and get test results
python main.py
- To run unit tests:
python -m unittest tests.test_main
The github repository is here: https://github.com/wanghewen/synthea_query