opencrvs / opencrvs-core

A global solution to civil registration
https://www.opencrvs.org
Other
85 stars 67 forks source link

Implement OpenCRVS response format for search /records/{recordId} endpoint #7287

Open rikukissa opened 3 months ago

rikukissa commented 3 months ago

Description

Implement the OpenCRVS response format for the /records/{recordId} endpoint.

If any client requests the record with the following header

Accept: application/opencrvs+json

The high-level idea is to implement a function

function FHIRBundleToOpenCRVSFormat(bundle: ValidRecord): OpenCRVSRecord {}

For this, it would be extremely useful if we could repurpose our GraphQL type resolvers by moving them to be used by this function and then using this function in turn in gateway to not need real type resolvers anymore for the GraphQL server. If this is too difficult however, then let's just copy the resolvers to a new module in search and leave gateway as is.

Motivation

Once we do this, we can start refactoring code places where we read records to our simplified data format. At first, thiis can for instance mean implementing new search indexing endpoints to use the new data format when writing ES records. Over time, we can introduce writing to the database in own format, either through a OpenCRVS -> FHIR converter (which we do have today), or directly in the OpenCRVS format. This is a step towards that.

Tech tasks