athenahealth / apiserver-athenaFlex

Software developers can use sample code and documentation to use athenahealth's athenaPractice/athenaFlow FHIR API Server.
https://mydata.athenahealth.com/home
17 stars 7 forks source link

POSTing a FHIR Bundle #272

Closed alianhm closed 1 year ago

alianhm commented 1 year ago

Your question

Is it possible to POST a FHIR bundle? Which will be the endpoint in the sandbox I need to send my POST request to?

I need to post multiple related Observations, so wondering if is possible to send them as a Bundle.

Thanks.

Torin-Shepard-athena commented 1 year ago

@alianhm Please see the sample OBS write Bundle at https://github.com/athenahealth/apiserver-athenaFlex/issues/197#issuecomment-896374670 You POST Bundles like this to the base FHIR R4 base URL https://fhir.server.fqdn.com/dbnameAPIServer/fhir/r4

alianhm commented 1 year ago

Thank you for you quick response on this. I created the Bundle and posted it to the URL you indicated. This is the error I'm getting in response:

"diagnostics": " Bundle.entry.fullUrl is invalid"

The fullURL is the same that is being used in the sample:

http://apsandbox.fhirapi.athenahealth.com/demoAPIServer/fhir/Observation

I believe it requires an ID, but at this point we are creating the Observation.

Torin-Shepard-athena commented 1 year ago

@alianhm If you are posting the Bundle to ap22sandbox, then you'll need to update the values in the fullUrl elements.

alianhm commented 1 year ago

Yes, I did that. This is the my value for the fullUrl:

"fullUrl": "https://ap22sandbox.fhirapi.athenahealth.com/demoAPIServer/fhir/r4/Observation",

here is the full JSON I'm posting:

{ "resourceType": "Bundle", "type": "transaction", "entry": [ { "request": { "method": "POST", "url": "Observation" }, "fullUrl": "https://ap22sandbox.fhirapi.athenahealth.com/demoAPIServer/fhir/r4/Observation", "resource": { "resourceType": "Observation", "status": "final", "subject": { "reference": "Patient/1961415746177250" }, "performer": { "reference": "Practitioner/1975828132052550" }, "code": { "coding": [ { "system": "http://loinc.org", "code": "72166-2", "display": "Tobacco smoking status" }, { "system": "https://docs.mydata.athenahealth.com/fhir-r4/athenaFlex/codesystem/HDID/1000-4-9390", "code": "300015", "display": "SMOK STATUS" } ] }, "valueCodeableConcept": { "coding": [ { "system": "http://loinc.org", "code": "LA28398-8", "display": "Never true" } ], "text": "Never true" } } } ] }

Torin-Shepard-athena commented 1 year ago

There is a known issue with the fullUrl needing the port number. "fullUrl": "https://ap22sandbox.fhirapi.athenahealth.com:443/demoAPIServer/fhir/r4/Observation",

This gets past the HTTP 400 bad request error.

You may get HTTP 500 internal server error or HTTP 401 not authorized if there is any issue with access token.

You may get HTTP 423 Locked if the clinical list lock is taken by another document for a given patient.

alianhm commented 1 year ago

After adding the port I was able to POST the bundle. "response": { "status": "201 created", "location": "Observation/1996920465694810" }

Thanks!

AjeetYadav07 commented 1 year ago

@alianhm, we are marking this ticket as closed. Please raise a new ticket, if you have any query.