Open ZuSe opened 2 years ago
Steps to reproduce:
Get latest jpa-starter (https://github.com/hapifhir/hapi-fhir-jpaserver-starter)
Configure it to use a postgresql database, R5 version and leave the rest on default
Set ID mode to support UUIDs/Alphanumeric. put this in JpaRestfulServer:
this.daoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY);
this.daoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID);
this.daoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE);
Create a new observation resource e.g. { "resourceType": "Observation", "identifier": [ { "use": "secondary", "system": "https://dcmgsmh3hc.hub.doc-cirrus.com/meddata/", "value": "6141dd3fd1c1c1098bb3b2c7" }, { "use": "usual", "value": "iatros-fhir-connector" } ], "status": "registered", "category": [ { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "vital-signs" } ] } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "41950-7" } ] }, "subject": { "reference": "Patient/82cd5a7a-002c-11ec-939e-b516e27a5512" }, "effectiveDateTime": "2021-09-13T22:00:00.000Z", "performer": [ { "reference": "Practitioner/2ce4a60e-713b-4bb9-a61c-d27b08180914" } ], "valueQuantity": { "value": 5309, "unit": "count", "system": "http://unitsofmeasure.org", "code": "[count]" } }
Kill the server
Try to filter it: http://localhost:8080/fhir/Observation?subject=Patient/82cd5a7a-002c-11ec-939e-b516e27a5512
Returns 0
I tested it with R4 context and jetty. Same behavior. Running out of ideas what might cause it. Appreciate any help @jamesagnew @jkiddo @tadgh
Heya, I cannot replicate this on current master. Just did the following:
If you can write a failling unit test showing the replication, happy to look at it.
Hi @tadgh
thanks for investigating. Unfortunately I forgot to add sth. to my steps. I just double checked the issue on a Mac of a colleague. You need to add this to settings:
enforce_referential_integrity_on_delete: false enforce_referential_integrity_on_write: false
so basically create the Observation I posted WITHOUT the patient entry existing on the system. I guess you just followed my flow but by instinct created the patient beforehand, right?
Observations with existing Patient or Prac. references do work, that's what I can confirm. However, filtering for non existent one worked before as well and is crucial if the objects aren't managed within FHIR.
After upgrading to 5.7.0 (latest jpa), the Observation resources can not be filtered by the subject param.
e.g. https://fhir.myserver.com/fhir/Observation?subject=Patient/82cd5a7a-002c-11ec-939e-b516e27a5512
returns 0 entries (even though the patient has some)
same goes for: https://fhir.myserver.com/fhir/Observation?patient=82cd5a7a-002c-11ec-939e-b516e27a5512
FHIR Version: R5 HAPI: 5.7.0 OS: Kubernetes (JPA Starter)