Which table in the database is section and /api/dataEntry/metadata fetching data from?

I clone the Data Entry (Beta) App. I console log the data that was fetched from the /api/dataEntry/metadata endpoint. Some data that I have already deleted from the Maintenance App and the database is still being fetched.

I will like to find out which table in the database is /api/sections and /api/dataEntry/metadata endpoints fetching data from?

Hi @jetisco4u

Dataset table relationship ER Diagram.
You can find all connections ther.

Metadata fetches data from different tables, as a complex combinations of those tables. Hope this ER diagram will be useful for you

Regards,

2 Likes

Thanks this is very useful. However, since most of these tables don’t have a FK in them, I belief the endpoints /api/sections and /api/dataEntry/metadata is fetching data from different tables as you said. So, I am interested in the tables that each endpoint get their data from.

@jetisco4u
it is not necessarily should be a single table.
try to use this request …/api/dataSets.json?fields=id,name,sections[id,name],formType,dataEntryForm[id,name] and if there formType= CUSTOM you have to open and look into that data in dataEntryForm.
Otherwise directly api/dataEntryForms.json?fields=* point wouldn’t provide you backlink to the DataSet.

Regards,

I agree because I already check the schemas and can see all the resources that associated with each resource. But my challenge is the endpoint itself as used in the Data Entry (Beta) form. It does not seems they are fetching from a resource endpoint or I couldn’t figure it out.

For example how do I get the resources the the /api/dataEntry/metadata is pulling data from?

@jetisco4u can you explain why you need to get direct access to the DB? What is your final intention? :thinking:

Regards,

I was having a challenge with the Data Entry (Beta) app. After I deleted the indicators assigned to the sections, the app failed to load. So I clone the app and inspect what was wrong. It turned out that, despite deleting the indicators from the maintenance app, the Data Entry (Beta) is still fetching the indicators through the /api/dataEntry/metadata endpoint. I went as far deleting the data in sectionindicators table in the database still the endpoint was still fetching the indicators. That is why I wanted to know where the api is getting the data.

By the way I have access to my local DB and can run SQL queries very well.

In that case you’d better get that data Entry and sections, and use Postman, by simply posting request api/metadata?importStrategy=DELETE and as payload put ids of that dataEntryfroms and sections.

Regards

1 Like

Hi @Ulanbek,

Can you share , if possible, tracker and event program tables relationship ER Diagram?

Thanks

2 Likes

Hi @hernandezmachava

Actually it consist of 2 part. TrackedEntityInstances

and programInstances

These table sets are covering whole trackedEntityInstance api request DHIS 2 Demo - Sierra Leone* as an example

Regards,

2 Likes

Hi @Ulanbek,

Thank you so much for sharing the tables.

1 Like