Skip to main content

Clinical Description Annotator

Python3.9+ PyPI - Version

Annotator for annotating measurement results, workflows, workflow tools, models, and workflow tool process datasets in SPARC SDS datasets to the data format required for digitaltwins-on-fhir.

Usage

Annotate the measurements data for SPARC SDS dataset

  • Add measurement for one patient
from fhir_cda import Annotator
from fhir_cda.ehr import ObservationMeasurement, ObservationValue, Quantity

annotator = Annotator("./dataset/dataset-sparc").measurements()

m = ObservationMeasurement(
    value=ObservationValue(
        value_quantity=Quantity(
            value=30,
            unit="year",
            code="a")),
    code="30525-0")

annotator.add_measurements("sub-001", m).save()
  • Add measurements for one patient
m1 = ObservationMeasurement(
    value=ObservationValue(
        value_quantity=Quantity(
            value=0.15,
            unit="cm",
            code="cm")),
    code="21889-1")
m2 = ObservationMeasurement(
    value=ObservationValue(
        value_quantity=Quantity(
            value=0.15,
            unit="cm",
            code="cm",
            system="http://unitsofmeasure.org")),
    code="21889-1",
    code_system="http://loinc.org",
    display="Size Tumor")
annotator.add_measurements("sub-001", [m1, m2]).save()
  • Add measurement for multiple patients
m = ObservationMeasurement(
    value=ObservationValue(value_string="Female"),
    code="99502-7",
    display="Recorded sex or gender",
    code_system="http://loinc.org")
annotator.add_measurements(["sub-001", "sub-002"], m).save()
  • A measurements for multiple patients
m1 = ObservationMeasurement(
    value=ObservationValue(value_string="Female"),
    code="99502-7",
    display="Recorded sex or gender",
    code_system="http://loinc.org")
m2 = ObservationMeasurement(
    value=ObservationValue(
        value_quantity=Quantity(
            value=0.15,
            unit="cm",
            code="cm",
            system="http://unitsofmeasure.org")),
    code="21889-1",
    code_system="http://loinc.org",
    display="Size Tumor")
annotator.add_measurements(["sub-001", "sub-002"], [m1, m2])
annotator.save()
  • Add DocumentReference measurements
from fhir_cda.ehr import DocumentReferenceMeasurement
m2 = DocumentReferenceMeasurement(
    url="https://example.org/files/df0c4efd-69a6-428a-ba70-786caecfadfb.obj",
    content_type="model/obj",
    title="Breast Surface Mesh")
annotator.add_measurements(["sub-001"], [m2]).save()
  • Automated generating ImagingStudy Measurement for all patients by scan dataset
annotator.automated_generating_imaging_study_measurement_by_scan_dataset()
  • Add ImagingStudy measurements manually
    • Note: If we add it manually, we'll need to add the ImagingStudy measurement for each patient one by one. Alternatively, we can use a loop to automate the process.
from fhir_cda.ehr import ImagingStudyMeasurement
from fhir_cda.utils import check_first_file_extension
from pathlib import Path

p1 = Path("./dataset/dataset-sparc/primary/sub-001")
p1_sams = [x for x in p1.iterdir() if x.is_dir()]
p1_dcm_sams = [sam for sam in p1_sams if check_first_file_extension(sam) == "dcm"]
m4 = ImagingStudyMeasurement(uuid="",
                             sample_paths=p1_dcm_sams,
                             endpoint_url="",
                             description="dcm")
annotator.add_measurements(["sub-001"], [m4])
  • Notice: The default value for unit system and code system are:
unit_system = "http://unitsofmeasure.org"
code_system = "http://loinc.org"

Design Decisions

  • ImagingStudy Instances are not include at this stage, because but can be added it if required.

Contributors

Linkun Gao

Chinchien Lin

Ayah Elsayed

Jiali Xu

Gregory Sands

David Nickerson

Thiranja Prasad Babarenda Gamage

Publications

  1. Paper Title One, Author1, Author2. Journal Name, Year.
  2. Paper Title Two, Author1, Author2. Conference Name, Year.

Please cite the corresponding paper if you use this project in your research.

Metadata

Release files for fhir-cda 1.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fhir-cda 1.2.5
File Size Uploaded Provenance Actions
fhir_cda-1.2.5.tar.gz 21.7 kB Without provenance Details for fhir_cda-1.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fhir-cda 1.2.5
File Interpreter ABI Platform Actions
fhir_cda-1.2.5-py3-none-any.whl Python 3 none any Details for fhir_cda-1.2.5-py3-none-any.whl

Total release size: 47.3 kB

Release files / fhir_cda-1.2.5.tar.gz

Download URL fhir_cda-1.2.5.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b7b0ef03966f629147649e3d40998f53a216d2ba6eefe9cc44d643f12c040cbf
BLAKE2b-256 checksum
How to use checksums
7f76701d2498511188e64908f195ad01dae38e6e326a5a80a9aa7bf140fae788
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / fhir_cda-1.2.5-py3-none-any.whl

Download URL fhir_cda-1.2.5-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
127d3d547ead0e22e4899ce40f33741947176e64e50468100b5e59adb8ba1f8c
BLAKE2b-256 checksum
How to use checksums
a25a617a1fefbbb67e4d1a217791abc151e205abee486c7c693b2c731c3b276d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for fhir-cda 1.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page