fhirbase-plv8
fhirbase-plv8 copied to clipboard
For the complex chained syntax resouce type constrain is ignored and wrong resource type is returned
SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Organization","id":"f001","identifier":[{"use":"official","system":"systm1","value":"91654"},{"use":"usual","system":"systm1","value":"17-0112278"}],"type":{"coding":[{"system":"systm1","code":"V6","display":"University Medical Hospital"},{"system":"http://hl7.org/fhir/organization-type","code":"prov","display":"Healthcare Provider"}]},"name":"Burgers University Medical Center","telecom":[{"system":"phone","value":"022-655 2300","use":"work"}],"address":[{"use":"work","line":["Galapagosweg 91"],"city":"Den Burg","postalCode":"9105 PZ","country":"NLD"},{"use":"work","line":["PO Box 2311"],"city":"Den Burg","postalCode":"9100 AA","country":"NLD"}],"contact":[{"purpose":{"coding":[{"system":"http://hl7.org/fhir/contactentity-type","code":"PRESS"}]},"telecom":[{"system":"phone","value":"022-655 2334"}]},{"purpose":{"coding":[{"system":"http://hl7.org/fhir/contactentity-type","code":"PATINF"}]},"telecom":[{"system":"phone","value":"022-655 2335"}]}]}}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Practitioner","id":"f001","identifier":[{"use":"official","system":"urn:oid:2.16.528.1.1007.3.1","value":"938273695"},{"use":"usual","system":"urn:oid:2.16.840.1.113883.2.4.6.3","value":"129IDH4OP733"}],"name":{"use":"official","family":["van den broek"],"given":["Eric"],"suffix":["MD"]},"telecom":[{"system":"phone","value":"0205568263","use":"work"},{"system":"email","value":"[email protected]","use":"work"},{"system":"fax","value":"0205664440","use":"work"}],"address":[{"use":"work","line":["Galapagosweg 91"],"city":"Den Burg","postalCode":"9105 PZ","country":"NLD"}],"gender":"male","birthDate":"1975-12-07","practitionerRole":[{"managingOrganization":{"reference":"Organization/f001","display":"BMC"},"role":{"coding":[{"system":"urn:oid:2.16.840.1.113883.2.4.15.111","code":"01.000","display":"Arts"}],"text":"Care role"},"specialty":[{"coding":[{"system":"urn:oid:2.16.840.1.113883.2.4.15.111","code":"01.018","display":"Ear-, Nose and Throat"}],"text":"specialization"}]}]}}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"id": "RitaGunn", "name":[{"use":"official","given":["Rita"],"family":["Gunn"]}],"active":true,"careProvider":[{"reference":"Organization/f001","display":"Burgers-Organization1"},{"reference":"Practitioner/f001","display":"DocEric-Practitioner1"}],"resourceType":"Patient"}}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"JamesDean","name":[{"use":"official","given":["James"],"family":["Dean"]}],"active":true,"careProvider":[{"reference":"Organization/f001","display":"Burgers-Organization1"}],"resourceType":"Patient"}}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"JohnDoe","name":[{"use":"official","given":["John"],"family":["Doe"]}],"active":true,"careProvider":[{"reference":"Organization/f002","display":"Burgers-Organization2"}],"resourceType":"Patient"}}');
SELECT fhir_search('{"resourceType": "Patient", "queryString": "careprovider.identifier=91654"}'); -- not especially useful but not supported
SELECT fhir_search('{"resourceType": "Patient", "queryString": "careprovider:Practitioner.given=nonexisting"}'); --ok, no results
SELECT fhir_search('{"resourceType": "Patient", "queryString": "careprovider:Practitioner.given=Eric"}'); -- nok, got practitioner instead of the patient
SELECT fhir_search('{"resourceType": "Patient", "queryString": "careprovider:Organization.identifier=91654"}'); -- nok, got the same organization twice instead of two different patients
SELECT fhir_search('{"resourceType": "Patient", "queryString": "careprovider:Organization.identifier=nonexisting"}'); --ok, no res.
SELECT fhir_search('{"resourceType": "Patient", "queryString": "careprovider:Organization.name=Burg"}'); -- nok, got 2 same organizations, expected RitaGunn and JamesDean patients
SELECT fhir_search('{"resourceType": "Patient", "queryString": "careprovider:Practitioner.name=Burg"}'); -- nok, got 2 same practitioners, expected RitaGunn patient
What's the status on this issue ?