phc-ingestion 0.10.7__py3-none-any.whl → 0.10.9__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.
@@ -103,11 +103,22 @@ class ManifestAssembler:
103
103
  identifiers = resource.get("identifier", [])
104
104
  return identifiers[0].get("value", "") if identifiers else ""
105
105
 
106
- def __extract_id_from_reference(self, reference: Reference) -> str:
107
- ref_string = reference.get("reference", "")
106
+ def __extract_id_from_reference(self, reference: Reference | None) -> str:
107
+ if not reference:
108
+ return ""
109
+
110
+ ref_string = reference.get("reference")
111
+ if not ref_string:
112
+ return ""
113
+
108
114
  parts = ref_string.split("/")
109
115
  return parts[1] if len(parts) > 1 else parts[0]
110
116
 
117
+ def __extract_id_from_reference_list(self, references: list[Reference] | None) -> str:
118
+ if not references or len(references) == 0:
119
+ return ""
120
+ return self.__extract_id_from_reference(references[0])
121
+
111
122
  def __extract_elation_mrn(self, patient: Patient) -> str:
112
123
  identifier = next(
113
124
  (
@@ -149,17 +160,22 @@ class ManifestAssembler:
149
160
  raise RuntimeError(f"Patient with kit id {self.kit_id} not found")
150
161
  patient_birth_date = patient.get("birthDate")
151
162
  if not patient_birth_date:
152
- raise RuntimeError("Patient birth date is a required to create a manifest")
163
+ raise RuntimeError("Patient birth date is required to create a manifest")
153
164
 
154
165
  organization: Organization | None = self.__fetch_resource_by_type_and_reference(
155
166
  "Organization", patient.get("managingOrganization")
156
167
  )
157
168
 
158
- general_practitioner: Practitioner | None = self.__fetch_resource_by_type_and_reference(
159
- "Practitioner", patient.get("generalPractitioner")
160
- )
169
+ # Handle generalPractitioner as a list
170
+ general_practitioner: Practitioner | None = None
171
+ general_practitioner_refs: list[Reference] = patient.get("generalPractitioner", [])
172
+ if general_practitioner_refs:
173
+ general_practitioner = self.__fetch_resource_by_type_and_reference(
174
+ "Practitioner",
175
+ {"reference": self.__extract_id_from_reference_list(general_practitioner_refs)},
176
+ )
161
177
 
162
- patient_info = self.__parse_human_name(patient["name"])
178
+ patient_info = self.__parse_human_name(patient.get("name"))
163
179
  practitioner_info = self.__parse_human_name(
164
180
  general_practitioner.get("name") if general_practitioner else None
165
181
  )
@@ -1,6 +1,7 @@
1
1
  import os
2
2
 
3
3
  from ingestion.nebula.constants import NEBULA_TEST_TYPE
4
+ from ingestion.shared_util.ga4gh import create_yaml
4
5
  from ingestion.vcf_standardization.standardize import standardize_vcf
5
6
  from lifeomic_logging import scoped_logger
6
7
  from ingestion.nebula.manifest_assembler import ManifestAssembler
@@ -43,6 +44,8 @@ def process(vcf_file, out_path, file_name, source_file_id, ingestion_id, account
43
44
  }
44
45
  ]
45
46
 
47
+ create_yaml(manifest, file_name)
48
+
46
49
  # Hard-code genome reference for Nebula VCFs
47
50
  genome_reference = "GRCh38"
48
51
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phc-ingestion
3
- Version: 0.10.7
3
+ Version: 0.10.9
4
4
  Summary: Functions for LifeOmic PHC genomic ingestions
5
5
  License: MIT
6
6
  Author-email: LifeOmic Development <development@lifeomic.com>
@@ -28,8 +28,8 @@ ingestion/generic/process.py,sha256=ZaVnZ_gx9faDUsuresI1A0oCegTa-dPQT7DBFMeZGyY,
28
28
  ingestion/generic/utils.py,sha256=1MEIru7uq38IjUdL8lcHqDH0oTki9uWrz1f2e-pmRoU,2814
29
29
  ingestion/nebula/__init__.py,sha256=VauK-rup_N8ZXVohx3HYqHX_PE_WoPyMUhdv2R7al4o,45
30
30
  ingestion/nebula/constants.py,sha256=thKqSwemdaAwAmKvF4FEVI9l1Ph5ergsnMlx6nWte7E,357
31
- ingestion/nebula/manifest_assembler.py,sha256=N_19PLdbm9GaptsYfK1whTmVas5qZEtZC6VId_EFVy0,6353
32
- ingestion/nebula/process.py,sha256=D2ct9tF60ZIP_jZdjvgjfTkhEAkNNEhxaSqa04CtNR8,2237
31
+ ingestion/nebula/manifest_assembler.py,sha256=NaFxmWYiIUXOabP8TTaH3JkvwELVB7Z-TUMN4j_MoaM,6972
32
+ ingestion/nebula/process.py,sha256=NhlaMl6q2nTocWZvTUVMKaq1IghiZKyqSjnWApchnAU,2331
33
33
  ingestion/nextgen/__init__.py,sha256=7LQ-h_Bvc5P1QcHMdzsqi1Qm4fTJn04-ozar2ty9wSc,59
34
34
  ingestion/nextgen/process.py,sha256=5Z0RfclwTAYZruGDiLPutjPCYFh1DJpoWY9dnttghT4,3993
35
35
  ingestion/nextgen/util/alteration_table.py,sha256=JTWBL1Fqj_pGsH5vwuVEnCUJle2wOBk6VYImHYCF9vg,6129
@@ -59,6 +59,6 @@ ingestion/vcf_standardization/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
59
59
  ingestion/vcf_standardization/util/af_helpers.py,sha256=dpTzoeIQVeBRt0ETF3a9rp5ojZqznHg4x_hCZ8OPcOg,1061
60
60
  ingestion/vcf_standardization/util/dp_helpers.py,sha256=Nq8oLOLObu4_pv16qwwgpALRlUoJVCULrd9cFOD-eoI,823
61
61
  ingestion/vcf_standardization/util/read_write.py,sha256=x3Pf6Dq8tmolblbCS5CrNmrcHS3FGfqBSFpFgvFGC4g,2526
62
- phc_ingestion-0.10.7.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
63
- phc_ingestion-0.10.7.dist-info/METADATA,sha256=fPt-rGHMt6ORmjrw1xKM8MDarx9A_b_no3B9UeurMRw,677
64
- phc_ingestion-0.10.7.dist-info/RECORD,,
62
+ phc_ingestion-0.10.9.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
63
+ phc_ingestion-0.10.9.dist-info/METADATA,sha256=5qVLQFXYsuhBOyl6rtGdZ-_YHSCBeX1Zyut3QiMJnI4,677
64
+ phc_ingestion-0.10.9.dist-info/RECORD,,