pathling 9.5.0.dev0__tar.gz → 9.6.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.5.0.dev0 → pathling-9.6.0}/PKG-INFO +1 -1
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/bulk.py +13 -11
- pathling-9.6.0/examples/designation.py +40 -0
- pathling-9.6.0/examples/display.py +32 -0
- pathling-9.6.0/examples/encode_bundles.py +37 -0
- pathling-9.6.0/examples/encode_resources.py +34 -0
- pathling-9.6.0/examples/fhir_search.py +32 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/fhir_view.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/member_of.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/property_of.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/subsumes.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/translate.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/__init__.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/_version.py +2 -2
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/bulk.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/coding.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/context.py +42 -19
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/core.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/datasink.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/datasource.py +16 -14
- pathling-9.6.0/pathling/fhir.py +33 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/functions.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/spark.py +13 -12
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pathling/udfs.py +13 -11
- {pathling-9.5.0.dev0 → pathling-9.6.0}/pyproject.toml +1 -1
- pathling-9.5.0.dev0/examples/designation.py +0 -38
- pathling-9.5.0.dev0/examples/display.py +0 -30
- pathling-9.5.0.dev0/examples/encode_bundles.py +0 -35
- pathling-9.5.0.dev0/examples/encode_resources.py +0 -32
- pathling-9.5.0.dev0/examples/fhir_search.py +0 -30
- pathling-9.5.0.dev0/pathling/fhir.py +0 -31
- {pathling-9.5.0.dev0 → pathling-9.6.0}/.gitignore +0 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/LICENSE +0 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/README.md +0 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/data/bundles/Bennett146_Swaniawski813_704c9750-f6e6-473b-ee83-fbd48e07fe3f.json +0 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/data/bundles/Dino214_Parisian75_40d82b80-b682-cd8b-da6d-396809878641.json +0 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/data/csv/conditions.csv +0 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/data/resources/Condition.ndjson +0 -0
- {pathling-9.5.0.dev0 → pathling-9.6.0}/examples/data/resources/Patient.ndjson +0 -0
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
import os
|
|
17
19
|
import tempfile
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
|
|
20
|
+
from pathling import Coding, PathlingContext, designation, to_snomed_coding
|
|
21
|
+
|
|
22
|
+
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
23
|
+
|
|
24
|
+
pc = PathlingContext.create()
|
|
25
|
+
|
|
26
|
+
csv = pc.spark.read.options(header=True).csv(
|
|
27
|
+
f"file://{os.path.join(HERE, 'data/csv/conditions.csv')}"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Obtain display name for snomed codes
|
|
31
|
+
|
|
32
|
+
SNOMED_FULLY_SPECIFIED_NAME = Coding.of_snomed("900000000000003001")
|
|
33
|
+
|
|
34
|
+
result = csv.withColumn(
|
|
35
|
+
"FULL_NAME",
|
|
36
|
+
designation(to_snomed_coding(csv.CODE), SNOMED_FULLY_SPECIFIED_NAME, "en").getItem(
|
|
37
|
+
0
|
|
38
|
+
),
|
|
39
|
+
)
|
|
40
|
+
result.select("CODE", "DESCRIPTION", "FULL_NAME").show()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
|
|
20
|
+
from pathling import PathlingContext, display, to_snomed_coding
|
|
21
|
+
|
|
22
|
+
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
23
|
+
|
|
24
|
+
pc = PathlingContext.create()
|
|
25
|
+
|
|
26
|
+
csv = pc.spark.read.options(header=True).csv(
|
|
27
|
+
f"file://{os.path.join(HERE, 'data/csv/conditions.csv')}"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Obtain display name for snomed codes
|
|
31
|
+
result = csv.withColumn("DISPLAY_NAME", display(to_snomed_coding(csv.CODE)))
|
|
32
|
+
result.select("CODE", "DESCRIPTION", "DISPLAY_NAME").show()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
|
|
20
|
+
from pathling import PathlingContext
|
|
21
|
+
|
|
22
|
+
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
23
|
+
|
|
24
|
+
pc = PathlingContext.create()
|
|
25
|
+
|
|
26
|
+
# Read each Bundle into a row within a Spark data set.
|
|
27
|
+
bundles_dir = os.path.join(HERE, "data/bundles/")
|
|
28
|
+
bundles = pc.spark.read.text(bundles_dir, wholetext=True)
|
|
29
|
+
|
|
30
|
+
# Convert the data set of strings into a structured FHIR data set.
|
|
31
|
+
patients = pc.encode_bundle(bundles, "Patient")
|
|
32
|
+
|
|
33
|
+
# JSON is the default format, XML Bundles can be encoded using input type.
|
|
34
|
+
# patients = pc.encodeBundle(bundles, 'Patient', inputType=MimeType.FHIR_XML)
|
|
35
|
+
|
|
36
|
+
# Do some stuff.
|
|
37
|
+
patients.select("id", "gender", "birthDate").show()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
|
|
20
|
+
from pathling import PathlingContext
|
|
21
|
+
|
|
22
|
+
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
23
|
+
|
|
24
|
+
pc = PathlingContext.create()
|
|
25
|
+
|
|
26
|
+
# Read each line from the NDJSON into a row within a Spark data set.
|
|
27
|
+
ndjson_dir = os.path.join(HERE, "data/resources/")
|
|
28
|
+
json_resources = pc.spark.read.text(ndjson_dir)
|
|
29
|
+
|
|
30
|
+
# Convert the data set of strings into a structured FHIR data set.
|
|
31
|
+
patients = pc.encode(json_resources, "Patient")
|
|
32
|
+
|
|
33
|
+
# Do some stuff.
|
|
34
|
+
patients.select("id", "gender", "birthDate").show()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
|
|
20
|
+
from pathling import PathlingContext
|
|
21
|
+
|
|
22
|
+
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
23
|
+
DATA_DIR = os.path.join(HERE, "data")
|
|
24
|
+
NDJSON_DIR = os.path.join(DATA_DIR, "resources")
|
|
25
|
+
|
|
26
|
+
pc = PathlingContext.create()
|
|
27
|
+
datasource = pc.read.ndjson(NDJSON_DIR)
|
|
28
|
+
|
|
29
|
+
search_filter = pc.search_to_column("Patient", "gender=male&family=MacGyver")
|
|
30
|
+
datasource.read("Patient").filter(search_filter).select(
|
|
31
|
+
"id", "gender", "name.family"
|
|
32
|
+
).show()
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
import os
|
|
17
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
import os
|
|
17
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
import os
|
|
17
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
import os
|
|
17
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
import os
|
|
17
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
from .coding import Coding
|
|
17
19
|
from .context import PathlingContext, StorageType
|
|
@@ -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.6.0"
|
|
6
|
+
__java_version__="9.6.0"
|
|
7
7
|
__scala_version__="2.13"
|
|
8
8
|
__delta_version__="4.0.0"
|
|
9
9
|
__hadoop_version__="3.4.1"
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
from dataclasses import dataclass
|
|
17
19
|
from datetime import datetime, timezone
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
from typing import Optional
|
|
17
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
# noinspection PyPackageRequirements
|
|
17
19
|
|
|
@@ -41,6 +43,21 @@ def _convert_java_value(value):
|
|
|
41
43
|
return str(value)
|
|
42
44
|
|
|
43
45
|
|
|
46
|
+
def _convert_typed_values(jtyped_values) -> list:
|
|
47
|
+
"""Converts a Java list of TypedValue objects to Python dicts.
|
|
48
|
+
|
|
49
|
+
:param jtyped_values: iterable of Java TypedValue objects with getType() and getValue()
|
|
50
|
+
:return: list of dicts with ``type`` and ``value`` keys
|
|
51
|
+
"""
|
|
52
|
+
results = []
|
|
53
|
+
for jtyped_value in jtyped_values:
|
|
54
|
+
value = jtyped_value.getValue()
|
|
55
|
+
if value is not None:
|
|
56
|
+
value = _convert_java_value(value)
|
|
57
|
+
results.append({"type": jtyped_value.getType(), "value": value})
|
|
58
|
+
return results
|
|
59
|
+
|
|
60
|
+
|
|
44
61
|
class StorageType:
|
|
45
62
|
MEMORY: str = "memory"
|
|
46
63
|
DISK: str = "disk"
|
|
@@ -453,7 +470,8 @@ class PathlingContext:
|
|
|
453
470
|
expression is composed with the context expression
|
|
454
471
|
:param variables: optional named variables available via %variable syntax, or None
|
|
455
472
|
:return: a dict with ``results`` (list of dicts with ``type`` and ``value``
|
|
456
|
-
keys)
|
|
473
|
+
keys), ``expectedReturnType`` (string), and ``traces`` (list of
|
|
474
|
+
dicts with ``label`` and ``values`` keys)
|
|
457
475
|
:raises: Exception if the expression is invalid or evaluation fails
|
|
458
476
|
"""
|
|
459
477
|
jresult = self._jpc.evaluateFhirPath(
|
|
@@ -464,16 +482,21 @@ class PathlingContext:
|
|
|
464
482
|
variables,
|
|
465
483
|
)
|
|
466
484
|
# Convert Java FhirPathResult to Python dict.
|
|
467
|
-
results =
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
485
|
+
results = _convert_typed_values(jresult.getResults())
|
|
486
|
+
|
|
487
|
+
# Convert trace results.
|
|
488
|
+
traces = [
|
|
489
|
+
{
|
|
490
|
+
"label": jtrace.getLabel(),
|
|
491
|
+
"values": _convert_typed_values(jtrace.getValues()),
|
|
492
|
+
}
|
|
493
|
+
for jtrace in jresult.getTraces()
|
|
494
|
+
]
|
|
495
|
+
|
|
474
496
|
return {
|
|
475
497
|
"results": results,
|
|
476
498
|
"expectedReturnType": jresult.getExpectedReturnType(),
|
|
499
|
+
"traces": traces,
|
|
477
500
|
}
|
|
478
501
|
|
|
479
502
|
def search_to_column(self, resource_type: str, search_expression: str) -> Column:
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
from typing import Any, Callable, Optional, Sequence, Tuple, Union
|
|
17
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
from dataclasses import dataclass
|
|
17
19
|
from typing import TYPE_CHECKING, Callable, List, Optional
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
from datetime import datetime
|
|
17
19
|
from json import dumps, loads
|
|
@@ -72,7 +74,7 @@ class DataSource(SparkConversionsMixin):
|
|
|
72
74
|
self,
|
|
73
75
|
resource: Optional[str] = None,
|
|
74
76
|
select: Optional[Sequence[Dict]] = None,
|
|
75
|
-
|
|
77
|
+
constant: Optional[Sequence[Dict]] = None,
|
|
76
78
|
where: Optional[Sequence[Dict]] = None,
|
|
77
79
|
json: Optional[str] = None,
|
|
78
80
|
) -> DataFrame:
|
|
@@ -82,7 +84,7 @@ class DataSource(SparkConversionsMixin):
|
|
|
82
84
|
:param resource: The FHIR resource that the view is based upon, e.g. 'Patient' or
|
|
83
85
|
'Observation'.
|
|
84
86
|
:param select: A list of columns and nested selects to include in the view.
|
|
85
|
-
:param
|
|
87
|
+
:param constant: A list of constants that can be used in FHIRPath expressions.
|
|
86
88
|
:param where: A list of FHIRPath expressions that can be used to filter the view.
|
|
87
89
|
:param json: A JSON string representing the view definition, as an alternative to providing
|
|
88
90
|
the parameters as Python objects.
|
|
@@ -96,7 +98,7 @@ class DataSource(SparkConversionsMixin):
|
|
|
96
98
|
args = locals()
|
|
97
99
|
query = {
|
|
98
100
|
key: args[key]
|
|
99
|
-
for key in ["resource", "select", "
|
|
101
|
+
for key in ["resource", "select", "constant", "where"]
|
|
100
102
|
if args[key] is not None
|
|
101
103
|
}
|
|
102
104
|
query_json = dumps(query)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class MimeType:
|
|
20
|
+
"""
|
|
21
|
+
Constants for FHIR encoding mime types.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
FHIR_JSON: str = "application/fhir+json"
|
|
25
|
+
FHIR_XML: str = "application/fhir+xml"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Version:
|
|
29
|
+
"""
|
|
30
|
+
Constants for FHIR versions.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
R4: str = "R4"
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
import urllib.parse
|
|
17
19
|
from typing import Optional
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
17
18
|
import uuid
|
|
18
19
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
|
|
2
|
-
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# You may obtain a copy of the License at
|
|
2
|
+
# Copyright © 2018-2026 Commonwealth Scientific and Industrial Research
|
|
3
|
+
# Organisation (CSIRO) ABN 41 687 119 230.
|
|
7
4
|
#
|
|
8
|
-
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
9
16
|
#
|
|
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
17
|
|
|
16
18
|
from typing import Any, Collection, Optional, Union
|
|
17
19
|
|
|
@@ -1,38 +0,0 @@
|
|
|
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 Coding, PathlingContext, designation, to_snomed_coding
|
|
19
|
-
|
|
20
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
21
|
-
|
|
22
|
-
pc = PathlingContext.create()
|
|
23
|
-
|
|
24
|
-
csv = pc.spark.read.options(header=True).csv(
|
|
25
|
-
f"file://{os.path.join(HERE, 'data/csv/conditions.csv')}"
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
# Obtain display name for snomed codes
|
|
29
|
-
|
|
30
|
-
SNOMED_FULLY_SPECIFIED_NAME = Coding.of_snomed("900000000000003001")
|
|
31
|
-
|
|
32
|
-
result = csv.withColumn(
|
|
33
|
-
"FULL_NAME",
|
|
34
|
-
designation(to_snomed_coding(csv.CODE), SNOMED_FULLY_SPECIFIED_NAME, "en").getItem(
|
|
35
|
-
0
|
|
36
|
-
),
|
|
37
|
-
)
|
|
38
|
-
result.select("CODE", "DESCRIPTION", "FULL_NAME").show()
|
|
@@ -1,30 +0,0 @@
|
|
|
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, display, to_snomed_coding
|
|
19
|
-
|
|
20
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
21
|
-
|
|
22
|
-
pc = PathlingContext.create()
|
|
23
|
-
|
|
24
|
-
csv = pc.spark.read.options(header=True).csv(
|
|
25
|
-
f"file://{os.path.join(HERE, 'data/csv/conditions.csv')}"
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
# Obtain display name for snomed codes
|
|
29
|
-
result = csv.withColumn("DISPLAY_NAME", display(to_snomed_coding(csv.CODE)))
|
|
30
|
-
result.select("CODE", "DESCRIPTION", "DISPLAY_NAME").show()
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
|
|
22
|
-
pc = PathlingContext.create()
|
|
23
|
-
|
|
24
|
-
# Read each Bundle into a row within a Spark data set.
|
|
25
|
-
bundles_dir = os.path.join(HERE, "data/bundles/")
|
|
26
|
-
bundles = pc.spark.read.text(bundles_dir, wholetext=True)
|
|
27
|
-
|
|
28
|
-
# Convert the data set of strings into a structured FHIR data set.
|
|
29
|
-
patients = pc.encode_bundle(bundles, "Patient")
|
|
30
|
-
|
|
31
|
-
# JSON is the default format, XML Bundles can be encoded using input type.
|
|
32
|
-
# patients = pc.encodeBundle(bundles, 'Patient', inputType=MimeType.FHIR_XML)
|
|
33
|
-
|
|
34
|
-
# Do some stuff.
|
|
35
|
-
patients.select("id", "gender", "birthDate").show()
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
|
|
22
|
-
pc = PathlingContext.create()
|
|
23
|
-
|
|
24
|
-
# Read each line from the NDJSON into a row within a Spark data set.
|
|
25
|
-
ndjson_dir = os.path.join(HERE, "data/resources/")
|
|
26
|
-
json_resources = pc.spark.read.text(ndjson_dir)
|
|
27
|
-
|
|
28
|
-
# Convert the data set of strings into a structured FHIR data set.
|
|
29
|
-
patients = pc.encode(json_resources, "Patient")
|
|
30
|
-
|
|
31
|
-
# Do some stuff.
|
|
32
|
-
patients.select("id", "gender", "birthDate").show()
|
|
@@ -1,30 +0,0 @@
|
|
|
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()
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
|
|
17
|
-
class MimeType:
|
|
18
|
-
"""
|
|
19
|
-
Constants for FHIR encoding mime types.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
FHIR_JSON: str = "application/fhir+json"
|
|
23
|
-
FHIR_XML: str = "application/fhir+xml"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class Version:
|
|
27
|
-
"""
|
|
28
|
-
Constants for FHIR versions.
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
R4: str = "R4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|