Hello everyone,
we were working on a system usign php, MYSQL and angular 7. We took a decision to convert to dhis2 for multiple reasons.
I installed everything, and even converted our huge database from MySQL syntax into PostgreSQL. But it appears that the database should be implemented, while we’re creating data elements and organization units and groups.
Can we connect data elements to database already exists on PostgreSQL server in someway?
Glad to have you in the community! Seems like I haven’t understood your question clearly - also kindly let us know your version of DHIS2, the PostgreSQL version you are running @bobj - kindly help out here…
Hello I am using the newest dhis version, pgAdmin for PostgreSQL. I already have a database with its postgreSQL script. I need to connect data elements to its existing tables.
So if I have a table called individuals, I connect a form to gather info of persons and data will be added to this table.
Your system based on mySQL, PHP, and Angular 7 - is that a system based on the DHIS2 data model (and if yes, which version?) or a different model?
Because if it’s a different system/data model altogether, and since technically converting the database from MySQL to PostgreSQL do not change the data model (tables, indexes, constraints), you won’t be able to use the data in DHIS2.
Trying to design some kind of back-end “conversion layer” between DHIS2 and another data model makes little sense to me - it would be a nightmare to maintain even if you managed to design it in the first place.
So if your legacy data model is different, you need to
design the equivalent configuration (meta-data, reports, etc) in DHIS2
map the legacy tables & fields to the equivalent meta-data in DHIS2
transfer the data
I’m not sure what you mean by “huge” database, but if it is a few hundred GB, I would not recommend using the DHIS2 API for the transfer of data. I would look at ways of inserting the data directly into the DHIS2 database. Which is straightforward in terms of aggregated data and event data, but more difficult with tracker data (you don’t indicate what type of data it is).
As a general approach, I would add the relevant DHIS2 uid values etc to the tables in your original db, and then dump the data out in a format that can be directly imported into the DHIS2 data model.