openIMIS FHIR data migration tool

Module repository:

https://github.com/openimis/openimis-fhir-data-migration_py

Supported FHIR version:

FHIR R4 (v4.0.1)

Description:

This tool has two main Tasks.

How to use the tool:

To fully interact with the console in PyCharm the user has to enable the “Emulate terminal in output console” checkbox. This can be found under: Run > Edit Configurations… > Execution (drop-down-menu) > Emulate terminal in output console.

Creating JSON files:

To create JSON files there must be an intact connection to the backend server. Once the server is running run the data_migration.py script.

  • Terminal:

python data_migration.py
  • Development Environment (e.g. PyCharm):

Simply run the script.

When the program runs, on the console/terminal a selection appears.

Fig. 1 - Console output after running the program

By pressing 2, the program automatically creates a folder called “json_files” in which all the JSON files are saved.

To update the JSON files there is no need to delete the files nor the folder by hand. The program automatically deletes the files inside the folder and saves the current state of the data.

Creating database tables:

To create the database tables PostgreSQL has to be installed. The reason PostgreSQL was used, is the fact that Michel Borer in his Bachelor thesis had the task to migrate the openIMIS database to PostgreSQL.

In PostgreSQL, the user has now to create a new user and a new database. Of course, a default user and database can be used. The easiest way to create these is to use the pgAdmin web application of Postgres.

When the user and database are created, the data migration tool can be run the same way as in the “Create JSON files” section. Like above, the output on the console appears, where the user now has to press 1 to create the tables.

Now the user has to fill in the database information to be able to establish a connection. If the database is locally created, simply ENTER can be pressed for the host and port input.

Afterwards the user can decide whether he wants to create all tables at once or only one specific table of his choice.

Once one or more tables are created, you have to refresh the table section in pgAdmin to get a list of them.

If a table has to be updated, it is not necessary to drop the tables by hand. The program drops (also the child tables if they exist) them automatically and new ones are created with the latest data from the API inside.

Did you encounter a problem or do you have a suggestion?

Please contact our Service Desk



This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/