Stream: finnish PHR
Topic: Error 502420
Sulka Haro (Feb 07 2019 at 17:43):
Hi! I'm trying to insert data to the sandbox and getting "Error 502420 Only identifier is supported" that refers to http://phr.kanta.fi/fiphr-cs-errorcodes. Is the error code list downloadable somewhere? Is there some way to tell which element in the record the error is referring to? I've tried to read through the record and the profile and am having hard time figuring out what part of the data is considered invalid by the server and the error not identifying where the validation goes wrong is not helping. Halp! :D
Sulka Haro (Feb 08 2019 at 08:02):
Trying to insert the same object today through the HAPI UI gives error 501440, with diagnostic "Data is invalidnull". If I try to insert the record with an invalid patient reference, the server gives the correct error message that the patient is missing, so looks like the data is decoded correctly and at least some processing happens on it. http://hapi.fhir.org happily ingests the object, but obviously doesn't have as much validation in place.
Sulka Haro (Feb 08 2019 at 08:45):
Ok did some testing and found out that I can only insert Observations if there's a Patient record in the sandbox that has an id _and_ identifier that are both in UUID format and match each other, and the Observation then refers to the Patient with this UUID. Simultaneously I can create Patient records that do not enforce this use of UUIDs. I tested creating a Patient with a numeric ID and UUID Identifier and referring to that record with the Patient ID causes the same null error to happen, while using the Identifier reference fails as expected because no Patient with the ID exists.
Sulka Haro (Feb 08 2019 at 08:46):
I've previously inserted MedicationAdministrations to the sandbox and those didn't seem to have this UUID requirement - the sandbox happily allowed creating a Patient without an identifier element and inserting MedicationAdministrations that just used the Patient record id reference worked as expected.
Sulka Haro (Feb 08 2019 at 10:00):
Ok now that the sandbox HAPI UI accepts the records, the REST API still gives the following error: "error":{"data":{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","details":{"coding":[{"system":"http://phr.kanta.fi/fiphr-cs-errorcodes","code":"502420"}],"text":"Only identifier is supported"},"diagnostics":"Only identifier is supported"}]
Sulka Haro (Feb 08 2019 at 10:00):
I can take the record returned in the error message from the REST API and copy paste it to the HAPI UI and the record is accepted there
Sulka Haro (Feb 08 2019 at 10:03):
Sample record for testing here - this works when pushed from HAPI, fails when inserted over REST
{"resourceType":"Observation","meta":{"profile":["http://phr.kanta.fi/StructureDefinition/fiphr-bloodglucose-stu3-modified20190128"]},"language":"en","text":{"status":"extensions","div":"<div xmlns=\"http://www.w3.org/1999/xhtml\">Code: Home glucometer reading<br />Time: 2015-08-02T23:49:00.000Z<br />Result: 4.6 mmol/l</div>"},"extension":[{"url":"http://phr.kanta.fi/StructureDefinition/fiphr-unsignedint","valueUnsignedInt":8}],"identifier":[{"system":"urn:ietf:rfc:3986","value":"urn:uuid:fc28ad6f-55eb-4588-9bdb-0cc000317bac"}],"status":"final","category":[{"coding":[{"system":"http://hl7.org/fhir/observation-category","code":"vital-signs"}]}],"code":{"coding":[{"system":"http://loinc.org","code":"14743-9","display":"Glucose [Moles/volume] in Capillary blood by Glucometer"}]},"subject":{"reference":"Patient/fff689fc-2b7b-11e9-970c-0785ec79e4fe"},"effectiveDateTime":"2015-08-02T23:49:00.000Z","issued":"2015-08-02T23:49:00.000Z","performer":[{"reference":"Patient/fff689fc-2b7b-11e9-970c-0785ec79e4fe"}],"valueQuantity":{"value":4.6,"unit":"mmol/l","system":"http://unitsofmeasure.org","code":"mmol/L"}}
Eeva Turkka (Feb 08 2019 at 10:06):
Ok, this seems to be a separate issue, we'll investigate it.
Eeva Turkka (Feb 08 2019 at 10:09):
Did you use the unauthorized sandbox in the REST call as well?
Sulka Haro (Feb 08 2019 at 10:13):
Yes, testing the unathorized REST
Sulka Haro (Feb 08 2019 at 10:18):
Feel free to ping me if you need any additional sample data or other details :)
Eeva Turkka (Feb 08 2019 at 10:33):
It is probably something to do with the conditional create header (the If-None-Exist:) of the request, we'll get back to this.
Sulka Haro (Feb 08 2019 at 10:50):
Ah yes, I disabled the conditional create header and the creation now works. Is there a plan to support the header? That'd speed up inserts a lot, compared to querying for existence of each element separately. Also now that the data creation works, the API performance is on the slow side. What's the expected speed at which the production environment works at, compared to the sandbox?
Eeva Turkka (Feb 08 2019 at 11:18):
I actually checked and it should work if you don't poist the Observation? -part in the beginning: https://www.hl7.org/fhir/http.html#ccreate
Eeva Turkka (Feb 08 2019 at 11:20):
The Error code system is at Simplifier: https://simplifier.net/finnishphr/fiphr-cs-errorcodes
Sulka Haro (Feb 08 2019 at 11:32):
Yay now it's going through. Looks like the http://hapi.fhir.org has a more lenient parser for the parameter, as they seem to accept both formats
Sulka Haro (Feb 08 2019 at 11:44):
Oops that was a bit premature. If I drop the Observation? string from the header, the request doesn't error out anymore, but it also doesn't work in terms of deduplicating entries. The behavior I'm expecting is the one at hapi.fhir.org, which reports HTTP 200 for entries that match the query and HTTP 201 on creation. In FIPHR sandbox re-uploading the same record just creates it again, so looks like querying Observations with the application generated Identifier doesn't work as expected?
Eeva Turkka (Feb 08 2019 at 11:58):
With the full format it should work as expected: If-None-Exist: identifier=urn:ietf:rfc:3986|31e656d9-aca1-438d-9f09-3a5fa4109daf
. The syntax without the system is correct as well as to match to the value, but that one doesn't seem to work.
Eeva Turkka (Feb 08 2019 at 12:14):
Just to make sure: you are not talking about posts at around 13:40 creating duplicates to earlier ones? Because those have wonky identifier headers (and our tester reports that the identifier without system should work just fine).
Sulka Haro (Feb 08 2019 at 12:19):
Yup some uploads had wonky headers. :) I can't figure out how to get urns work though so must still be missing something? If I send data to hapi.fhir.org with a valid urn such as "urn:observationref:12345" the system deduplicates the Observations as expected and I can query the objects with the value. However it looks like the fiphr sandbox seems to accept any urn but I can only get uuid urns to work as expected (as in, queries work). Is your solution to leave out the identifier system altogether and just use a regular string id (that obviously needs to be unique)?
Eeva Turkka (Feb 08 2019 at 12:30):
I'm not sure I understand?
The value of the indentifier-query parameter should match the full value of the identifier the resource has. The same value should work for both searches and conditional create, as in GET http://fhirsandbox.kanta.fi/phr-resourceserver/baseStu3/Observation?identifier={value of identifier}&patient=Patient/{pseudonym here}&_pretty=true . I can see two posts and using their identifier, I can only find one resource with the search?
Sulka Haro (Feb 08 2019 at 14:45):
Ok got forward with your pointer :) I suspect what's currently blocking me is the server is decoding the HTTP header differently from the GET query. I verified the latest query string I'm posting to the REST API can be copy-pasted directly to the browser and it returns the previously save entries. However posting this header to the REST API as the If-None-Exist header, the server returns to the old behavior of returnin an error: issue":[{"severity":"error","code":"processing","details":{"coding":[{"system":"http://phr.kanta.fi/fiphr-cs-errorcodes","code":"502420"}],"text":"Only identifier is supported"},"diagnostics":"Only identifier is supported"}]},"status":400"
The last header I sent was patient=Patient/fff689fc-2b7b-11e9-970c-0785ec79e4fe&identifier=urn:ietf:rfc:3986|urn%3Aobservationref%3AU01CR1BhdGllbnQvZmZmNjg5ZmMtMmI3Yi0xMWU5LTk3MGMtMDc4NWVjNzllNGZlOkJheWVyNjMwMC0xQzAwQTAzOjIwMTQtMTItMjRUMTE6MTM6MDA%3D
GETint http://fhirsandbox.kanta.fi/phr-resourceserver/baseStu3/Observation?patient=fff689fc-2b7b-11e9-970c-0785ec79e4fe%27&identifier=urn%3Aietf%3Arfc%3A3986%7Curn%3Aobservationref%3AU01CR1BhdGllbnQvZmZmNjg5ZmMtMmI3Yi0xMWU5LTk3MGMtMDc4NWVjNzllNGZlOkJheWVyNjMwMC0xQzAwQTAzOjIwMTQtMTItMjRUMTE6MTM6MDA%3D&_pretty=true returns multiple Observations
Sulka Haro (Feb 11 2019 at 08:13):
Converted to use stable UUIDs for easier readablity here. :) With UUIDs, the following query strings all find Observations in GET requests:
identifier=urn:ietf:rfc:3986|urn:uuid:b2c7ba51-3579-5bcb-a9a3-9ff0cc017a7e&patient=Patient/fff689fc-2b7b-11e9-970c-0785ec79e4fe
identifier=urn:uuid:b2c7ba51-3579-5bcb-a9a3-9ff0cc017a7e&patient=Patient/fff689fc-2b7b-11e9-970c-0785ec79e4fe
identifier=urn:uuid:b2c7ba51-3579-5bcb-a9a3-9ff0cc017a7e&patient=fff689fc-2b7b-11e9-970c-0785ec79e4fe
However none of these seem to work as a If-None-Exist header in the FIPHR sandbox. When testing against hapi.fhir.org, all these three formats seem to work both in GET requests and as If-None-Exist headers, so wondering what I'm missing...
Eeva Turkka (Feb 12 2019 at 11:54):
Ok, thank you very much for the additional details - we'll look into this and refine the documentation about encodings. The different formats for the search parameters seem valid and equivalent at first glance (system|value or just value and the patient reference in the format of reference or as the unique id). The header itself needs to be: If-None-Exist: identifier=urn:uuid:317a56a9-147a-4809-9ef8-6410f7324bb2 - without the ? in front of the identifier and no patient parameter in there. The patient is required search parameter so that's why it was in my example query.
Sulka Haro (Feb 13 2019 at 10:02):
Yay one step forward: the deduplication works with the UUID query string, but I'm getting an unexpected HTTP response. I've uploaded http://fhirsandbox.kanta.fi/phr-resourceserver/baseStu3/Observation?identifier=urn:uuid:5e0d6dd2-5e46-570b-ac85-044ffc518333&patient=Patient/fff689fc-2b7b-11e9-970c-0785ec79e4fe many times now and querying it with the identifier only returns one result, as expected with If-None-Exist working. However the server responds with HTTP 201 Created each time, where I was expecting HTTP 201 Created on the first actual insert and HTTP 200 OK on the subsequent insert attempts, as per http://hl7.org/fhir/STU3/http.html, which states "The server ignore the post and returns 200 OK" for correct behavior in case there's a single match to on the If-None-Exist query.
Eeva Turkka (Feb 13 2019 at 10:25):
Great to hear that you got the deduplication working. I added a ticket about the wrong response code!
Anna Korpela (Jun 14 2019 at 06:26):
The response code has been fixed to the version that was updated to our customer testing environment this week.
Last updated: Apr 12 2022 at 19:14 UTC