phc-ingestion 0.10.5__tar.gz → 0.10.7__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.
Files changed (64) hide show
  1. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/PKG-INFO +1 -1
  2. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nebula/manifest_assembler.py +40 -20
  3. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/pyproject.toml +1 -1
  4. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/PYPI.md +0 -0
  5. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/__init__.py +0 -0
  6. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/__init__.py +0 -0
  7. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/process.py +0 -0
  8. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/__init__.py +0 -0
  9. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/cnv.py +0 -0
  10. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/detect_genome_ref.py +0 -0
  11. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/hla.py +0 -0
  12. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/ihc.py +0 -0
  13. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/interpretation.py +0 -0
  14. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/json.py +0 -0
  15. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/metadata.py +0 -0
  16. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/specimen_details.py +0 -0
  17. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/structural.py +0 -0
  18. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/tests.py +0 -0
  19. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/tmb.py +0 -0
  20. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/tsv.py +0 -0
  21. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/caris/util/vcf.py +0 -0
  22. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/__init__.py +0 -0
  23. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/process.py +0 -0
  24. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/util/__init__.py +0 -0
  25. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/util/cnv.py +0 -0
  26. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/util/fnv.py +0 -0
  27. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/util/ga4gh.py +0 -0
  28. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/util/interpretation.py +0 -0
  29. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/foundation/util/vcf_etl.py +0 -0
  30. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/generic/__init__.py +0 -0
  31. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/generic/process.py +0 -0
  32. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/generic/utils.py +0 -0
  33. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nebula/__init__.py +0 -0
  34. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nebula/constants.py +0 -0
  35. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nebula/process.py +0 -0
  36. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/__init__.py +0 -0
  37. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/process.py +0 -0
  38. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/alteration_table.py +0 -0
  39. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/interpretation.py +0 -0
  40. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/manifest_helpers.py +0 -0
  41. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/nextgen_specific_genes.py +0 -0
  42. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/pre_filter_somatic_vcf.py +0 -0
  43. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/process_cnv.py +0 -0
  44. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/process_manifest.py +0 -0
  45. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/process_structural.py +0 -0
  46. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/process_vcf.py +0 -0
  47. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/nextgen/util/types.py +0 -0
  48. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/resources/GRCh37_map.csv.gz +0 -0
  49. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/resources/GRCh38_map.csv.gz +0 -0
  50. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/__init__.py +0 -0
  51. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/coords_to_genes.py +0 -0
  52. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/ga4gh.py +0 -0
  53. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/gene_to_coords.py +0 -0
  54. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/lambda_client.py +0 -0
  55. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/open_maybe_gzipped.py +0 -0
  56. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/tar.py +0 -0
  57. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/shared_util/types.py +0 -0
  58. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/vcf_standardization/Variant.py +0 -0
  59. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/vcf_standardization/__init__.py +0 -0
  60. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/vcf_standardization/standardize.py +0 -0
  61. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/vcf_standardization/util/__init__.py +0 -0
  62. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/vcf_standardization/util/af_helpers.py +0 -0
  63. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/vcf_standardization/util/dp_helpers.py +0 -0
  64. {phc-ingestion-0.10.5 → phc-ingestion-0.10.7}/ingestion/vcf_standardization/util/read_write.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phc-ingestion
3
- Version: 0.10.5
3
+ Version: 0.10.7
4
4
  Summary: Functions for LifeOmic PHC genomic ingestions
5
5
  License: MIT
6
6
  Author-email: LifeOmic Development <development@lifeomic.com>
@@ -9,6 +9,7 @@ from ingestion.nebula.constants import (
9
9
  NEBULA_BODY_SITE,
10
10
  NEBULA_INDICATION,
11
11
  )
12
+ import re
12
13
 
13
14
 
14
15
  class HumanName(TypedDict):
@@ -71,9 +72,16 @@ class ManifestAssembler:
71
72
 
72
73
  response = self.client.invoke(path, "get", None, params)
73
74
  entries = response.get("entry", [])
74
- patient = entries[0]["resource"] if len(entries) > 0 else None
75
75
 
76
- return patient
76
+ if len(entries) == 0:
77
+ return None
78
+
79
+ if len(entries) > 1:
80
+ raise RuntimeError(
81
+ f"Found {len(entries)} patients with kit id {self.kit_id}. Expected 1."
82
+ )
83
+
84
+ return entries[0]["resource"]
77
85
 
78
86
  def __fetch_resource_by_type_and_reference(
79
87
  self,
@@ -91,30 +99,42 @@ class ManifestAssembler:
91
99
  except RuntimeError:
92
100
  return None
93
101
 
94
- def __extract_identifier_from_resource(self, resource: Resource | None) -> str:
95
- if not resource:
96
- return ""
97
-
102
+ def __extract_identifier_from_resource(self, resource: Resource) -> str:
98
103
  identifiers = resource.get("identifier", [])
99
104
  return identifiers[0].get("value", "") if identifiers else ""
100
105
 
101
106
  def __extract_id_from_reference(self, reference: Reference) -> str:
102
- if not reference or not reference.get("reference"):
103
- return ""
107
+ ref_string = reference.get("reference", "")
108
+ parts = ref_string.split("/")
109
+ return parts[1] if len(parts) > 1 else parts[0]
104
110
 
105
- ref_string = reference.get("reference")
106
- if not ref_string:
111
+ def __extract_elation_mrn(self, patient: Patient) -> str:
112
+ identifier = next(
113
+ (
114
+ x
115
+ for x in patient.get("identifier", [])
116
+ # if matches LRN format for Elation
117
+ if re.search(
118
+ f"lrn:lo:(dev|us):{self.account_id}:ehr:{self.account_id}:{self.project_id}/Patient",
119
+ x.get("system", ""),
120
+ )
121
+ ),
122
+ None,
123
+ )
124
+
125
+ if not identifier:
107
126
  return ""
108
127
 
109
- parts = ref_string.split("/")
110
- return parts[1] if len(parts) > 1 else parts[0]
128
+ return identifier.get("value", "")
111
129
 
112
130
  def __parse_human_name(self, human_name: list[HumanName] | None):
113
- if not human_name or len(human_name) == 0:
114
- return None
131
+ if not human_name:
132
+ return {}
133
+
134
+ human_name = next((x for x in human_name if x.get("use") == "official"), human_name[0])
115
135
 
116
- last_name = human_name[0].get("family", "")
117
- first_name = human_name[0].get("given", [])[0]
136
+ last_name = human_name.get("family", "")
137
+ first_name = human_name.get("given", [])[0]
118
138
 
119
139
  return {
120
140
  "lastName": last_name,
@@ -149,7 +169,7 @@ class ManifestAssembler:
149
169
  "indexedDate": datetime.now().strftime("%Y-%m-%d"),
150
170
  "reference": "GRCh38",
151
171
  "patientId": patient.get("id"),
152
- "mrn": patient.get("id"),
172
+ "mrn": self.__extract_elation_mrn(patient),
153
173
  "bodySite": NEBULA_BODY_SITE,
154
174
  "bodySiteDisplay": NEBULA_BODY_SITE,
155
175
  "bodySiteSystem": BODY_SITE_SYSTEM,
@@ -157,10 +177,10 @@ class ManifestAssembler:
157
177
  "indication": NEBULA_INDICATION,
158
178
  "indicationDisplay": NEBULA_INDICATION,
159
179
  "patientInfo": {
160
- "lastName": patient_info.get("lastName"),
180
+ "lastName": patient_info.get("lastName", ""),
161
181
  "dob": datetime.fromisoformat(patient_birth_date).strftime("%Y-%m-%d"),
162
- "firstName": patient_info.get("firstName"),
163
- "gender": patient["gender"],
182
+ "firstName": patient_info.get("firstName", ""),
183
+ "gender": patient.get("gender", ""),
164
184
  },
165
185
  **(
166
186
  {
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "phc-ingestion"
3
- version = "0.10.5"
3
+ version = "0.10.7"
4
4
  description = "Functions for LifeOmic PHC genomic ingestions"
5
5
  authors = [
6
6
  { name = "LifeOmic Development", email = "development@lifeomic.com" },
File without changes