fhir.resources icon indicating copy to clipboard operation
fhir.resources copied to clipboard

Adding support for FHIR R4B

Open apollo13 opened this issue 2 years ago • 7 comments

  • fhir.resources version: 6.4.0
  • Python version: 3.10
  • Operating System: Fedora 36

Description

It would be great if this package supported FHIR Release R4B https://hl7.org/fhir/R4B/version.info .

I guess this would mean moving the current implementation into an R4 subfolder and then generate it against R4B. I tried doing that locally to submit a PR but more or less failed (even when just regenerating the current version I had loads of diffs due to black and what not). Are there any documentations on how to prepare a PR for a new version?

apollo13 avatar Aug 19 '22 18:08 apollo13

Hi, @apollo13 thanks a lot for this issue! I think there will be no sub-folder for R4B as this is not a major release, as like R5, you will see it (R4B) is still under version scheme 4. x.x.

https://hl7.org/fhir/R4B/r4b-explanation.html

But obviously, we will need more discussion, maybe we could await a bit more to see if more updates coming. Also, we need to think fhir.resources version policy for implementing R4B. like should it be 7.x.x or 6.5.x etc.

We will work on it soon.

nazrulworld avatar Aug 20 '22 14:08 nazrulworld

Seems like R4B is pretty stable. My use case is considering 5.0

In any event, happy to help on this effort.
In my local testing, I've gotten to the point where I have some reasonable results (below).

Not quite ready to create a PR. Is the CONTRIBUTING.rst guide up to date? I wasn't sure of the steps necessary to create a new FHIR release. I'm a bit confused how directories are managed i.e. I had to manually move R4 code to a legacy directory, manually deploy examples to script/static, etc.

# test failures after generating resources for R4B
fhir/resources/tests/test_activitydefinition.py - timingTiming null not allowed
fhir/resources/tests/test_implementationguide.py - url missing scheme
fhir/resources/tests/test_library.py -  url missing scheme
fhir/resources/tests/test_plandefinition.py - timingTiming null not allowed, url missing scheme
fhir/resources/tests/test_relatedperson.py -  url missing scheme 
fhir/resources/tests/test_searchparameter.py - __root__ -> base field required, id ensure this value has at most 64 characters
tests/test_utils_xml.py -  Value is expected from the instance of <class 'fhir.resources.fhirprimitiveextension.FHIRPrimitiveExtension'>, but got type <class 'fhir.resources.R4.fhirprimitiveextension.FHIRPrimitiveExtension'> (type=value_error)

The testTiming seem to be related to differences in the test fixtures. http://hl7.org/fhir/R4B/examples-json.zip vs https://github.com/nazrulworld/hl7-archives/raw/0.2.1/FHIR/R4/4.0.1-examples-json.zip

<   "timingTiming": null,
---
>   "timingTiming": {
>     "_event": [
>       {
>         "extension": [
>           {
>             "url": "http://hl7.org/fhir/StructureDefinition/cqf-expression",
>             "valueExpression": {
>               "language": "text/cql",
>               "expression": "Now()"
>             }
>           }
>         ]
>       }
>     ]
>   },

The url missing scheme also seems to be related to differences in the test fixtures:

<       "nameUrl": "http://example.com/patient-example.html",
---
>       "nameUrl": "patient-example.html",
86c86
<           "nameUrl": "http://example.com/list.html",
---
>           "nameUrl": "list.html",
107c107
<         "relativePath": "https://example.com/patient-test.html#patient-test"
---
>         "relativePath": "patient-test.html#patient-test"

bwalsh avatar Dec 11 '22 14:12 bwalsh

@nazrulworld Hi. Checking in to see if there was any interest on collaborating on a R4B and eventually a 5.0.0 version. Thanks very much

bwalsh avatar Dec 14 '22 21:12 bwalsh

++ Very interested in the R4B. The new Medication Definition Module has some resources I'd like to use (specifically ClinicalUseDefinition)

dajaffe avatar Dec 17 '22 19:12 dajaffe

I will look into it if I can manage some good times. Any kind of contribution is always welcome.

nazrulworld avatar Dec 19 '22 18:12 nazrulworld

Hello @nazrulworld, nice to see support for R4B! Have I understood correctly that the v6.5.0 is now fully based on R4B, so if I for time being want to stick with R4 version, then I should not upgrade beyond 6.4.0? Our reasoning is that our counterpart system is still on R4. I think there might be others stuck in the same situation, so a note about this in the readme could be in place

Thanks for the awesome library!

Kalmis avatar Jan 13 '23 11:01 Kalmis

R5 released 🥳 Here is a discussion started on migration to it and how to ensure that library will work for older versions: https://github.com/nazrulworld/fhir.resources/issues/126

wowkin2 avatar Mar 29 '23 15:03 wowkin2