inferno-framework / us-core-test-kit

Inferno Test Kit for evaluating API conformance to the US Core Implementation Guide
Apache License 2.0
7 stars 5 forks source link

Fi 2455 granular scope read tests #170

Closed 360dgries closed 3 months ago

360dgries commented 4 months ago

Summary

Added read tests for Granular Scope groups.

Tests attempt to find a resource from the first search of each profile that matches the given scope(s), each scope is tested individually. After each scope has been checked, an attempt is made to find a resource that does not match any scopes. A read is performed on this resource, and should not be returned. Tests are skipped if any read cannot be populated from previous resources.

Testing Guidance

Added Spec tests that cover most cases. They behave as expected.

Running (US Core 7, Smart 2) against the reference server gives a 401, but I think that's a scope issue with the server -- by inspection: The following request was made: https://inferno.healthit.gov/reference-server/r4/Condition/84ab26cd-e0ea-4c8f-90fd-eddd939f3d9b.

the read yielded:

"resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "Access to Resource Condition is restricted due to invalid scopes"
    }
  ]
}

but this resource has a category value of encounter-diagnosis, so it should fit the scopes and be returned properly?

The resource:

{
      "fullUrl": "https://inferno.healthit.gov/reference-server/r4/Condition/84ab26cd-e0ea-4c8f-90fd-eddd939f3d9b",
      "resource": {
        "resourceType": "Condition",
        "id": "84ab26cd-e0ea-4c8f-90fd-eddd939f3d9b",
        "meta": {
          "versionId": "1",
          "lastUpdated": "2024-04-10T00:21:05.076+00:00",
          "profile": [
            "http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition"
          ]
        },
        "clinicalStatus": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
              "code": "resolved"
            }
          ]
        },
        "verificationStatus": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
              "code": "confirmed"
            }
          ]
        },
        "category": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
                "code": "encounter-diagnosis",
                "display": "Encounter Diagnosis"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "system": "http://snomed.info/sct",
              "code": "65363002",
              "display": "Otitis media"
            }
          ],
          "text": "Otitis media"
        },
        "subject": {
          "reference": "Patient/85"
        },
        "encounter": {
          "reference": "Encounter/c03951b3-00e5-4cb7-a271-805a15e6658b"
        },
        "onsetDateTime": "1947-11-01T00:11:45-05:00",
        "abatementDateTime": "1948-03-26T00:11:45-05:00",
        "recordedDate": "1947-11-01T00:11:45-05:00"
      }
    }