Skip to content

Commit 69b7506

Browse files
committed
🎉 FHIR release R5 support has been added, as a result all resources are created under root package.
* fixes tests, fixes lintings * updated documents.
1 parent 4b5c336 commit 69b7506

File tree

380 files changed

+231682
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

380 files changed

+231682
-11
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ script:
6464
- pytest fhir/resources/DSTU2/tests
6565
- pytest fhir/resources/STU3/tests
6666
- pytest -s --cov=fhir/resources/R4B/tests -s --tb=native -v --cov-report term-missing --cov-append fhir/resources/R4B/tests
67+
- pytest -s --cov=fhir/resources/tests -s --tb=native -v --cov-report term-missing --cov-append fhir/resources/tests
6768
after_success:
6869
- codecov

HISTORY.rst

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
History
33
=======
44

5-
6.5.1 (unreleased)
5+
7.0.0 (unreleased)
66
------------------
77

8-
- Nothing changed yet.
8+
New Feature
9+
10+
- `FHIR version R5 <https://www.hl7.org/fhir/R5/resourcelist.html>`_ support has been added under root package.
11+
12+
13+
Breaking
14+
15+
- All root resources (FHIR version R4B) are moved under sub-package ``R4B``
916

1017

1118
6.5.0 (2023-01-01)

README.rst

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
==================================
2-
FHIR® Resources (R4B, STU3, DSTU2)
3-
==================================
1+
======================================
2+
FHIR® Resources (R5, R4B, STU3, DSTU2)
3+
======================================
44

55
.. image:: https://img.shields.io/pypi/v/fhir.resources.svg
66
:target: https://pypi.python.org/pypi/fhir.resources
@@ -54,12 +54,13 @@ and allows you to create and manipulate FHIR resources in Python. You can then u
5454
FHIR® Version Info
5555
------------------
5656

57-
FHIR® (Release R4B, version 4.3.0) is available as default. Also previous versions are available as Python sub-package
58-
(each release name string becomes sub-package name, i.e ``STU3`` ).
59-
From ``fhir.resources`` version 6.5.0; FHIR R4 is overlapped by R4B.
57+
FHIR® (Release R5, version 5.0.0) is available as default. Also previous versions are available as Python sub-package
58+
(each release name string becomes sub-package name, i.e ``R4B`` ).
59+
From ``fhir.resources`` version 7.0.0; there no FHIR ``R4`` instead of ``R4B`` is available as sub-package.
6060

6161
**Available Previous Versions**:
6262

63+
* ``R4B`` (4.3.0)
6364
* ``STU3`` (3.0.2)
6465
* ``DSTU2`` (1.0.2) [see `issue#13 <https://github.com/nazrulworld/fhir.resources/issues/13>`_][don't have full tests coverage]
6566

fhir/resources/__init__.py

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
# -*- coding: utf-8 -*-
2+
from pathlib import Path
3+
from typing import Any, Dict, Union
24

3-
__fhir_version__ = "4.3.0"
4-
__version__ = "6.5.0"
5+
from fhir.resources.core.fhirabstractmodel import FHIRAbstractModel
6+
7+
from .fhirtypesvalidators import get_fhir_model_class
8+
9+
__version__ = "7.0.0"
10+
__fhir_version__ = "5.0.0"
11+
12+
13+
def construct_fhir_element(
14+
element_type: str, data: Union[Dict[str, Any], str, bytes, Path]
15+
) -> FHIRAbstractModel:
16+
try:
17+
klass = get_fhir_model_class(element_type)
18+
except KeyError:
19+
raise LookupError(
20+
f"'{element_type}' is not valid FHIRModel (element type) name!"
21+
)
22+
if isinstance(data, (str, bytes)):
23+
return klass.parse_raw(data, content_type="application/json")
24+
elif isinstance(data, Path):
25+
return klass.parse_file(data)
26+
return klass.parse_obj(data)
27+
28+
29+
__all__ = ["get_fhir_model_class", "construct_fhir_element"]

0 commit comments

Comments
 (0)