Context: the api/query endpoint currently accepts a patient resource as the body of a POST request and parses patient demographics from the resource to make the query. We need to add some error handling to check whether the patient resource is a valid resource.
I haven't looked into whether there is an existing resource we could use or possibly check if the requestBody has the expected fhir/r4 elements that we parse in parsePatientDemographics.
Acceptance Criteria:
[ ] The requestBody is checked to be a valid Patient resource
[ ] If there is an error, the user sees an error message that explains the patient resource is not valid
[ ] The TODO for creating additional error handling for this issue is removed the route.ts file
Context: the
api/query
endpoint currently accepts a patient resource as the body of a POST request and parses patient demographics from the resource to make the query. We need to add some error handling to check whether the patient resource is a valid resource.I haven't looked into whether there is an existing resource we could use or possibly check if the
requestBody
has the expectedfhir/r4
elements that we parse inparsePatientDemographics
.Acceptance Criteria:
requestBody
is checked to be a valid Patient resourceroute.ts
file