Python API to Pathling
Project description
Python API for Pathling
This is the Python API for Pathling. It currently supports encoding of FHIR JSON bundles and NDJSON into Apache Spark dataframes.
Installation
Prerequisites:
- Python 3.8+ with pip
- PySpark 3.1+
To install, run this command:
pip install pathling
Usage
The code below shows an example of using the Pathling API to encode Patient resources from FHIR JSON bundles:
from pyspark.sql import SparkSession
from pathling import PathlingContext
from pathling.etc import find_jar
spark = SparkSession.builder \
.appName('pathling-test') \
.master('local[*]') \
.config('spark.jars', find_jar()) \
.getOrCreate()
ptl = PathlingContext.create(spark)
json_bundles = spark.read.text('examples/data/bundles/', wholetext=True)
patients_df = ptl.encodeBundle(json_bundles, 'Patient')
patients_df.show()
More usage examples can be found in the examples
directory.
Development setup
Create an isolated python environment with Miniconda, e.g:
conda create -n pathling-dev python=3.8
conda activate pathling-dev
Prerequisites:
- maven (Ubuntu 20.04:
apt install maven
) - java (Ubuntu 20.04:
apt install default-jdk
) - make (Ubuntu 20.04:
apt install make
)
To run the tests and install the package, run this command from the project root:
mvn install -pl lib/python -am
Pathling is copyright © 2018-2022, Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230. Licensed under the CSIRO Open Source Software Licence Agreement.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pathling-5.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d43d63b07ef9fccae73696a20f9fd0b769d37056f988316234fd1eb5a707093 |
|
MD5 | 108bd53e80d3d03dd154a1eeaa24da28 |
|
BLAKE2b-256 | 69e5d91bc88246bb8cfc0009fd97e0a8a9adffa5494477c01fc3a3ba41a51c8c |