awslabs / fhir-works-on-aws-deployment

A serverless implementation of the FHIR standard that enables users to focus more on their business needs/uniqueness rather than the FHIR specification
Apache License 2.0
298 stars 161 forks source link

[Bug] MedicationRequest POST - required invalid error #515

Closed rhinozD closed 2 years ago

rhinozD commented 2 years ago

Describe the bug 400 Error response when Post Medication Request resource. It was OK when Post other resources.

To Reproduce Steps to reproduce the behavior:

  1. Go to {{API_URL}}/MedicationRequest
  2. Body data :
    {
    "resourceType": "MedicationRequest",
    "id": "medrx002",
    "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: medrx002</p><p><b>identifier</b>: 12345 (OFFICIAL)</p><p><b>status</b>: active</p><p><b>intent</b>: order</p><p><b>medication</b>: <a>prescribed medication</a></p><p><b>subject</b>: <a>Donald Duck</a></p><p><b>encounter</b>: <a>encounter that leads to this prescription</a></p><p><b>authoredOn</b>: 01/03/2015</p><p><b>requester</b>: <a>Patrick Pump</a></p><p><b>reasonCode</b>: Essential hypertension (disorder) <span>(Details : {SNOMED CT code '59621000' = 'Essential hypertension', given as 'Essential hypertension (disorder)'})</span></p><p><b>dosageInstruction</b>: </p></div>"
    },
    "identifier": [
    {
      "use": "official",
      "system": "http://www.bmc.nl/portal/prescriptions",
      "value": "12345"
    }
    ],
    "status": "active",
    "intent": "order",
    "medicationReference": {
    "reference": "Medication/med0316",
    "display": "prescribed medication"
    },
    "subject": {
    "reference": "Patient/pat1",
    "display": "Donald Duck"
    },
    "encounter": {
    "reference": "Encounter/f001",
    "display": "encounter that leads to this prescription"
    },
    "authoredOn": "2015-03-01",
    "requester": {
    "reference": "Practitioner/f007",
    "display": "Patrick Pump"
    },
    "reasonCode": [
    {
      "coding": [
        {
          "system": "http://snomed.info/sct",
          "code": "59621000",
          "display": "Essential hypertension (disorder)"
        }
      ]
    }
    ],
    "dosageInstruction": [
    {
      "sequence": 1,
      "text": "Take one tablet daily as directed"
    }
    ]
    }
  3. Click Send
  4. See error
    {
    "resourceType": "OperationOutcome",
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">error</td><td>[]</td><td><pre>resource should have required property 'resourceType'</pre></td></tr></table></div>"
    },
    "issue": [
        {
            "severity": "error",
            "code": "invalid",
            "diagnostics": "resource should have required property 'resourceType'"
        }
    ]
    }

Expected behavior Expected to Post successfully.

Versions (please complete the following information):

rsmayda commented 2 years ago

I can't seem to reproduce it. To better help could you answer these questions:

Thanks!

rhinozD commented 2 years ago

@rsmayda

What is your validator? JSON Schema or the HAPI Validator?
If HAPI what IGs are you using?
Also did you make any changes to this configuration file?

I just cloned version 4.0.0, deployed it and try to post a MedicationRequest. So, everything was default. This is my response from the Post request: image

In fact, it only happen when I use Postman to make MedicationRequest post request. the request works fine when I make it by Axios(programmatically).

rsmayda commented 2 years ago

In fact, it only happen when I use Postman to make MedicationRequest post request.

Weird! Can you try a different MedicationRequest body? (i.e. delete the whole Postman body and paste in another valid option)

maghirardelli commented 2 years ago

Closing due to no response