Skip to main content

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.r4 import bundles
from pathling.etc import find_jar

spark = SparkSession.builder \
    .appName('pathling-test') \
    .master('local[*]') \
    .config('spark.jars', find_jar()) \
    .getOrCreate()
        
json_bundles = bundles.load_from_directory(spark, 'examples/data/bundles/')
patients = bundles.extract_entry(spark, json_bundles, 'Patient')
patients.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

pathling-5.0.2.dev2.tar.gz (19.6 MB view details)

Uploaded Source

Built Distribution

pathling-5.0.2.dev2-py2.py3-none-any.whl (19.6 MB view details)

Uploaded Python 2Python 3

File details

Details for the file pathling-5.0.2.dev2.tar.gz.

File metadata

  • Download URL: pathling-5.0.2.dev2.tar.gz
  • Upload date:
  • Size: 19.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for pathling-5.0.2.dev2.tar.gz
Algorithm Hash digest
SHA256 e8fa780c1423ed24b1de135c0acea8d800a10be873d5f1546bfa10470a80714a
MD5 bc2cc8a51a181c0f39bb9d9def7162a9
BLAKE2b-256 ee68afb31d8843ff9295315f3c07d995b6c918e89934e08c287f919dad76ef58

See more details on using hashes here.

File details

Details for the file pathling-5.0.2.dev2-py2.py3-none-any.whl.

File metadata

  • Download URL: pathling-5.0.2.dev2-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.6 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for pathling-5.0.2.dev2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ebec20cecc83c4c9c93edf68b6a4fa29b1544608fc26e8cb15a4c16d1d315470
MD5 1b475b3e6d442b57e2963d6375c08cb2
BLAKE2b-256 e3c71cf1da2c5c99617e7ea2a796e89a143860201dfb6690d199abd462d65ac1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page