fhir-sheets 2.0.0__py3-none-any.whl → 2.1.0__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.
@@ -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
- key: value
73
- for key, value in cohort_data.patients[index].entries.items()
74
- if value['entity_name'] == resource_definition.entity_name
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, dataelement in dataelements_for_resourcename.items():
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, dataelement['value'])
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
 
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fhir-sheets
3
- Version: 2.0.0
3
+ Version: 2.1.0
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
@@ -2,15 +2,15 @@ fhir_sheets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  fhir_sheets/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  fhir_sheets/cli/main.py,sha256=OPuiQtWgmPbN_uErdSDgnAllFlMWO43A9ZhvAY9-dN8,2675
4
4
  fhir_sheets/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- fhir_sheets/core/conversion.py,sha256=ntxBlMbC3l31QKnTHS2P55_RuHMHqzyh_HplZJStKZg,19331
5
+ fhir_sheets/core/conversion.py,sha256=BcIPmEImW6QvKhUsp0ycPbT6QYHj_tjU0ajubsvFohg,19330
6
6
  fhir_sheets/core/fhir_formatting.py,sha256=eNM38Cp7TEdND1fIKhp2HTwzGYDqgWtr13A1qRT06cY,13011
7
- fhir_sheets/core/model/cohort_data_entity.py,sha256=4LJ32A9BBAsK0SIWIlbHPr7Ke3it2VEroHKgCIsk4eI,1374
7
+ fhir_sheets/core/model/cohort_data_entity.py,sha256=tRfHxuZdXvSk-OerPpbCBEfJJAo6f1L-If-p0ltC51Q,1382
8
8
  fhir_sheets/core/model/resource_definition_entity.py,sha256=NYOBjGz2LyfjI9LVl7j34fcAp-qEmzrBTg9ZLpFfDxA,738
9
9
  fhir_sheets/core/model/resource_link_entity.py,sha256=-iCzGaKJt5ZISTSwBVmEuLIKzgRtbL_I7JRpoEc89h0,812
10
- fhir_sheets/core/read_input.py,sha256=WHA-OfU8mOn3Ty1ofzcnGgvAx5IaPuEDKywoBBwR_pw,8253
10
+ fhir_sheets/core/read_input.py,sha256=ErChyIfadNKtWYOgM3hDO04btNe0T0xcFwzcUrcEYTQ,8149
11
11
  fhir_sheets/core/special_values.py,sha256=k2HcKaFlx41zMeIC-p-0DEtvqOWLT3tnMtyFX1XXXW8,15304
12
12
  fhir_sheets/core/util.py,sha256=gudEPi_xTDC9YHqUlGEkn_tA26HbhNjuqGgjtuOEINk,9
13
- fhir_sheets-2.0.0.dist-info/METADATA,sha256=FIfJJt7PORyICjv61E8Bombhy7sdpSEs0YHZsxHHMFY,2911
14
- fhir_sheets-2.0.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
15
- fhir_sheets-2.0.0.dist-info/licenses/LICENSE,sha256=Qv2ilebwoUtMJnRsZwRy729xS5JZQzLauJ0tQzkAkTA,1088
16
- fhir_sheets-2.0.0.dist-info/RECORD,,
13
+ fhir_sheets-2.1.0.dist-info/METADATA,sha256=Sa2ZBZJkuhtKzoukatr1ElKXR-IhdSSdoVMnKJqq0OY,2911
14
+ fhir_sheets-2.1.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
15
+ fhir_sheets-2.1.0.dist-info/licenses/LICENSE,sha256=Qv2ilebwoUtMJnRsZwRy729xS5JZQzLauJ0tQzkAkTA,1088
16
+ fhir_sheets-2.1.0.dist-info/RECORD,,