phc-ingestion 0.10.4__tar.gz → 0.10.6__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 (65) hide show
  1. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/PKG-INFO +1 -1
  2. phc-ingestion-0.10.6/ingestion/nebula/constants.py +7 -0
  3. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nebula/manifest_assembler.py +53 -16
  4. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/pyproject.toml +1 -1
  5. phc-ingestion-0.10.4/ingestion/nebula/constants.py +0 -1
  6. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/PYPI.md +0 -0
  7. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/__init__.py +0 -0
  8. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/__init__.py +0 -0
  9. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/process.py +0 -0
  10. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/__init__.py +0 -0
  11. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/cnv.py +0 -0
  12. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/detect_genome_ref.py +0 -0
  13. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/hla.py +0 -0
  14. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/ihc.py +0 -0
  15. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/interpretation.py +0 -0
  16. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/json.py +0 -0
  17. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/metadata.py +0 -0
  18. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/specimen_details.py +0 -0
  19. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/structural.py +0 -0
  20. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/tests.py +0 -0
  21. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/tmb.py +0 -0
  22. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/tsv.py +0 -0
  23. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/caris/util/vcf.py +0 -0
  24. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/__init__.py +0 -0
  25. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/process.py +0 -0
  26. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/util/__init__.py +0 -0
  27. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/util/cnv.py +0 -0
  28. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/util/fnv.py +0 -0
  29. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/util/ga4gh.py +0 -0
  30. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/util/interpretation.py +0 -0
  31. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/foundation/util/vcf_etl.py +0 -0
  32. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/generic/__init__.py +0 -0
  33. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/generic/process.py +0 -0
  34. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/generic/utils.py +0 -0
  35. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nebula/__init__.py +0 -0
  36. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nebula/process.py +0 -0
  37. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/__init__.py +0 -0
  38. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/process.py +0 -0
  39. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/alteration_table.py +0 -0
  40. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/interpretation.py +0 -0
  41. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/manifest_helpers.py +0 -0
  42. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/nextgen_specific_genes.py +0 -0
  43. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/pre_filter_somatic_vcf.py +0 -0
  44. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/process_cnv.py +0 -0
  45. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/process_manifest.py +0 -0
  46. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/process_structural.py +0 -0
  47. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/process_vcf.py +0 -0
  48. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/nextgen/util/types.py +0 -0
  49. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/resources/GRCh37_map.csv.gz +0 -0
  50. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/resources/GRCh38_map.csv.gz +0 -0
  51. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/__init__.py +0 -0
  52. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/coords_to_genes.py +0 -0
  53. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/ga4gh.py +0 -0
  54. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/gene_to_coords.py +0 -0
  55. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/lambda_client.py +0 -0
  56. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/open_maybe_gzipped.py +0 -0
  57. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/tar.py +0 -0
  58. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/shared_util/types.py +0 -0
  59. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/vcf_standardization/Variant.py +0 -0
  60. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/vcf_standardization/__init__.py +0 -0
  61. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/vcf_standardization/standardize.py +0 -0
  62. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/vcf_standardization/util/__init__.py +0 -0
  63. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/vcf_standardization/util/af_helpers.py +0 -0
  64. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/ingestion/vcf_standardization/util/dp_helpers.py +0 -0
  65. {phc-ingestion-0.10.4 → phc-ingestion-0.10.6}/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.4
3
+ Version: 0.10.6
4
4
  Summary: Functions for LifeOmic PHC genomic ingestions
5
5
  License: MIT
6
6
  Author-email: LifeOmic Development <development@lifeomic.com>
@@ -0,0 +1,7 @@
1
+ NEBULA_TEST_TYPE = "WGS-30x"
2
+ DATASET_SYSTEM = "http://lifeomic.com/fhir/dataset"
3
+ NEBULA_KIT_ID_SYSTEM = "http://lifeomic.com/fhir/nebula-kit-id"
4
+ BODY_SITE_SYSTEM = "http://lifeomic.com/fhir/sequence-body-site"
5
+ NEBULA_BODY_SITE = "Buccal Swab"
6
+ INDICATION_SYSTEM = "http://lifeomic.com/fhir/sequence-indication"
7
+ NEBULA_INDICATION = "Genetic Health Screening"
@@ -1,6 +1,15 @@
1
1
  from typing import Optional, TypedDict, Any
2
2
  from datetime import datetime
3
3
  from ingestion.shared_util.lambda_client import LambdaClient
4
+ from ingestion.nebula.constants import (
5
+ DATASET_SYSTEM,
6
+ NEBULA_KIT_ID_SYSTEM,
7
+ BODY_SITE_SYSTEM,
8
+ INDICATION_SYSTEM,
9
+ NEBULA_BODY_SITE,
10
+ NEBULA_INDICATION,
11
+ )
12
+ import re
4
13
 
5
14
 
6
15
  class HumanName(TypedDict):
@@ -57,8 +66,8 @@ class ManifestAssembler:
57
66
  def __fetch_patient_by_kit_id(self) -> Optional[Patient]:
58
67
  path = f"/{self.account_id}/dstu3/Patient"
59
68
  params = {
60
- "_tag": f"http://lifeomic.com/fhir/dataset|{self.project_id}",
61
- "identifier": f"http://lifeomic.com/fhir/nebula-kit-id|{self.kit_id}",
69
+ "_tag": f"{DATASET_SYSTEM}|{self.project_id}",
70
+ "identifier": f"{NEBULA_KIT_ID_SYSTEM}|{self.kit_id}",
62
71
  }
63
72
 
64
73
  response = self.client.invoke(path, "get", None, params)
@@ -80,7 +89,7 @@ class ManifestAssembler:
80
89
 
81
90
  try:
82
91
  return self.client.invoke(path, "get")
83
- except RuntimeError as e:
92
+ except RuntimeError:
84
93
  return None
85
94
 
86
95
  def __extract_identifier_from_resource(self, resource: Resource | None) -> str:
@@ -91,7 +100,7 @@ class ManifestAssembler:
91
100
  return identifiers[0].get("value", "") if identifiers else ""
92
101
 
93
102
  def __extract_id_from_reference(self, reference: Reference) -> str:
94
- if not reference or not reference.get("reference"):
103
+ if not reference:
95
104
  return ""
96
105
 
97
106
  ref_string = reference.get("reference")
@@ -101,12 +110,39 @@ class ManifestAssembler:
101
110
  parts = ref_string.split("/")
102
111
  return parts[1] if len(parts) > 1 else parts[0]
103
112
 
113
+ def __extract_elation_mrn(self, patient: Patient) -> str:
114
+ if not patient:
115
+ return ""
116
+
117
+ identifier = next(
118
+ (
119
+ x
120
+ for x in patient.get("identifier", [])
121
+ # if matches LRN format for Elation
122
+ if re.search(
123
+ f"lrn:lo:(dev|us):{self.account_id}:ehr:{self.account_id}:{self.project_id}/Patient",
124
+ x.get("system", ""),
125
+ )
126
+ ),
127
+ None,
128
+ )
129
+
130
+ if not identifier:
131
+ return ""
132
+
133
+ return identifier.get("value", "")
134
+
104
135
  def __parse_human_name(self, human_name: list[HumanName] | None):
105
- if not human_name or len(human_name) == 0:
136
+ if not human_name:
137
+ return None
138
+
139
+ human_name = next((x for x in human_name if x.get("use") == "official"), None)
140
+
141
+ if not human_name:
106
142
  return None
107
143
 
108
- last_name = human_name[0].get("family", "")
109
- first_name = human_name[0].get("given", [])[0]
144
+ last_name = human_name.get("family", "")
145
+ first_name = human_name.get("given", [])[0]
110
146
 
111
147
  return {
112
148
  "lastName": last_name,
@@ -121,7 +157,7 @@ class ManifestAssembler:
121
157
  raise RuntimeError(f"Patient with kit id {self.kit_id} not found")
122
158
  patient_birth_date = patient.get("birthDate")
123
159
  if not patient_birth_date:
124
- raise RuntimeError(f"Patient birth date is a required to create a manifest")
160
+ raise RuntimeError("Patient birth date is a required to create a manifest")
125
161
 
126
162
  organization: Organization | None = self.__fetch_resource_by_type_and_reference(
127
163
  "Organization", patient.get("managingOrganization")
@@ -139,14 +175,15 @@ class ManifestAssembler:
139
175
  return {
140
176
  "name": "Nebula",
141
177
  "indexedDate": datetime.now().strftime("%Y-%m-%d"),
142
- "reference": "GRCh38", # TODO: Get from project?
143
- "mrn": patient.get("id"),
144
- "bodySite": "Buccal Swab",
145
- "bodySiteDisplay": "Buccal Swab",
146
- "bodySiteSystem": "http://lifeomic.com/fhir/sequence-body-site",
147
- "indicationSystem": "http://lifeomic.com/fhir/sequence-indication",
148
- "indication": "Genetic Health Screening",
149
- "indicationDisplay": "Genetic Health Screening",
178
+ "reference": "GRCh38",
179
+ "patientId": patient.get("id"),
180
+ "mrn": self.__extract_elation_mrn(patient),
181
+ "bodySite": NEBULA_BODY_SITE,
182
+ "bodySiteDisplay": NEBULA_BODY_SITE,
183
+ "bodySiteSystem": BODY_SITE_SYSTEM,
184
+ "indicationSystem": INDICATION_SYSTEM,
185
+ "indication": NEBULA_INDICATION,
186
+ "indicationDisplay": NEBULA_INDICATION,
150
187
  "patientInfo": {
151
188
  "lastName": patient_info.get("lastName"),
152
189
  "dob": datetime.fromisoformat(patient_birth_date).strftime("%Y-%m-%d"),
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "phc-ingestion"
3
- version = "0.10.4"
3
+ version = "0.10.6"
4
4
  description = "Functions for LifeOmic PHC genomic ingestions"
5
5
  authors = [
6
6
  { name = "LifeOmic Development", email = "development@lifeomic.com" },
@@ -1 +0,0 @@
1
- NEBULA_TEST_TYPE = "WGS-30x"
File without changes