fhir-sheets 2.0.0__tar.gz → 2.1.1__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.
Potentially problematic release.
This version of fhir-sheets might be problematic. Click here for more details.
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/PKG-INFO +1 -1
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/pyproject.toml +1 -1
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/cli/main.py +0 -1
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/conversion.py +5 -5
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/model/cohort_data_entity.py +2 -3
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/model/resource_definition_entity.py +1 -1
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/read_input.py +1 -3
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/LICENSE +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/README.md +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/__init__.py +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/cli/__init__.py +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/__init__.py +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/fhir_formatting.py +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/model/resource_link_entity.py +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/special_values.py +0 -0
- {fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fhir-sheets
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: FhirSheets is a command-line tool that reads an Excel file in FHIR cohort format and generates FHIR bundle JSON files from it. Each row in the template Excel file is used to create an individual JSON file, outputting them to a specified folder.
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Author: Michael Riley
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "fhir-sheets"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.1.1"
|
|
4
4
|
description = "FhirSheets is a command-line tool that reads an Excel file in FHIR cohort format and generates FHIR bundle JSON files from it. Each row in the template Excel file is used to create an individual JSON file, outputting them to a specified folder."
|
|
5
5
|
authors = ["Michael Riley <Michael.Riley@gtri.gatech.edu>"]
|
|
6
6
|
packages = [{include = "fhir_sheets", from = "src"}]
|
|
@@ -29,7 +29,6 @@ def main(input_file, output_folder):
|
|
|
29
29
|
if not output_folder_path.exists():
|
|
30
30
|
output_folder_path.mkdir(parents=True, exist_ok=True) # Create the folder if it doesn't exist
|
|
31
31
|
resource_definition_entities, resource_link_entities, cohort_data = read_input.read_xlsx_and_process(input_file)
|
|
32
|
-
pprint(cohort_data)
|
|
33
32
|
#For each index of patients
|
|
34
33
|
for i in range(0,cohort_data.get_num_patients()):
|
|
35
34
|
# Construct the file path for each JSON file
|
|
@@ -69,20 +69,20 @@ def create_fhir_resource(resource_definition: ResourceDefinition, cohort_data: C
|
|
|
69
69
|
if headerEntry.entityName == resource_definition.entity_name
|
|
70
70
|
]
|
|
71
71
|
dataelements_for_resourcename = {
|
|
72
|
-
|
|
73
|
-
for
|
|
74
|
-
if
|
|
72
|
+
field_name: value
|
|
73
|
+
for (entity_name, field_name), value in cohort_data.patients[index].entries.items()
|
|
74
|
+
if entity_name == resource_definition.entity_name
|
|
75
75
|
}
|
|
76
76
|
if len(dataelements_for_resourcename.keys()) == 0:
|
|
77
77
|
print(f"WARNING: Patient index {index} - Create Fhir Resource Error - {resource_definition.entity_name} - No columns for entity '{resource_definition.entity_name}' found for resource in 'PatientData' sheet")
|
|
78
78
|
return resource_dict
|
|
79
79
|
all_field_entries = cohort_data.entities[resource_definition.entity_name].fields
|
|
80
80
|
#For each field within the entity
|
|
81
|
-
for fieldname,
|
|
81
|
+
for fieldname, value in dataelements_for_resourcename.items():
|
|
82
82
|
header_element = next((header for header in header_entries_for_resourcename if header.fieldName == fieldname), None)
|
|
83
83
|
if header_element is None:
|
|
84
84
|
print(f"WARNING: Field Name {fieldname} - No Header Entry found.")
|
|
85
|
-
create_structure_from_jsonpath(resource_dict, header_element.jsonpath, resource_definition, header_element.value_type,
|
|
85
|
+
create_structure_from_jsonpath(resource_dict, header_element.jsonpath, resource_definition, header_element.value_type, value)
|
|
86
86
|
return resource_dict
|
|
87
87
|
|
|
88
88
|
#Create a resource_link for default references in the cases where only 1 resourceType of the source and destination exist
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import pprint
|
|
2
1
|
from typing import Dict, Any, List, Optional, Tuple
|
|
3
2
|
|
|
4
3
|
class HeaderEntry:
|
|
@@ -15,14 +14,14 @@ class HeaderEntry:
|
|
|
15
14
|
|
|
16
15
|
class PatientEntry:
|
|
17
16
|
|
|
18
|
-
def __init__(self, entries:Dict[str,str]):
|
|
17
|
+
def __init__(self, entries:Dict[Tuple[str,str],str]):
|
|
19
18
|
self.entries = entries
|
|
20
19
|
|
|
21
20
|
def __repr__(self) -> str:
|
|
22
21
|
return (f"PatientEntry(\n\t'{self.entries}')")
|
|
23
22
|
|
|
24
23
|
class CohortData:
|
|
25
|
-
def __init__(self, headers: List[Dict[str,Any]], patients: List[Dict[str,str]]):
|
|
24
|
+
def __init__(self, headers: List[Dict[str,Any]], patients: List[Dict[Tuple[str,str],str]]):
|
|
26
25
|
self.headers = [HeaderEntry(header_data) for header_data in headers]
|
|
27
26
|
self.patients = [PatientEntry(patient_data) for patient_data in patients]
|
|
28
27
|
|
{fhir_sheets-2.0.0 → fhir_sheets-2.1.1}/src/fhir_sheets/core/model/resource_definition_entity.py
RENAMED
|
@@ -17,4 +17,4 @@ class ResourceDefinition:
|
|
|
17
17
|
self.profiles = entity_data.get('Profile(s)')
|
|
18
18
|
|
|
19
19
|
def __repr__(self) -> str:
|
|
20
|
-
return f"
|
|
20
|
+
return f"ResourceDefinition(entity_name='{self.entity_name}', resource_type='{self.resource_type}', profiles={self.profiles})"
|
|
@@ -140,8 +140,6 @@ def process_sheet_patient_data_revised(sheet, resource_definition_entities):
|
|
|
140
140
|
needed_count = len(values) - len(patients)
|
|
141
141
|
patients.extend([{}] * needed_count)
|
|
142
142
|
for patient_dict, value in zip(patients, values):
|
|
143
|
-
patient_dict[field_name] =
|
|
144
|
-
patient_dict[field_name]["entity_name"] = entity_name
|
|
145
|
-
patient_dict[field_name]["value"] = value
|
|
143
|
+
patient_dict[(entity_name, field_name)] = value
|
|
146
144
|
cohort_data = CohortData(headers=headers, patients=patients)
|
|
147
145
|
return cohort_data
|
|
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
|