fhir-reada 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- fhir_reada/__init__.py +1 -1
- fhir_reada/deid_utils.py +19 -2
- {fhir_reada-0.1.1.dist-info → fhir_reada-0.1.2.dist-info}/METADATA +1 -1
- fhir_reada-0.1.2.dist-info/RECORD +12 -0
- fhir_reada-0.1.1.dist-info/RECORD +0 -12
- {fhir_reada-0.1.1.dist-info → fhir_reada-0.1.2.dist-info}/LICENSE +0 -0
- {fhir_reada-0.1.1.dist-info → fhir_reada-0.1.2.dist-info}/WHEEL +0 -0
- {fhir_reada-0.1.1.dist-info → fhir_reada-0.1.2.dist-info}/entry_points.txt +0 -0
- {fhir_reada-0.1.1.dist-info → fhir_reada-0.1.2.dist-info}/top_level.txt +0 -0
fhir_reada/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.1.
|
1
|
+
__version__ = "0.1.2"
|
fhir_reada/deid_utils.py
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
from hashlib import sha256
|
2
|
+
from datetime import datetime
|
3
|
+
|
4
|
+
def get_birth_year_and_age(birth_date_str):
|
5
|
+
try:
|
6
|
+
birth = datetime.strptime(birth_date_str, "%Y-%m-%d")
|
7
|
+
today = datetime.today()
|
8
|
+
age = today.year - birth.year - ((today.month, today.day) < (birth.month, birth.day))
|
9
|
+
birth_year = birth.year
|
10
|
+
return (
|
11
|
+
"90+" if age >= 90 else str(birth_year),
|
12
|
+
"90+" if age >= 90 else str(age)
|
13
|
+
)
|
14
|
+
except Exception:
|
15
|
+
return ("UNKNOWN", "UNKNOWN")
|
2
16
|
|
3
17
|
def deidentify_patient_bundle(bundle):
|
4
18
|
patient = bundle["patient"]
|
@@ -6,12 +20,15 @@ def deidentify_patient_bundle(bundle):
|
|
6
20
|
observations = bundle["observations"]
|
7
21
|
|
8
22
|
patient_id = patient.get("id", "")
|
9
|
-
pseudo_id = sha256(patient_id.encode()).hexdigest()
|
23
|
+
pseudo_id = sha256(patient_id.encode()).hexdigest()
|
24
|
+
|
25
|
+
birth_year, age = get_birth_year_and_age(patient.get("birthDate"))
|
10
26
|
|
11
27
|
return {
|
12
28
|
"id": pseudo_id,
|
13
29
|
"gender": patient.get("gender"),
|
14
|
-
"
|
30
|
+
"birthYear": birth_year,
|
31
|
+
"age": age,
|
15
32
|
"conditions": "; ".join(conditions) if conditions else "None",
|
16
33
|
"observations": "; ".join(observations) if observations else "None"
|
17
34
|
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
fhir_reada/__init__.py,sha256=K5SiDdEGYMpdqXThrqwTqECJJBOQNTQDrnpc2K5mzKs,21
|
2
|
+
fhir_reada/cli.py,sha256=ee-qaFbC9rnRinxDY55CsrAN2jtRApMh_OcU4yyYMVg,1749
|
3
|
+
fhir_reada/cohort_builder.py,sha256=92XcLJJZfAZWdUVJBCZ3fPlPNY6AZ-8GPOQSEixO9YM,970
|
4
|
+
fhir_reada/deid_utils.py,sha256=O-W4vGH6XUAnZXsXYfqgz5Nu89mZ78zJbkj6CSKL-rg,1157
|
5
|
+
fhir_reada/exporter.py,sha256=FU19ArPFrcHadm7oL4T0h1tGwbyB2XjwnTM4ctAVdNI,360
|
6
|
+
fhir_reada/fhir_connector.py,sha256=CDGWwj6Pxw2g-4YU3DgftmQp0lwzmyx_6FAbN32GZNk,1423
|
7
|
+
fhir_reada-0.1.2.dist-info/LICENSE,sha256=sb_e78Fe7Dk6yq7gU0w6bytrGEinwYKP527HSihtlio,1111
|
8
|
+
fhir_reada-0.1.2.dist-info/METADATA,sha256=fiDNbsi5mN0rokMpMtoCz8kJzVdvPn4uONLGHW7iYN4,2204
|
9
|
+
fhir_reada-0.1.2.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
10
|
+
fhir_reada-0.1.2.dist-info/entry_points.txt,sha256=WGQ4P92SzyjFFTLUZlo6lSqQumr4MvfF05eOXhpgcpQ,51
|
11
|
+
fhir_reada-0.1.2.dist-info/top_level.txt,sha256=vJum_GABH4sFXP_XWV47DC7L7Yun_8h21vM5L8pdZ_0,11
|
12
|
+
fhir_reada-0.1.2.dist-info/RECORD,,
|
@@ -1,12 +0,0 @@
|
|
1
|
-
fhir_reada/__init__.py,sha256=8oAxKUG747GUokmxjkrWejyJa5yPNEsoJDlXxoedxTw,21
|
2
|
-
fhir_reada/cli.py,sha256=ee-qaFbC9rnRinxDY55CsrAN2jtRApMh_OcU4yyYMVg,1749
|
3
|
-
fhir_reada/cohort_builder.py,sha256=92XcLJJZfAZWdUVJBCZ3fPlPNY6AZ-8GPOQSEixO9YM,970
|
4
|
-
fhir_reada/deid_utils.py,sha256=ZCNrEUm_oq6VrAgGovAwUaIavvyhOBJrU4XNqHAeghA,577
|
5
|
-
fhir_reada/exporter.py,sha256=FU19ArPFrcHadm7oL4T0h1tGwbyB2XjwnTM4ctAVdNI,360
|
6
|
-
fhir_reada/fhir_connector.py,sha256=CDGWwj6Pxw2g-4YU3DgftmQp0lwzmyx_6FAbN32GZNk,1423
|
7
|
-
fhir_reada-0.1.1.dist-info/LICENSE,sha256=sb_e78Fe7Dk6yq7gU0w6bytrGEinwYKP527HSihtlio,1111
|
8
|
-
fhir_reada-0.1.1.dist-info/METADATA,sha256=U8DUGfz8C7cTXqK0qXravIUh0otPMkVwp82Qe6EogCM,2204
|
9
|
-
fhir_reada-0.1.1.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
10
|
-
fhir_reada-0.1.1.dist-info/entry_points.txt,sha256=WGQ4P92SzyjFFTLUZlo6lSqQumr4MvfF05eOXhpgcpQ,51
|
11
|
-
fhir_reada-0.1.1.dist-info/top_level.txt,sha256=vJum_GABH4sFXP_XWV47DC7L7Yun_8h21vM5L8pdZ_0,11
|
12
|
-
fhir_reada-0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|