pathling 9.2.0.dev1__tar.gz → 9.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pathling-9.2.0.dev1 → pathling-9.3.0}/LICENSE +11 -8
- {pathling-9.2.0.dev1 → pathling-9.3.0}/PKG-INFO +1 -1
- pathling-9.3.0/examples/fhir_search.py +30 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/_version.py +2 -2
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/context.py +70 -1
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pyproject.toml +2 -2
- {pathling-9.2.0.dev1 → pathling-9.3.0}/.gitignore +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/README.md +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/bulk.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/data/bundles/Bennett146_Swaniawski813_704c9750-f6e6-473b-ee83-fbd48e07fe3f.json +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/data/bundles/Dino214_Parisian75_40d82b80-b682-cd8b-da6d-396809878641.json +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/data/csv/conditions.csv +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/data/resources/Condition.ndjson +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/data/resources/Patient.ndjson +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/designation.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/display.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/encode_bundles.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/encode_resources.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/fhir_view.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/member_of.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/property_of.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/subsumes.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/examples/translate.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/__init__.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/bulk.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/coding.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/core.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/datasink.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/datasource.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/fhir.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/functions.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/spark.py +0 -0
- {pathling-9.2.0.dev1 → pathling-9.3.0}/pathling/udfs.py +0 -0
|
@@ -183,11 +183,12 @@ agree to comply with the licence terms for these components as part of
|
|
|
183
183
|
accessing the Software. Other third party software may also be identified in
|
|
184
184
|
separate files distributed with the Software.
|
|
185
185
|
|
|
186
|
-
* (Apache License, Version 2.0) FHIR Bulk Client (au.csiro.fhir:bulk-export:1.0.
|
|
186
|
+
* (Apache License, Version 2.0) FHIR Bulk Client (au.csiro.fhir:bulk-export:1.0.4 - https://github.com/aehrc/fhir-bulk-java)
|
|
187
|
+
* (Apache License, Version 2.0) FHIR Auth Client for Java (au.csiro.fhir:fhir-auth:1.0.0 - https://github.com/aehrc/fhir-auth-java)
|
|
187
188
|
* (Apache License, Version 2.0) HAPI FHIR - Core Library (ca.uhn.hapi.fhir:hapi-fhir-base:8.6.0 - https://hapifhir.io/)
|
|
188
189
|
* (Apache License, Version 2.0) HAPI FHIR - Client Framework (ca.uhn.hapi.fhir:hapi-fhir-client:8.6.0 - https://hapifhir.io/hapi-deployable-pom/hapi-fhir-client)
|
|
189
190
|
* (Apache License, Version 2.0) HAPI FHIR Structures - FHIR R4 (ca.uhn.hapi.fhir:hapi-fhir-structures-r4:8.6.0 - https://hapifhir.io/hapi-deployable-pom/hapi-fhir-structures-r4)
|
|
190
|
-
* (Eclipse Public License 1.0) (GNU Lesser General Public License) Logback Classic Module (ch.qos.logback:logback-classic:1.5.
|
|
191
|
+
* (Eclipse Public License 1.0) (GNU Lesser General Public License) Logback Classic Module (ch.qos.logback:logback-classic:1.5.25 - http://logback.qos.ch/logback-classic)
|
|
191
192
|
* (Apache License, Version 2.0) WireMock (com.github.tomakehurst:wiremock-jre8-standalone:2.35.2 - http://wiremock.org)
|
|
192
193
|
* (Apache License, Version 2.0) FindBugs-jsr305 (com.google.code.findbugs:jsr305:3.0.2 - http://findbugs.sourceforge.net/)
|
|
193
194
|
* (Apache License, Version 2.0) Gson (com.google.code.gson:gson:2.10 - https://github.com/google/gson/gson)
|
|
@@ -203,16 +204,17 @@ separate files distributed with the Software.
|
|
|
203
204
|
* (Apache License, Version 2.0) Apache Commons Lang (org.apache.commons:commons-lang3:3.18.0 - https://commons.apache.org/proper/commons-lang/)
|
|
204
205
|
* (Apache License, Version 2.0) Apache Derby Tools (org.apache.derby:derbytools:10.16.1.1 - http://db.apache.org/derby/)
|
|
205
206
|
* (Apache License, Version 2.0) Apache Hadoop Client API (org.apache.hadoop:hadoop-client-api:3.4.1 - no url defined)
|
|
206
|
-
* (Apache License, Version 2.0) Spark Project Catalyst (org.apache.spark:spark-catalyst_2.13:4.0.
|
|
207
|
-
* (Apache License, Version 2.0) Spark Project Core (org.apache.spark:spark-core_2.13:4.0.
|
|
208
|
-
* (Apache License, Version 2.0) Spark Project Hive (org.apache.spark:spark-hive_2.13:4.0.
|
|
209
|
-
* (Apache License, Version 2.0) Spark Project SQL (org.apache.spark:spark-sql_2.13:4.0.
|
|
210
|
-
* (Apache License, Version 2.0) Spark Project Unsafe (org.apache.spark:spark-unsafe_2.13:4.0.
|
|
207
|
+
* (Apache License, Version 2.0) Spark Project Catalyst (org.apache.spark:spark-catalyst_2.13:4.0.2 - https://spark.apache.org/)
|
|
208
|
+
* (Apache License, Version 2.0) Spark Project Core (org.apache.spark:spark-core_2.13:4.0.2 - https://spark.apache.org/)
|
|
209
|
+
* (Apache License, Version 2.0) Spark Project Hive (org.apache.spark:spark-hive_2.13:4.0.2 - https://spark.apache.org/)
|
|
210
|
+
* (Apache License, Version 2.0) Spark Project SQL (org.apache.spark:spark-sql_2.13:4.0.2 - https://spark.apache.org/)
|
|
211
|
+
* (Apache License, Version 2.0) Spark Project Unsafe (org.apache.spark:spark-unsafe_2.13:4.0.2 - https://spark.apache.org/)
|
|
211
212
|
* (Apache License, Version 2.0) Awaitility (org.awaitility:awaitility:4.2.0 - http://awaitility.org)
|
|
212
213
|
* (Apache License, Version 2.0) Hibernate Validator Engine (org.hibernate.validator:hibernate-validator:8.0.1.Final - http://hibernate.org/validator/hibernate-validator)
|
|
213
214
|
* (Apache License, Version 2.0) Infinispan Commons (org.infinispan:infinispan-commons:15.0.3.Final - http://www.infinispan.org)
|
|
214
215
|
* (Apache License, Version 2.0) Infinispan Component Annotations (org.infinispan:infinispan-component-annotations:15.0.3.Final - http://www.infinispan.org)
|
|
215
216
|
* (Apache License, Version 2.0) Infinispan Core (org.infinispan:infinispan-core:15.0.3.Final - http://www.infinispan.org)
|
|
217
|
+
* (Public Domain) JSON in Java (org.json:json:20231013 - https://github.com/douglascrockford/JSON-java)
|
|
216
218
|
* (Public Domain) JSON in Java (org.json:json:20240303 - https://github.com/douglascrockford/JSON-java)
|
|
217
219
|
* (Eclipse Public License v2.0) JUnit Jupiter API (org.junit.jupiter:junit-jupiter-api:5.11.4 - https://junit.org/junit5/)
|
|
218
220
|
* (Eclipse Public License v2.0) JUnit Jupiter Engine (org.junit.jupiter:junit-jupiter-engine:5.11.4 - https://junit.org/junit5/)
|
|
@@ -221,7 +223,8 @@ separate files distributed with the Software.
|
|
|
221
223
|
* (GNU General Public License (GPL), version 2, with the Classpath exception) JMH Core (org.openjdk.jmh:jmh-core:1.37 - http://openjdk.java.net/projects/code-tools/jmh/jmh-core/)
|
|
222
224
|
* (GNU General Public License (GPL), version 2, with the Classpath exception) JMH Generators: Annotation Processors (org.openjdk.jmh:jmh-generator-annprocess:1.37 - http://openjdk.java.net/projects/code-tools/jmh/jmh-generator-annprocess/)
|
|
223
225
|
* (MIT License) Project Lombok (org.projectlombok:lombok:1.18.38 - https://projectlombok.org)
|
|
224
|
-
* (Apache License, Version 2.0) Scala Library (org.scala-lang:scala-library:2.13.
|
|
226
|
+
* (Apache License, Version 2.0) Scala Library (org.scala-lang:scala-library:2.13.16 - https://www.scala-lang.org/)
|
|
225
227
|
* (Apache License, Version 2.0) JSONassert (org.skyscreamer:jsonassert:1.5.1 - https://github.com/skyscreamer/JSONassert)
|
|
228
|
+
* (Apache License, Version 2.0) JSONassert (org.skyscreamer:jsonassert:1.5.3 - https://github.com/skyscreamer/JSONassert)
|
|
226
229
|
* (MIT License) SLF4J API Module (org.slf4j:slf4j-api:2.0.17 - http://www.slf4j.org)
|
|
227
230
|
* (Apache License, Version 2.0) spring-boot-starter-test (org.springframework.boot:spring-boot-starter-test:3.4.11 - https://spring.io/projects/spring-boot)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import os
|
|
17
|
+
|
|
18
|
+
from pathling import PathlingContext
|
|
19
|
+
|
|
20
|
+
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
21
|
+
DATA_DIR = os.path.join(HERE, "data")
|
|
22
|
+
NDJSON_DIR = os.path.join(DATA_DIR, "resources")
|
|
23
|
+
|
|
24
|
+
pc = PathlingContext.create()
|
|
25
|
+
datasource = pc.read.ndjson(NDJSON_DIR)
|
|
26
|
+
|
|
27
|
+
search_filter = pc.search_to_column("Patient", "gender=male&family=MacGyver")
|
|
28
|
+
datasource.read("Patient").filter(search_filter).select(
|
|
29
|
+
"id", "gender", "name.family"
|
|
30
|
+
).show()
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
# Auto generated from POM project version.
|
|
3
3
|
# Please do not modify.
|
|
4
4
|
#
|
|
5
|
-
__version__="9.
|
|
6
|
-
__java_version__="9.
|
|
5
|
+
__version__="9.3.0"
|
|
6
|
+
__java_version__="9.3.0"
|
|
7
7
|
__scala_version__="2.13"
|
|
8
8
|
__delta_version__="4.0.0"
|
|
9
9
|
__hadoop_version__="3.4.1"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
from typing import TYPE_CHECKING, Optional, Sequence
|
|
19
19
|
|
|
20
20
|
from py4j.java_gateway import JavaObject
|
|
21
|
-
from pyspark.sql import DataFrame, SparkSession
|
|
21
|
+
from pyspark.sql import Column, DataFrame, SparkSession
|
|
22
22
|
|
|
23
23
|
from pathling._version import (
|
|
24
24
|
__delta_version__,
|
|
@@ -380,3 +380,72 @@ class PathlingContext:
|
|
|
380
380
|
from pathling.datasource import DataSources
|
|
381
381
|
|
|
382
382
|
return DataSources(self)
|
|
383
|
+
|
|
384
|
+
def fhirpath_to_column(
|
|
385
|
+
self, resource_type: str, fhirpath_expression: str
|
|
386
|
+
) -> Column:
|
|
387
|
+
"""
|
|
388
|
+
Converts a FHIRPath expression to a PySpark Column.
|
|
389
|
+
|
|
390
|
+
This method takes a FHIRPath expression and returns a PySpark Column that
|
|
391
|
+
can be used in DataFrame operations such as ``filter()`` and ``select()``.
|
|
392
|
+
Boolean expressions can be used for filtering, while other expressions can
|
|
393
|
+
be used for value extraction.
|
|
394
|
+
|
|
395
|
+
The expression should evaluate to a single value per resource row.
|
|
396
|
+
|
|
397
|
+
Example usage::
|
|
398
|
+
|
|
399
|
+
pc = PathlingContext.create(spark)
|
|
400
|
+
|
|
401
|
+
# Boolean expression for filtering
|
|
402
|
+
gender_filter = pc.fhirpath_to_column("Patient", "gender = 'male'")
|
|
403
|
+
filtered = patients.filter(gender_filter)
|
|
404
|
+
|
|
405
|
+
# Value expression for selection
|
|
406
|
+
name_col = pc.fhirpath_to_column("Patient", "name.given.first()")
|
|
407
|
+
names = patients.select(name_col)
|
|
408
|
+
|
|
409
|
+
:param resource_type: the FHIR resource type (e.g., "Patient", "Observation")
|
|
410
|
+
:param fhirpath_expression: the FHIRPath expression to evaluate
|
|
411
|
+
:return: a PySpark Column representing the evaluated expression
|
|
412
|
+
:raises: IllegalArgumentException if the resource type is invalid
|
|
413
|
+
:raises: Exception if the FHIRPath expression is invalid
|
|
414
|
+
"""
|
|
415
|
+
jcolumn = self._jpc.fhirPathToColumn(resource_type, fhirpath_expression)
|
|
416
|
+
return Column(jcolumn)
|
|
417
|
+
|
|
418
|
+
def search_to_column(self, resource_type: str, search_expression: str) -> Column:
|
|
419
|
+
"""
|
|
420
|
+
Converts a FHIR search expression to a boolean filter column.
|
|
421
|
+
|
|
422
|
+
This method takes a FHIR search query string and returns a PySpark Column
|
|
423
|
+
that can be used to filter a DataFrame of FHIR resources. The resulting
|
|
424
|
+
Column evaluates to true for resources that match the search criteria.
|
|
425
|
+
|
|
426
|
+
Example usage::
|
|
427
|
+
|
|
428
|
+
pc = PathlingContext.create(spark)
|
|
429
|
+
|
|
430
|
+
# Single parameter
|
|
431
|
+
gender_filter = pc.search_to_column("Patient", "gender=male")
|
|
432
|
+
|
|
433
|
+
# Multiple parameters (AND)
|
|
434
|
+
combined_filter = pc.search_to_column("Patient", "gender=male&birthdate=ge1990-01-01")
|
|
435
|
+
|
|
436
|
+
# Combine with Pythonic operators
|
|
437
|
+
filter1 = pc.search_to_column("Patient", "gender=male")
|
|
438
|
+
filter2 = pc.search_to_column("Patient", "active=true")
|
|
439
|
+
combined = filter1 & filter2
|
|
440
|
+
|
|
441
|
+
# Apply to DataFrame
|
|
442
|
+
patients = datasource.read("Patient")
|
|
443
|
+
filtered = patients.filter(combined)
|
|
444
|
+
|
|
445
|
+
:param resource_type: the FHIR resource type (e.g., "Patient", "Observation")
|
|
446
|
+
:param search_expression: URL query string format (e.g., "gender=male&birthdate=ge1990")
|
|
447
|
+
:return: a PySpark Column representing the boolean filter condition
|
|
448
|
+
:raises: IllegalArgumentException if the search expression contains unknown parameters
|
|
449
|
+
"""
|
|
450
|
+
jcolumn = self._jpc.searchToColumn(resource_type, search_expression)
|
|
451
|
+
return Column(jcolumn)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|