trifork / klg-docs

Public documentation for Gateway
0 stars 8 forks source link

Issues with invalid endpoint. "The FHIR endpoint on this server does not know how to handle POST operation[Bundle]" #14

Closed LindaLawton closed 2 years ago

LindaLawton commented 2 years ago

I think I have authorization working but when I try to send requests to the new endpoint. I am getting an error.

I was told that this is the new endpoint https://care-gateway.test001.ehealth.sundhed.dk/fhir I assume that the endpoint to post the bundle to would then be https://care-gateway.test001.ehealth.sundhed.dk/fhir/Bundle

If I don't send an access token I get the following, as I would expect since I am not authorized.

RBAC: access denied

Request attempt 1 (sanity check)

Sending to just the basic endpoint with an access token. results in an error as i am not sending an operation name that being bundle.

https://care-gateway.test001.ehealth.sundhed.dk/fhir

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "This is the base URL of FHIR server. Unable to handle this request, as it does not contain a resource type or operation name."
        }
    ]
}

request attempt two

So i tried sending the request to the bundle endpoint.

https://care-gateway.test001.ehealth.sundhed.dk/fhir/Bundle

The error message i am getting confuses me. This is a Http post request with the json body of the bundle i am trying to post. This is the exact same post that i made to the old endpoint. Why would it be looking for Http parameters? The old endpoint supported ?_format=json&_pretty=true query parms but this endpoint doesn't appear to support them.

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "not-supported",
            "diagnostics": "Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[Bundle] with parameters [[]]"
        }
    ]
}

update attempt 3

Tried adding the bundle Id. I am just guessing at this point I cant find anything about parameters for the Post request in the documentation Care Gateway

https://care-gateway.test001.ehealth.sundhed.dk/fhir/Bundle?id=TestReport

{ "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "not-supported", "diagnostics": "Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[Bundle] with parameters [[id]]" } ] }

Post body sending for both requests is

{
  "resourceType": "Bundle",
  "id": "TestReport",
  "meta": {
    "profile": [
      http://gateway.kl.dk/1.0/StructureDefinition/klgateway-care-delivery-report
    ]
  },
  "type": "collection",
  "timestamp": "2021-05-31T12:03:24.280864+02:00",
  "entry": [
    {
      "fullUrl": "Patient/TestPatient001",
      "resource": {
        "resourceType": "Patient",
        "id": "TestPatient001",
        "meta": {
          "profile": [
            http://gateway.kl.dk/1.0/StructureDefinition/klgateway-care-citizen
          ]
        },
        "identifier": {
          "use": "official",
          "system": "urn:oid:1.2.208.176.1.2",
          "value": "0101010101"
        },
        "managingOrganization": {
          "identifier": {
            "use": "official",
            "system": "urn:oid:1.2.208.176.1.1",
            "value": "123456789012345"
          }
        }
      }
    },
    {
      "fullUrl": "Encounter/bfa70a76-318d-453d-9abc-76982f8d13ca",
      "resource": {
        "resourceType": "Encounter",
        "id": "bfa70a76-318d-453d-9abc-76982f8d13ca",
        "meta": {
          "profile": [
            http://gateway.kl.dk/1.0/StructureDefinition/klgateway-care-encounter
          ]
        },
        "status" :"planned",
        "subject": {
          "reference": "Patient/TestPatient001"
        },
        "period": {
          "start": "2021-05-31T12:03:24.2828042+02:00"
        },
        "class": {
          "system": http://terminology.hl7.org/CodeSystem/v3-ActCode,
          "code": "HH"
        },
        "type": [
          {
            "coding": [
              {
                "system": http://kl.dk/fhir/common/caresocial/CodeSystem/KLCommonCareSocialCodes,
                "code": "9f03dfbb-7a97-45a5-94db-d4c3501714a9"
              }
            ]
          }
        ],
        "performedDateTime": "0001-01-01T00:00:00"
      }
    },
    {
      "fullUrl": "Condition/VaskeSigLetteBegraensninger",
      "resource": {
        "resourceType": "Condition",
        "id": "VaskeSigLetteBegraensninger",
        "meta": {
          "profile": [
            http://gateway.kl.dk/1.0/StructureDefinition/klgateway-care-condition
          ]
        },
        "extension": [
          {
            "url": http://gateway.kl.dk/1.0/StructureDefinition/klgateway-care-follow-up-encounter-extension,
            "valueReference": {
              "reference": "Encounter/bfa70a76-318d-453d-9abc-76982f8d13ca"
            }
          }
        ],
        "clinicalStatus": {
          "coding": [
            {
              "system": http://terminology.hl7.org/CodeSystem/condition-clinical,
              "code": "active"
            }
          ]
        },
        "category": {
          "coding": [
            {
              "system": http://terminology.hl7.org/CodeSystem/condition-category,
              "code": "problem-list-item"
            }
          ]
        },
        "code": {
          "coding": [
            {
              "system": http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII,
              "code": "J1.1"
            }
          ]
        },
        "severity": {
          "coding": [
            {
              "system": http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII,
              "code": "B2"
            }
          ]
        },
        "subject": {
          "reference": "Patient/TestPatient001"
        },
        "recordedDate": "2021-05-31T12:03:24.2821854+02:00"        
      }
    },
    {
      "fullUrl": "Observation/OpleverIkkeBegraensningerMedVaskeSig",
      "resource": {
        "resourceType": "Observation",
        "id": "OpleverIkkeBegraensningerMedVaskeSig",
        "meta": {
          "profile": [
            http://gateway.kl.dk/1.0/StructureDefinition/klgateway-care-citizens-own-observation
          ]
        },
        "code": {
          "coding": [
            {
              "system": http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII,
              "code": "D"
            }
          ]
        },
        "subject": {
          "reference": "Patient/TestPatient001"
        },
        "status": "final",
        "effectiveDateTime": "2021-05-31T12:03:24.2816811+02:00",
        "valueCodeableConcept": {
            "coding": [
          {
            "system": http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII,
            "code": "D1"
          }]
        },
        "focus": [
          {
            "reference": "Condition/VaskeSigLetteBegraensninger"
          }
        ]
      }
    }
  ]
}
jkiddo commented 2 years ago

image

ohetrifork commented 2 years ago

So PUT to https://care-gateway.test001.ehealth.sundhed.dk/fhir/Bundle/[id] And use the same [id] inside the bundle

LindaLawton commented 2 years ago

If you check care gateway Page

The example shows HTTP Post is there any reason we can not continue to use the HTTP Post method we have been using since the beginning? To be clear we have been using the HTTP Post endpoint since July 2021 why the sudden change?

image

My issues with the id inside the bundle is that the system does not respect that id. The bundle Id we send is not the bundle ide that is returned in the response.

ohetrifork commented 2 years ago

Yes, that was the picture until the decision was taken to use client-assigned ids. That is illegal for POST requests - so PUT is required (see https://www.hl7.org/fhir/http.html#create)

Could you emphasize on your last comment? Which system do you refer to?

Thanks for pointing out the documentation error - I have corrected it now

LindaLawton commented 2 years ago

We have been testing the connection to KL gateway since June. Using this end point. With a HTTP Post request as we were instructed.

"KlGateway": { "Hostname": "https://kl-gateway-testserver.azurewebsites.net", "Path": "/fhir/Bundle?_format=json&_pretty=true",

Then late January 2022 the endpoint was shutdown and we were told to use

 "Hostname": "https://care-gateway.test001.ehealth.sundhed.dk",
 "Path": "/fhir/Bundle?_format=json&_pretty=true",

At that time my team member Mikael asked on Zulip if we would still be able to use the Post endpoint sending the full report as we have been for the last nine months. We had noted that we could not find it mentioned of the Post method Endpoint in the care gateway page. I believe he was told by Torben that this was not a problem and we could continue to do things has we have been.

My concern is that we are almost 10 months into the development process and the endpoint has changed. I am not accustom to specs changing this late in the development life cycle. I'm curious as to why we were not informed about this sooner. I am also worried the model has changed as well. We have serval months of extensive testing already complete using the POST endpoint we now need to redo that testing with the PUT endpoint

jkiddo commented 2 years ago

@LindaLawton we dont make picture perfect specs. Noone does that. In collaboration with @tmh-mjolner (responsible for the FHIR IG's that define the data model) we found that the suggested pattern with using POST would violate the standard - and it does. We found this bug back in late November. Why it wasn't announced I cannot say. Anyways, you need to use PUT as specified. Without knowing anything about your codebase I cannot imagine that this will be a change of paramount proportions, being a change from POST to PUT, but I could of course be wrong.

LindaLawton commented 2 years ago

@jkiddo I completely understand the need for changes they are part of the development process. That being said when implementing obvious breaking changes its accepted practice to announce them before they are implemented. This makes it possible for developers using your system to spec it into their process.

You broke my system with no warning. That is what i am objecting to. Not that you changed something.

jkiddo commented 2 years ago

I agree. Keeping the POST option open would however break the standard, break business rules and cause all kinds of pain. You should have been notified back in November. It was a mistake that you weren't.

jkiddo commented 2 years ago

@LindaLawton I can see that your colleague also found out Feb 16. that PUT is what is supported from https://chat.fhir.org/#narrow/stream/274483-denmark.2Fkl.2Fprofile.2Fkl-gateway/topic/When.20changes.20to.20a.20citizen.2FDeliveryReport.2E.20Should.20we.20update.20a

LindaLawton commented 2 years ago

I don't have access to that forum so cant really comment on what was posted there.

jkiddo commented 2 years ago

Its an open forum

jkiddo commented 2 years ago

Wait a minute ... it looks like @tmh-mjolner put a lock on it. @tmh-mjolner would you please open it up?