ehrbase / fhir-bridge

FHIR Bridge acts as a broker between an HL7 FHIR client and an openEHR server.
32 stars 18 forks source link

Returned FHIR Bundle contains "0" search results #521

Open CzarMich opened 2 years ago

CzarMich commented 2 years ago

On connecting fhir-bridge to Better platform,

I tried a generic search for condition, expecting anything "WHERE c/name/value='Diagnose'" using the call below; "http://localhost:8888/fhir-bridge/fhir/Condition?"

However, the server responds with an empty Searchset Bundle.

{ "resourceType": "Bundle", "id": "f3b42a1b-6950-4cc8-8b36-d6265bbec2dc", "meta": { "lastUpdated": "2021-10-21T19:32:27.692+02:00" }, "type": "searchset", "total": 0, "link": [ { "relation": "self", "url": "http://localhost:8888/fhir-bridge/fhir/Condition" } ] }

Could it be that despite having established connection to better platform, fhir-bridge does not see the compositions created in the repository.

#2ndly, Else it would also be nice to have special calls for views created in the repository. e.g such a view below creates a proper and well formatted result which can easily mapped onto the Condition FHIR Profile.

SELECT c/uid/value AS Composition_ID, e/ehr_id/value AS EHRID, e/ehr_status/subject/external_ref/id/value AS SubjectID, e/ehr_status/subject/external_ref/namespace AS subjectNamespace, c/composer/name AS Composer, c/composer/external_ref/namespace AS composerNamespace, c/composer/external_ref/id/value AS composerId, c/name/value AS ResourceName, c/archetype_details/template_id/value AS TemplateID, c/context/start_time/value AS compositionStartTime, y/items[at0063]/value/value AS Category, s/data[at0001]/items[at0003,'Feststellungsdatum']/value/value AS RecordingDate, s/data[at0001]/items[at0002,'Kodierte Diagnose']/value/value AS DiagnoseDisplay, s/data[at0001]/items[at0002,'Kodierte Diagnose']/value/defining_code/code_string AS Code, s/data[at0001]/items[at0002,'Kodierte Diagnose']/value/defining_code/terminology_id/value AS CodyingSystem, l/items[at0002,'Diagnosetyp']/value/value AS DiagnoseType, s/data[at0001]/items[at0002,'Kodierte Diagnose']/value/hyperlink/value AS CodeURL FROM EHR e CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1] CONTAINS (EVALUATION s[openEHR-EHR-EVALUATION.problem_diagnosis.v1] CONTAINS (CLUSTER l[openEHR-EHR-CLUSTER.entry_category.v0]) and CLUSTER y[openEHR-EHR-CLUSTER.problem_qualifier.v1]) WHERE c/name/value='Diagnose' OFFSET 0 LIMIT 10

SevKohler commented 2 years ago

The bridge cannot search resources that where created within the openEHR platform. It can only search everything that was mapped using the bridge itself, since we just hold these resources within the bridge (the bridge runs a HAPI Server). Did you POST a Condition before ?

CzarMich commented 2 years ago

So to make things straight, the bridge cannot search resources that where created within the openEHR platform. It can only search everything that was mapped using the bridge itself, since we just hold these resources within the bridge (the bridge runs a HAPI Server). Did you POST a Condition before ?

Definitely some illustrative help needed at this stage. :) And I have not POST'ed anything yet with FHIR-Bridge or done any mapping yet. Any resource available on how mapping is performed via FHIR-Bridge? since we could all be having different mapping procedures or fields but all leading to one same goal. :

@birgerhaarbrandt had just edited asking for a resource :)

birgerhaarbrandt commented 2 years ago

There is actually a new part that maps from a FHIR Search to an AQL an then on a result set. This is currently only for the "Kerndatensatz" and it only accepts count queries.

It would actually be great if you can check this out as I have not been able to review this, yet: https://github.com/ehrbase/fhir-bridge/pull/475

You can approach @ppazos for any questions regarding this.

SevKohler commented 2 years ago

@CzarMich if you need any help with the PR etc. let me know.

CzarMich commented 2 years ago

@CzarMich if you need any help with the PR etc. let me know.

Yes, @SevKohler help is definitely needed. just sent you an 📧 .

ppazos commented 2 years ago

@CzarMich @SevKohler on https://github.com/ehrbase/fhir-bridge/pull/475 there is the functionality to search using AQL, mainly to count, some resources, but was focused on counting patients that have some associated resources.

In the Insomnia file included in the PR, there are some tests cases for that implementation.

EmielStoelinga commented 7 months ago

Hi all,

The same problem seems to occur in my environment. The documentation states fhir-bridge "provides functions to get data back out from an openEHR data repository (GET and FHIR Search)". However, it seems this has not been implemented yet.

Is it still the case fhir-bridge can only search everything that was mapped using the bridge itself? If not, how would I query resources from openEHR through fhir-bridge?

Thanks in advance!

ppazos commented 7 months ago

@EmielStoelinga in FHIR bridge you need to code the mappings between your FHIR resources and the corresponding openEHR templates, both for storing and for querying. Some of these where implemented for specific profiles and templates, but for your specific resources, you need to add the code for that, it's not automatic.

EmielStoelinga commented 7 months ago

@ppazos thanks for your reply. I have been able to write such a mapping from FHIR to openEHR and this has also worked vice versa. However, with these mappings I could only find resources that have been created through fhir-bridge. The resources that have been created through the use of my EHR (EHRBase) API are not being returned. Also, after having "rebooted" fhir-bridge, it is unable to find the resources that it created previously since the database is reset.

It therefore seems that fhir-bridge can only return resources that have been created through the use of the fhir-bridge API and that still exists in its own database.

Is it possible to also return resources that have been created in the EHR? If so, how would I do this?

Again, thanks for the help!

ppazos commented 7 months ago

@EmielStoelinga IIRC The bridge has its own FHIR storage, so all resources are really stored twice, in the bridge and in the openEHR CDR. I think you might be reading from the local storage only, not from the CDR. It's been a while since I worked on this, current developers could tell you more.

EmielStoelinga commented 7 months ago

@ppazos that indeed seems to be the case. Thanks anyhow!

Would you happen to know any current developers that I could mention in this issue?

ppazos commented 7 months ago

@EmielStoelinga just check the latest commits and the list of contributors.

Best of luck!