Stream: python
Topic: FHIRPath
Md Nazrul Islam (Sep 30 2019 at 15:59):
FHIRPath implementation in Python
https://pypi.org/project/fhirpath/
Although this is a very early stage, long long way to go (about full implementation), still it is supporting FHIR Search.
your advice, suggestions, contributions are highly encouraged :pray:
Ward Weistra (Sep 30 2019 at 17:11):
Thanks for introducing it here @Md Nazrul Islam !
Md Nazrul Islam (Oct 08 2019 at 12:24):
Another release of Python fhirpath, including bugfixes, improvements and more
https://pypi.org/project/fhirpath/0.3.1/
Md Nazrul Islam (Oct 23 2019 at 18:42):
Good news! https://pypi.org/project/fhirpath/0.4.0/ fhirpath (Python implementation) got the new release which gets many improvements and bug fixes.
nicola (RIO/SS) (Dec 14 2019 at 07:47):
Hi guys, for fhirpath.py tests you can use fhirpath.js test cases - https://github.com/HL7/fhirpath.js/tree/master/test/cases
nicola (RIO/SS) (Dec 14 2019 at 07:48):
and probably some implementation ideas from fhirpath.js
nicola (RIO/SS) (Dec 14 2019 at 07:49):
py and js are so similar ;)
nicola (RIO/SS) (Dec 14 2019 at 07:51):
i was able get all testcases work for clojure in a couple of days
René Spronk (Feb 12 2020 at 09:32):
Has someone already tackled the execution of FHIRPath expressions on Python Dictionaries ?
Eric Haas (Feb 12 2020 at 17:01):
see https://chat.fhir.org/#narrow/stream/179218-python/topic/FHIRPath/near/178883365
Eric Haas (Feb 12 2020 at 17:03):
Looking for someone to tackle the FHIR mapping language in python as well.
René Spronk (Feb 13 2020 at 04:04):
Thanks (should have browsed upwards in the chat to see the prior announcement).
René Spronk (Feb 13 2020 at 12:39):
.. for my simple Dict use cases (Dicts with 1 single resource), I decided to go with https://github.com/fabiocaccamo/python-benedict
Eric Haas (Feb 13 2020 at 19:36):
@René Spronk I would be interested in a demo
René Spronk (Feb 14 2020 at 02:47):
I decided to write something myself, what is mostly needed is something like myRef =getFromDict ( a.b.c.reference where a.b.c.use='xyz') where a.b.c. is an array. Or a count(a.b.c).
(I'm aware fhir-py covers all of this, and I would have used their work if this weren't a project to help me learn switch from Tcl to Python. Besides, their work is heavily object oriented which isn't always my preferred way of doing things.)
As a trainer (my [professional] programming days are long behind me) all I write is simulators for use in training courses. No need for fancy stuff, extensive error handling nor GUIs. Python, like Tcl, is well suited for that purpose.
Ilya Beda (Feb 18 2020 at 03:21):
Hi @René Spronk
https://github.com/beda-software/fhir-py is dictionary-based and we implemented a subset of FHIRPath on top of python dictionaries as python-based DSL https://github.com/beda-software/fhir-py#get_by_pathpath-defaultnone
René Spronk (Feb 18 2020 at 07:53):
Hi Ilya, I've seen that - but I'm in the process of learning Python, so using an existing library for FHIR would be an easy way out. For now I'm dabbling along with my own stuff, which is far from production-grade. At some point in time I'll switch to fhir-py, which is currently IMHO the best library for FHIR in Python. But that point in time hasn't arrived today..
Eric Haas (Feb 18 2020 at 18:12):
@Ilya Beda have you look at the FHIR Mapping language?
nicola (RIO/SS) (Feb 18 2020 at 20:30):
If someone is ready - i can help port fhirpath.js to python
nicola (RIO/SS) (Feb 18 2020 at 20:33):
we did similar port to clojure in couple of days
Ilya Beda (Feb 19 2020 at 12:04):
I got a lack of python implementation fro FHIRPath on Connectathon. I think I am ready to implement FHIRPath for python ;)
Ilya Beda (Feb 19 2020 at 12:07):
@Eric Haas
Yes, but we are using JUTE for mapping purposes.
https://github.com/HealthSamurai/jute.clj
Ilya Beda (Feb 19 2020 at 12:27):
I and @nicola (RIO/SS) are going to implement fhirpath for python.
Ilya Beda (May 14 2020 at 07:05):
Hello.
Here is an update of FHIRPath python implementation https://github.com/beda-software/fhirpath-py
The project is still under development. The date and time functions are not implemented yet.
There is no pypi release yet. However, you can install package from GitHub directly.
pip install -e git+https://github.com/beda-software/fhirpath-py#egg=fhirpath-py
The set of supported features you can find at the test suite https://github.com/beda-software/fhirpath-py/tree/master/tests/cases
Example of usage is here https://github.com/beda-software/fhirpath-py/blob/master/tests/test_real.py
Early feedback is appreciated.
Tim Harsch (Aug 02 2020 at 00:39):
Ilya Beda said:
Hello.
Here is an update of FHIRPath python implementation https://github.com/beda-software/fhirpath-pyThe project is still under development. The date and time functions are not implemented yet.
There is no pypi release yet. However, you can install package from GitHub directly.pip install -e git+https://github.com/beda-software/fhirpath-py#egg=fhirpath-py
The set of supported features you can find at the test suite https://github.com/beda-software/fhirpath-py/tree/master/tests/cases
Example of usage is here https://github.com/beda-software/fhirpath-py/blob/master/tests/test_real.pyEarly feedback is appreciated.
I am a little lost when it comes to fhirpath in python. I spent so much time looking at https://github.com/nazrulworld/fhirpath hoping to find the simple example of executing fhirpath on a JSON string or python dictionary. I finally came here and found this post. It seems your module does support fhirpath search on python dictionaries. Is it the frontrunner for evaluating fhirpath in python? It would be helpful if nazrulworld could link to your repo for those looking for simple search on dictionaries. I looked for a module on the confluence page https://confluence.hl7.org/display/FHIR/Open+Source+Implementations but it doesn't list the beda-software version or the nazrulworld version.
Ilya Beda (Aug 02 2020 at 16:44):
Hi @Tim Harsch
https://github.com/beda-software/fhirpath-py is a python implementation of fhirpath.
It uses the same approach that used in https://github.com/HL7/fhirpath.js/
You can use fhirpathpy.evaluate
function to execute fhirpath expression on the python dictionary.
I am using fhirpathpy in production. However, it is still under active development. Once the first release will be out I'll add reference to confluence page.
Ilya Beda (Aug 02 2020 at 16:48):
Hi @Md Nazrul Islam
https://github.com/nazrulworld/fhirpath is seemed to be a DSL on top of elasticsearch. It doesn't parse fhirpath expression from string. The only option is to write fhirpath expression in python DSL.
Is it correct or I am missing something?
Md Nazrul Islam (Aug 02 2020 at 17:37):
Ilya Beda said:
Hi Md Nazrul Islam
https://github.com/nazrulworld/fhirpath is seemed to be a DSL on top of elasticsearch. It doesn't parse fhirpath expression from string. The only option is to write fhirpath expression in python DSL.
Is it correct or I am missing something?
You are almost correct! Here the purpose of this package is not only support fhirpath expression but also support FHIR search and universal FHIR query (sql like, defines in fhirpath) to Get resources from server And that is not only bound to elasticsearch, could be PostgreSQL, MongoDB.
fhirpath expressions parsing feature yet to do (can’t manage time) because I had usecase for fhirsearch so have To focus on that.
This package is not dependent on any search engine like elasticsearch instead providing framework to support to create any engine.
Tim Harsch (Aug 02 2020 at 17:57):
Thanks for the responses. @Ilya Beda I would like to use your module now in production, if it is at least minimally working, as we won't have any critical path for it as yet. However, I would like to have it wired to my project the way I envision it should be (essentially I want to create a way to do fhirpath queries in an endpoint). Just getting fhirpath in to my work is enough for now, that way we can continue to benefit as it evolves.
I really had such difficulty finding the two modules and understanding their intent/scope, distinguishing them from each other. If there is anything that can be done in the respective READMEs or linking them to the confluence page I really think it could help future travelers.
Thanks to you both for helping clarify all this. :smiley:
Md Nazrul Islam (Aug 03 2020 at 03:42):
Tim Harsch said:
Ilya Beda said:
Hello.
Here is an update of FHIRPath python implementation https://github.com/beda-software/fhirpath-pyThe project is still under development. The date and time functions are not implemented yet.
There is no pypi release yet. However, you can install package from GitHub directly.pip install -e git+https://github.com/beda-software/fhirpath-py#egg=fhirpath-py
The set of supported features you can find at the test suite https://github.com/beda-software/fhirpath-py/tree/master/tests/cases
Example of usage is here https://github.com/beda-software/fhirpath-py/blob/master/tests/test_real.pyEarly feedback is appreciated.
I am a little lost when it comes to fhirpath in python. I spent so much time looking at https://github.com/nazrulworld/fhirpath hoping to find the simple example of executing fhirpath on a JSON string or python dictionary. I finally came here and found this post. It seems your module does support fhirpath search on python dictionaries. Is it the frontrunner for evaluating fhirpath in python? It would be helpful if nazrulworld could link to your repo for those looking for simple search on dictionaries. I looked for a module on the confluence page https://confluence.hl7.org/display/FHIR/Open+Source+Implementations but it doesn't list the beda-software version or the nazrulworld version.
You are fully right, search in python dict is not implement Yet instead search in fhir server, but I think it will be supporting soon :) as I am in vacation.
Thank for spending time on it.
Last updated: Apr 12 2022 at 19:14 UTC