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
[ ] Start by figuring out what async calls are made by the root/type resolvers of Gateway
[ ] Implement FHIRBundleToOpenCRVSFormat, take it into use everywhere where getRecordById is used in packages/gateway. Try to keep everything as strictly typed as possible
Description
Implement the OpenCRVS response format for the
/records/{recordId}
endpoint.If any client requests the record with the following header
The high-level idea is to implement a function
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
FHIRBundleToOpenCRVSFormat
, take it into use everywhere wheregetRecordById
is used inpackages/gateway
. Try to keep everything as strictly typed as possible