Metadata-Version: 2.1
Name: cumulus-fhir-support
Version: 1.2.1
Summary: FHIR schema support code for the Cumulus project
Author-email: Michael Terry <michael.terry@childrens.harvard.edu>
Requires-Python: >= 3.9
Description-Content-Type: text/markdown
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: fhirclient >= 4.1
Requires-Dist: pyarrow >= 12
Requires-Dist: black >= 24, < 25 ; extra == "dev"
Requires-Dist: pre-commit ; extra == "dev"
Requires-Dist: ddt ; extra == "tests"
Requires-Dist: pytest ; extra == "tests"
Requires-Dist: pytest-cov ; extra == "tests"
Project-URL: Homepage, https://github.com/smart-on-fhir/cumulus-fhir-support
Provides-Extra: dev
Provides-Extra: tests

# Cumulus FHIR Support

This library holds FHIR support code for the Cumulus project as a whole.

## Installing

```shell
pip install cumulus-fhir-support
```

## Examples

### pyarrow_schema_from_rows

```python3
import cumulus_fhir_support

rows = [
    {
        "resourceType": "Patient",
        "id": "1",
        "extension": [{
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
            "extension": [{
                "url": "ombCategory",
                "valueCoding": {
                    "code": "2135-2",
                    "display": "Hispanic or Latino",
                    "system": "urn:oid:2.16.840.1.113883.6.238",
                }
            }],
        }]
    },
]

# The resulting schema will be both wide (every toplevel column)
# and deep enough for every field in `rows`.
# That is, both the non-present toplevel field "telecom" and the deeper
# field "extension.extension.valueCoding.system" will be in the schema.
schema = cumulus_fhir_support.pyarrow_schema_from_rows("Patient", rows)
```

