inferno-framework / bulk-data-test-kit

Inferno Test Kit for servers implementing the Bulk Data Access Implementation Guide
Apache License 2.0
0 stars 0 forks source link

Error parsing Capability statement #16

Open vlad-ignatov opened 7 months ago

vlad-ignatov commented 7 months ago

Not sure exactly how to describe this one, but I hope the image gives you enough info.

Screenshot 2024-03-14 at 10 32 53 AM

The response being parsed is:

{
  "resourceType": "CapabilityStatement",
  "status": "active",
  "date": "2024-03-14T13:31:55+00:00",
  "publisher": "Boston Children's Hospital",
  "kind": "instance",
  "instantiates": [
    "http://hl7.org/fhir/uv/bulkdata/CapabilityStatement/bulk-data"
  ],
  "software": {
    "name": "SMART Sample Bulk Data Server",
    "version": "2.1.1"
  },
  "implementation": {
    "description": "SMART Sample Bulk Data Server"
  },
  "fhirVersion": "3.0.2",
  "acceptUnknown": "extensions",
  "format": [
    "json"
  ],
  "rest": [
    {
      "mode": "server",
      "security": {
        "extension": [
          {
            "url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris",
            "extension": [
              {
                "url": "token",
                "valueUri": "https://bulk-data.smarthealthit.org/auth/token"
              },
              {
                "url": "register",
                "valueUri": "https://bulk-data.smarthealthit.org/auth/register"
              }
            ]
          }
        ],
        "service": [
          {
            "coding": [
              {
                "system": "http://hl7.org/fhir/restful-security-service",
                "code": "SMART-on-FHIR",
                "display": "SMART-on-FHIR"
              }
            ],
            "text": "OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)"
          }
        ]
      },
      "resource": [
        {
          "type": "Patient",
          "operation": [
            {
              "extension": [
                {
                  "url": "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation",
                  "valueCode": "SHOULD"
                }
              ],
              "name": "export",
              "definition": {
                "reference": "http://hl7.org/fhir/uv/bulkdata/OperationDefinition/patient-export"
              }
            }
          ]
        },
        {
          "type": "Group",
          "operation": [
            {
              "extension": [
                {
                  "url": "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation",
                  "valueCode": "SHOULD"
                }
              ],
              "name": "export",
              "definition": {
                "reference": "http://hl7.org/fhir/uv/bulkdata/OperationDefinition/group-export"
              }
            }
          ]
        },
        {
          "type": "OperationDefinition",
          "profile": {
            "reference": "http://hl7.org/fhir/Profile/OperationDefinition"
          },
          "interaction": [
            {
              "code": "read"
            }
          ],
          "searchParam": []
        }
      ],
      "operation": [
        {
          "name": "get-resource-counts",
          "definition": {
            "reference": "OperationDefinition/-s-get-resource-counts"
          }
        },
        {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation",
              "valueCode": "SHOULD"
            }
          ],
          "name": "export",
          "definition": {
            "reference": "http://hl7.org/fhir/uv/bulkdata/OperationDefinition/export"
          }
        }
      ]
    }
  ]
}

To reproduce, run it with the SMART Server preset.

P.S. I am making some changes to the Bulk Data Reference Server which may require you to update the preset:

  1. Fhir base url with optional auth: https://bulk-data.smarthealthit.org/eyJlcnIiOiIiLCJwYWdlIjoxMDAwMCwiZHVyIjoxMCwidGx0IjoxNSwibSI6MSwic3R1IjozLCJkZWwiOjAsInNlY3VyZSI6MH0/fhir
  2. Fhir base url with required auth (what you want): https://bulk-data.smarthealthit.org/eyJlcnIiOiIiLCJwYWdlIjoxMDAwMCwiZHVyIjoxMCwidGx0IjoxNSwibSI6MSwic3R1IjozLCJkZWwiOjAsInNlY3VyZSI6MX0/fhir
  3. Group ID: 5033ae08-fb5b-40fb-ab9a-23674bc1b42b. This is 3 patients only, therefore good for testing. However, group IDs might change if I re-generate the patient data, in which case I'll let you know.
arscan commented 7 months ago

Hmm, strange. This is breaking because our code is expecting a string for operation.definition, not an object with a reference key. I just ran it, and it passed because it is a string as our test expects. We'll take a closer look. Regardless, you should never see those 'purple runtime errors' and our tests need to be more tolerant to unexpected content in responses... so we'll clean that up.

Regarding groups, it would be nice if the group ids were static and printed in the interface, as it is something you need to communicate with clients out-of-band (of the bulk data spec) so would be helpful for them to have, right? No problem if not though, just an idea.

And while I'm just looking at the capability statement, looks like you have capabilitystatement-expectations still in there, but those don't make a lot of sense for 'instance' kind CapabilityStatements. They are more for kind=requirements CapabilityStatements (as you would find provided in an IG) I believe.

Thanks for the feedback, much appreciated.

yunwwang commented 7 months ago

operation.definition is a canonical which is basically a string.

image

arscan commented 7 months ago

Right, I seem to recall pre-R4 FHIR was a reference and not a canonical, and your server supports pre-r4, so seems like maybe we are running tests expecting R4 but are configured to run against a DSTU2 or STU3 simulated endpoint.

vlad-ignatov commented 7 months ago

Ups, yes I somehow ran it with wrong server URL pointing to the R3 version of the server, where that is a reference. Seems to work fine with the right R4 URL (https://bulk-data.smarthealthit.org/eyJlcnIiOiIiLCJwYWdlIjoxMDAwMCwiZHVyIjoxMCwidGx0IjoxNSwibSI6MSwic3R1Ijo0LCJkZWwiOjAsInNlY3VyZSI6MX0/fhir/metadata). Perhaps you can still add some protection against incorrect input, but otherwise feel free to close this. Thanks!

vlad-ignatov commented 7 months ago

Regarding groups, it would be nice if the group ids were static and printed in the interface, as it is something you need to communicate with clients out-of-band (of the bulk data spec) so would be helpful for them to have, right? No problem if not though, just an idea.

Very good idea! Groups are now listed on the home page https://bulk-data.smarthealthit.org/index.html. Thanks!