onc-healthit / onc-certification-g10-test-kit

ONC Certification (g)(10) Standardized API Tests
Apache License 2.0
34 stars 12 forks source link

Inferno should handle extensions on primitive elements (FI-2673) #411

Closed alexzautke closed 3 months ago

alexzautke commented 1 year ago

In the US Core 5.0.1 profile on QuestionnaireResponse extension are being defined on the primitive questionnaire element. These extensions are marked as must-support. Even if the extensions are provided in the test data, Inferno does not recognise them.

https://chat.fhir.org/#narrow/stream/179309-inferno/topic/US.20Core.205.2E0.2E1.20QuestionnaireResponse

richfirely commented 1 year ago

Hello, This issue causes a failure for US Core 5.0 testing in Multi-Patient API.

8.3.26 QuestionnaireResponse resources returned conform to the US Core QuestionnaireResponse Profile if bulk data has QuestionnaireResponse resources Could not find QuestionnaireResponse.questionnaire.extension:questionnaireDisplay, QuestionnaireResponse.questionnaire.extension:url in the 4 provided QuestionnaireResponse resource(s) for http://hl7.org/fhir/us/core/StructureDefinition/us-core-questionnaireresponse

Could the validation be removed until the primitives are handled correctly?

Thank you.

bholyshevskyi commented 7 months ago

It looks like this issue is relevant to US Core 6.1.0 as well.

yunwwang commented 7 months ago

Hello @bholyshevskyi Do you experience this same issue on QuestionnaireResponse in multi patients testing?

bholyshevskyi commented 7 months ago

@yunwwang yes, I have this issue for 8.3.30 QuestionnaireResponse.

bholyshevskyi commented 6 months ago

@yunwwang it looks like the issue is still reproducible on "ONC Certification (g)(10) Standardized API V.5.4.0 US Core 6.1.0 / USCDI v3, SMART App Launch 2.0.0, Bulk Data 2.0.0". For the next "QuestionnaireResponse" resource

{
  "resourceType": "QuestionnaireResponse",
  "identifier": {
    "system": "http://somesystem.com",
    "value": "9941339100"
  },
  "meta": {
    "profile": [
      "http://hl7.org/fhir/us/core/StructureDefinition/us-core-questionnaireresponse"
    ],
    "versionId": "e03b3f94-8541-40c1-8af8-11bdab75b0a4",
    "lastUpdated": "2024-05-15T14:00:50.711Z"
  },
  "questionnaire": "http://hl7.org/fhir/us/core/Questionnaire/hunger-vital-sign",
  "_questionnaire": {
    "extension": [
      {
        "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-extension-questionnaire-uri",
        "valueUri": "https://somesite.org/forms/hsv"
      },
      {
        "url": "http://hl7.org/fhir/StructureDefinition/display",
        "valueString": "disp"
      }
    ]
  },
  "status": "completed",
  "subject": {
    "reference": "Patient/e46b4258-2064-4d82-a09c-b077941a2a30",
    "display": "Amy V. Shaw"
  },
  "authored": "2020-09-10T21:56:54.671Z",
  "author": {
    "reference": "Practitioner/aef2a212-9502-41f5-82a0-981e450fb088",
    "display": "Ronald Bone"
  },
  "item": [
    {
      "linkId": "/88122-7",
      "text": "(I/We) worried whether (my/our) food would run out before (I/we) got money to buy more.",
      "answer": [
        {
          "valueCoding": {
            "system": "http://loinc.org",
            "code": "LA28397-0",
            "display": "Often true"
          }
        }
      ]
    },
    {
      "linkId": "/88123-5",
      "text": "The food that (I/we) bought just didn't last, and (I/we) didn't have money to get more.",
      "answer": [
        {
          "valueCoding": {
            "system": "http://loinc.org",
            "code": "LA28397-0",
            "display": "Often true"
          }
        }
      ]
    },
    {
      "linkId": "/88124-3",
      "text": "Food insecurity risk",
      "answer": [
        {
          "valueCoding": {
            "system": "http://loinc.org",
            "code": "LA19952-3",
            "display": "At risk"
          }
        }
      ]
    },
    {
      "linkId": "/88124-3",
      "text": "Food insecurity risk",
      "answer": [
        {
          "valueDecimal": 0.4,
          "item": [
            {
              "linkId": "/88124-3",
              "text": "Food insecurity risk",
              "answer": [
                {
                  "valueDecimal": 0.4
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "linkId": "/88124-3",
      "text": "Food insecurity risk",
      "item": [
        {
          "linkId": "/88124-3",
          "text": "Food insecurity risk",
          "answer": [
            {
              "valueDecimal": 0.4
            }
          ]
        }
      ]
    },
    {
      "linkId": "/88124-3",
      "text": "Food insecurity risk",
      "answer": [
        {
          "valueString": "yes"
        }
      ]
    }
  ],
  "id": "4d2e7f0d-8655-4bc6-96e0-ba3e0e5f2aab"
}

We still receive "Could not find QuestionnaireResponse.questionnaire.extension:questionnaireDisplay, QuestionnaireResponse.questionnaire.extension:url in the 1 provided QuestionnaireResponse resource(s) for http://hl7.org/fhir/us/core/StructureDefinition/us-core-questionnaireresponse".

I see the fix contains a test with a similar QuestionnaireResponse resource https://github.com/inferno-framework/us-core-test-kit/blob/main/spec/fixtures/QuestionnaireResponse.json. But the test resource doesn't have questionnaire property defined.

yunwwang commented 6 months ago

@bholyshevskyi I am so sorry previous fix we put in does not address your bulk data testing issue. Let me double check at.

At the same, can you verify if the same resource passes QuestionnaireResponse tests in US Core Test Suite for v6.1.0 (https://inferno.healthit.gov/test-kits/us-core/). This could hlep me reduce the scope of investigation.

Thank you.

bholyshevskyi commented 6 months ago

There is the same error message:

2.40.09 All must support elements are provided in the QuestionnaireResponse resources returned
Could not find QuestionnaireResponse.questionnaire.extension:questionnaireDisplay, QuestionnaireResponse.questionnaire.extension:url in the 1 provided QuestionnaireResponse resource(s)
yunwwang commented 6 months ago

@bholyshevskyi We incorrectly assumed that primitive element may have value or extension but not both. Thank you for point out that mistake. This above PR should address that.