pathling 9.3.0.dev0__tar.gz → 9.4.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.3.0.dev0 → pathling-9.4.0}/LICENSE +6 -3
- {pathling-9.3.0.dev0 → pathling-9.4.0}/PKG-INFO +1 -1
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/_version.py +2 -2
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/context.py +61 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/.gitignore +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/README.md +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/bulk.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/data/bundles/Bennett146_Swaniawski813_704c9750-f6e6-473b-ee83-fbd48e07fe3f.json +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/data/bundles/Dino214_Parisian75_40d82b80-b682-cd8b-da6d-396809878641.json +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/data/csv/conditions.csv +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/data/resources/Condition.ndjson +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/data/resources/Patient.ndjson +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/designation.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/display.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/encode_bundles.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/encode_resources.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/fhir_search.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/fhir_view.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/member_of.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/property_of.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/subsumes.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/examples/translate.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/__init__.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/bulk.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/coding.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/core.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/datasink.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/datasource.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/fhir.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/functions.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/spark.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pathling/udfs.py +0 -0
- {pathling-9.3.0.dev0 → pathling-9.4.0}/pyproject.toml +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)
|
|
@@ -213,6 +214,7 @@ separate files distributed with the Software.
|
|
|
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)
|
|
@@ -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.4.0"
|
|
6
|
+
__java_version__="9.4.0"
|
|
7
7
|
__scala_version__="2.13"
|
|
8
8
|
__delta_version__="4.0.0"
|
|
9
9
|
__hadoop_version__="3.4.1"
|
|
@@ -33,6 +33,14 @@ if TYPE_CHECKING:
|
|
|
33
33
|
__all__ = ["PathlingContext"]
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
def _convert_java_value(value):
|
|
37
|
+
"""Converts a Java value from Py4J to an equivalent Python type."""
|
|
38
|
+
if isinstance(value, (str, int, float, bool)):
|
|
39
|
+
return value
|
|
40
|
+
# For other types (e.g., Java BigDecimal, Row), convert to string.
|
|
41
|
+
return str(value)
|
|
42
|
+
|
|
43
|
+
|
|
36
44
|
class StorageType:
|
|
37
45
|
MEMORY: str = "memory"
|
|
38
46
|
DISK: str = "disk"
|
|
@@ -415,6 +423,59 @@ class PathlingContext:
|
|
|
415
423
|
jcolumn = self._jpc.fhirPathToColumn(resource_type, fhirpath_expression)
|
|
416
424
|
return Column(jcolumn)
|
|
417
425
|
|
|
426
|
+
def evaluate_fhirpath(
|
|
427
|
+
self,
|
|
428
|
+
resource_type: str,
|
|
429
|
+
resource_json: str,
|
|
430
|
+
fhirpath_expression: str,
|
|
431
|
+
context_expression: Optional[str] = None,
|
|
432
|
+
variables: Optional[dict] = None,
|
|
433
|
+
) -> dict:
|
|
434
|
+
"""
|
|
435
|
+
Evaluates a FHIRPath expression against a single FHIR resource and returns
|
|
436
|
+
materialised typed results.
|
|
437
|
+
|
|
438
|
+
The resource is encoded into a one-row Spark Dataset internally, and the
|
|
439
|
+
existing FHIRPath engine is used to evaluate the expression. Results are
|
|
440
|
+
collected and returned as typed values.
|
|
441
|
+
|
|
442
|
+
Example usage::
|
|
443
|
+
|
|
444
|
+
pc = PathlingContext.create(spark)
|
|
445
|
+
result = pc.evaluate_fhirpath("Patient", patient_json, "name.family")
|
|
446
|
+
for value in result["results"]:
|
|
447
|
+
print(f"{value['type']}: {value['value']}")
|
|
448
|
+
|
|
449
|
+
:param resource_type: the FHIR resource type (e.g., "Patient", "Observation")
|
|
450
|
+
:param resource_json: the FHIR resource as a JSON string
|
|
451
|
+
:param fhirpath_expression: the FHIRPath expression to evaluate
|
|
452
|
+
:param context_expression: an optional context expression; if provided, the main
|
|
453
|
+
expression is composed with the context expression
|
|
454
|
+
:param variables: optional named variables available via %variable syntax, or None
|
|
455
|
+
:return: a dict with ``results`` (list of dicts with ``type`` and ``value``
|
|
456
|
+
keys) and ``expectedReturnType`` (string)
|
|
457
|
+
:raises: Exception if the expression is invalid or evaluation fails
|
|
458
|
+
"""
|
|
459
|
+
jresult = self._jpc.evaluateFhirPath(
|
|
460
|
+
resource_type,
|
|
461
|
+
resource_json,
|
|
462
|
+
fhirpath_expression,
|
|
463
|
+
context_expression,
|
|
464
|
+
variables,
|
|
465
|
+
)
|
|
466
|
+
# Convert Java FhirPathResult to Python dict.
|
|
467
|
+
results = []
|
|
468
|
+
for jtyped_value in jresult.getResults():
|
|
469
|
+
value = jtyped_value.getValue()
|
|
470
|
+
# Convert Java types to Python types.
|
|
471
|
+
if value is not None:
|
|
472
|
+
value = _convert_java_value(value)
|
|
473
|
+
results.append({"type": jtyped_value.getType(), "value": value})
|
|
474
|
+
return {
|
|
475
|
+
"results": results,
|
|
476
|
+
"expectedReturnType": jresult.getExpectedReturnType(),
|
|
477
|
+
}
|
|
478
|
+
|
|
418
479
|
def search_to_column(self, resource_type: str, search_expression: str) -> Column:
|
|
419
480
|
"""
|
|
420
481
|
Converts a FHIR search expression to a boolean filter column.
|
|
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
|
|
File without changes
|
|
File without changes
|