SparkAutoMapper

SparkAutoMapper

PyPi: https://pypi.org/project/sparkautomapper/
Source Code: https://github.com/icanbwell/SparkAutoMapper
Documentation: https://icanbwell.github.io/SparkAutoMapper/

This package makes it easy to map flat data (csv, tsv, pipe-delimited, fixed length) into JSON formats like FHIR. It provides a small subset of Python language that can be used to define the mappings. Since Python is a proper language and has a large universe of libraries this simplifies doing complex mappings.

from spark_auto_mapper.automappers.automapper import AutoMapper
from spark_auto_mapper.helpers.automapper_helpers import AutoMapperHelpers as A
mapper = AutoMapper(
    view="members",
    source_view="patients",
    keys=["member_id"]
).columns(
    dst2=A.list(
        [
            A.complex(
                use="usual",
                family="imran"
            ),
            A.complex(
                use="usual",
                family="[last_name]"
            )
        ]
    )
)