IATI / D-Portal

http://d-portal.org/
Other
31 stars 23 forks source link

Add participating orgs to Q API #614

Open davidmegginson opened 3 years ago

davidmegginson commented 3 years ago

Thank you very much for providing the Q API, which meets a lot of people's data needs without getting into the complexity of DQuery. I'd like to suggest adding a join table for participating orgs, alongside the others listed at

https://github.com/devinit/D-Portal/blob/master/documents/dstore_q.md#the-from-part-of-an-sql-statement

I think there's a good case that organisations go well with sectors and countries/locations for disaggregation, because they are the classic 3Ws (Who? What? Where?) of aid activity reporting.

notshi commented 3 years ago

The Q API is very old and was just all the bits we needed at the beginning of the project, which is why it didn't include participating-org and many other elements of IATI data.

dQuery was built to enable the search and filter function so it was designed as a more advanced tool to query the full IATI data.

What would be nice is if we could produce something that was halfway between the two; ie. a simple API that works with the full IATI data.

Unfortunately, there is no development time allocated to us at present.

davidmegginson commented 3 years ago

Understood. I want to keep my current project simple for the next person who has to work on it, so right now, my plan is to go with the Q API and parse the XML, rather than getting into the complexity of DQuery. If the app we're building had to make multiple customisable queries based on user input, then the power and flexibility of DQuery would be a good path forward, but it's not worth making a future developer learn it for just one fixed API query.

And thanks again, BTW, for a great platform and API access.

davidmegginson commented 3 years ago

I won't object if you want to close this issue for now, so that you don't have a big backlog of things you can't realistically get to. Your call.

notshi commented 3 years ago

Thanks, @davidmegginson - will leave it here for now as a hopeful feature.

xriss commented 3 years ago

BTW you can use participating orgs in the query as part of the q filters, but it may requires a bit of escaping of / and @ characters as they are used in the query string eg

http://d-portal.org/q?/participating-org@activity-id=XM-OCHA-CBPF-TUR70-2019

will get activities that contain a reporting org with the given activity-id

the / at the start of /participating-org triggers the q api to go look inside the xson tables, so you can use any iati xml path here.

unfortunately you can not easily combine this with an @role as the role would not be tightly bound to a specific reporting org id. It would just find any occurrence of that role and any occurrence of that id within an activity. This is a shortcoming of the whole q API

davidmegginson commented 3 years ago

Thanks, @xriss !