nmdc-runtime 2.0.1__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.

Potentially problematic release.


This version of nmdc-runtime might be problematic. Click here for more details.

nmdc_runtime/site/ops.py CHANGED
@@ -1134,6 +1134,7 @@ def materialize_alldocs(context) -> int:
1134
1134
  # /data_objects/study/{study_id} endpoint
1135
1135
  mdb.alldocs.create_index("has_input")
1136
1136
  mdb.alldocs.create_index("has_output")
1137
+ mdb.alldocs.create_index("was_informed_by")
1137
1138
  context.log.info(
1138
1139
  f"refreshed {mdb.alldocs} collection with {mdb.alldocs.estimated_document_count()} docs."
1139
1140
  )
@@ -108,7 +108,9 @@ class GoldStudyTranslator(Translator):
108
108
  for id in self._project_ids_by_biosample_id[gold_biosample_id]
109
109
  )
110
110
  return [
111
- self._get_curie("biosample", project["ncbiBioSampleAccession"])
111
+ self._ensure_curie(
112
+ project["ncbiBioSampleAccession"], default_prefix="biosample"
113
+ )
112
114
  for project in biosample_projects
113
115
  if project["ncbiBioSampleAccession"]
114
116
  ]
@@ -471,7 +473,9 @@ class GoldStudyTranslator(Translator):
471
473
  """
472
474
  return nmdc.Study(
473
475
  description=gold_study.get("description"),
474
- gold_study_identifiers=self._get_curie("gold", gold_study["studyGoldId"]),
476
+ gold_study_identifiers=self._ensure_curie(
477
+ gold_study["studyGoldId"], default_prefix="gold"
478
+ ),
475
479
  id=nmdc_study_id,
476
480
  name=gold_study.get("studyName"),
477
481
  principal_investigator=self._get_pi(gold_study),
@@ -522,7 +526,9 @@ class GoldStudyTranslator(Translator):
522
526
  env_local_scale=self._get_env_term_value(gold_biosample, "envoLocalScale"),
523
527
  env_medium=self._get_env_term_value(gold_biosample, "envoMedium"),
524
528
  geo_loc_name=self._get_text_value(gold_biosample, "geoLocation"),
525
- gold_biosample_identifiers=self._get_curie("gold", gold_biosample_id),
529
+ gold_biosample_identifiers=self._ensure_curie(
530
+ gold_biosample_id, default_prefix="gold"
531
+ ),
526
532
  habitat=gold_biosample.get("habitat"),
527
533
  host_name=gold_biosample.get("hostName"),
528
534
  host_taxid=self._get_host_taxid(gold_biosample),
@@ -579,8 +585,8 @@ class GoldStudyTranslator(Translator):
579
585
  return nmdc.NucleotideSequencing(
580
586
  id=nmdc_nucleotide_sequencing_id,
581
587
  name=gold_project.get("projectName"),
582
- gold_sequencing_project_identifiers=self._get_curie(
583
- "gold", gold_project_id
588
+ gold_sequencing_project_identifiers=self._ensure_curie(
589
+ gold_project_id, default_prefix="gold"
584
590
  ),
585
591
  ncbi_project_name=gold_project.get("projectName"),
586
592
  type="nmdc:NucleotideSequencing",
@@ -189,7 +189,21 @@ class SubmissionPortalTranslator(Translator):
189
189
  if not gold_study_id:
190
190
  return None
191
191
 
192
- return [self._get_curie("GOLD", gold_study_id)]
192
+ return [self._ensure_curie(gold_study_id, default_prefix="gold")]
193
+
194
+ def _get_jgi_study_identifiers(
195
+ self, metadata_submission: JSON_OBJECT
196
+ ) -> Union[List[str], None]:
197
+ """Construct a JGI proposal CURIE from the multiomics from data
198
+
199
+ :param metadata_submission: submission portal entry
200
+ :return: JGI proposal CURIE
201
+ """
202
+ jgi_study_id = get_in(["multiOmicsForm", "JGIStudyId"], metadata_submission)
203
+ if not jgi_study_id:
204
+ return None
205
+
206
+ return [self._ensure_curie(jgi_study_id, default_prefix="jgi.proposal")]
193
207
 
194
208
  def _get_quantity_value(
195
209
  self, raw_value: Optional[str], unit: Optional[str] = None
@@ -410,9 +424,6 @@ class SubmissionPortalTranslator(Translator):
410
424
  :return: nmdc:Study object
411
425
  """
412
426
  return nmdc.Study(
413
- alternative_identifiers=self._get_from(
414
- metadata_submission, ["multiOmicsForm", "JGIStudyId"]
415
- ),
416
427
  alternative_names=self._get_from(
417
428
  metadata_submission, ["multiOmicsForm", "alternativeNames"]
418
429
  ),
@@ -436,6 +447,9 @@ class SubmissionPortalTranslator(Translator):
436
447
  insdc_bioproject_identifiers=self._get_from(
437
448
  metadata_submission, ["multiOmicsForm", "NCBIBioProjectId"]
438
449
  ),
450
+ jgi_portal_study_identifiers=self._get_jgi_study_identifiers(
451
+ metadata_submission
452
+ ),
439
453
  name=self._get_from(metadata_submission, ["studyForm", "studyName"]),
440
454
  notes=self._get_from(metadata_submission, ["studyForm", "notes"]),
441
455
  principal_investigator=self._get_pi(metadata_submission),
@@ -14,8 +14,15 @@ class Translator(ABC):
14
14
  def _index_by_id(self, collection, id):
15
15
  return {item[id]: item for item in collection}
16
16
 
17
- def _get_curie(self, prefix: str, local: str) -> str:
18
- return f"{prefix}:{local}"
17
+ @staticmethod
18
+ def _ensure_curie(identifier: str, *, default_prefix: str) -> str:
19
+ identifier_parts = identifier.split(":", 1)
20
+
21
+ # Don't add prefix if identifier is already a CURIE
22
+ if len(identifier_parts) == 2:
23
+ return identifier
24
+
25
+ return f"{default_prefix}:{identifier_parts[0]}"
19
26
 
20
27
  @abstractmethod
21
28
  def get_database(self) -> nmdc.Database:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nmdc_runtime
3
- Version: 2.0.1
3
+ Version: 2.1.0
4
4
  Summary: A runtime system for NMDC data management and orchestration
5
5
  Home-page: https://github.com/microbiomedata/nmdc-runtime
6
6
  Author: Donny Winston
@@ -114,7 +114,9 @@ cp .env.example .env
114
114
  Create environment variables in your shell session, based upon the contents of the `.env` file.
115
115
 
116
116
  ```shell
117
- export $(grep -v '^#' .env | xargs)
117
+ set -a # automatically export all variables
118
+ source .env
119
+ set +a
118
120
  ```
119
121
 
120
122
  If you are connecting to resources that require an SSH tunnel—for example, a MongoDB server that is only accessible on the NERSC network—set up the SSH tunnel.
@@ -37,7 +37,7 @@ nmdc_runtime/minter/entrypoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
37
37
  nmdc_runtime/minter/entrypoints/fastapi_app.py,sha256=JC4thvzfFwRc1mhWQ-kHy3yvs0SYxF6ktE7LXNCwqlI,4031
38
38
  nmdc_runtime/site/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  nmdc_runtime/site/graphs.py,sha256=ZHglSPwVHfXzdgR2CGvmbzLLbmsijloU58XvIe9Thjs,13996
40
- nmdc_runtime/site/ops.py,sha256=EOR4VjRoFoaI2odKRgcgtGxngPsx2U0H45zzWrvQzf8,44603
40
+ nmdc_runtime/site/ops.py,sha256=6P3kn4BygY8LKD_OpfKX2U0AYQKDlB2jw12Yn-hEmD0,44651
41
41
  nmdc_runtime/site/repository.py,sha256=rDtwUjozhyOxlkuF9HvaheOQDQWkgZYqVtsB50BcUp4,39121
42
42
  nmdc_runtime/site/resources.py,sha256=ZSH1yvA-li0R7Abc22_v0XLbjBYf5igETr2G01J3hnc,17557
43
43
  nmdc_runtime/site/util.py,sha256=zAY0oIY7GRf63ecqWelmS27N7PVrAXVwEhtnpescBSw,1415
@@ -59,23 +59,23 @@ nmdc_runtime/site/normalization/gold.py,sha256=iISDD4qs4d6uLhv631WYNeQVOzY5DO201
59
59
  nmdc_runtime/site/translation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  nmdc_runtime/site/translation/emsl.py,sha256=-aCTJTSCNaK-Koh8BE_4fTf5nyxP1KkquR6lloLEJl0,1245
61
61
  nmdc_runtime/site/translation/gold.py,sha256=R3W99sdQb7Pgu_esN7ruIC-tyREQD_idJ4xCzkqWuGw,1622
62
- nmdc_runtime/site/translation/gold_translator.py,sha256=ln0BXI2v7pTgui3uNbl8tU1iOkfDZH4Z8SCaFLuuTI8,29438
62
+ nmdc_runtime/site/translation/gold_translator.py,sha256=wkl1WwJ45EFwz73l_-t0D9Y3SilctDC1obTieY0eqxM,29600
63
63
  nmdc_runtime/site/translation/jgi.py,sha256=qk878KhIw674TkrVfbl2x1QJrKi3zlvE0vesIpe9slM,876
64
64
  nmdc_runtime/site/translation/neon_benthic_translator.py,sha256=QIDqYLuf-NlGY9_88gy_5qTswkei3OfgJ5AOFpEXzJo,23985
65
65
  nmdc_runtime/site/translation/neon_soil_translator.py,sha256=Rol0g67nVBGSBySUzpfdW4Fwes7bKtvnlv2g5cB0aTI,38550
66
66
  nmdc_runtime/site/translation/neon_surface_water_translator.py,sha256=MQgjIfWPgoRe-bhzyfqHSe2mZwFsjcwjdT8tNqpIhlc,27729
67
67
  nmdc_runtime/site/translation/neon_utils.py,sha256=d00o7duKKugpLHmsEifNbp4WjeC4GOqcgw0b5qlCg4I,5549
68
- nmdc_runtime/site/translation/submission_portal_translator.py,sha256=6QkEfz-RN8y_aHckUWLUuQz3DslbvFck2Vyu7funHrQ,29152
69
- nmdc_runtime/site/translation/translator.py,sha256=xM9dM-nTgSWwu5HFoUVNHf8kqk9iiH4PgWdSx4OKxEk,601
68
+ nmdc_runtime/site/translation/submission_portal_translator.py,sha256=FVBqCvk6NAJIA22IhtFOTyvAQIiFN3KsznHc5zmOG40,29676
69
+ nmdc_runtime/site/translation/translator.py,sha256=V6Aq0y03LoQ4LTL2iHDHxGTh_eMjOmDJJSwNHSrp2wo,837
70
70
  nmdc_runtime/site/translation/util.py,sha256=w_l3SiExGsl6cXRqto0a_ssDmHkP64ITvrOVfPxmNpY,4366
71
71
  nmdc_runtime/site/validation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
72
  nmdc_runtime/site/validation/emsl.py,sha256=OG20mv_3E2rkQqTQtYO0_SVRqFb-Z_zKCiAVbty6Wl0,671
73
73
  nmdc_runtime/site/validation/gold.py,sha256=Z5ZzYdjERbrJ2Tu06d0TDTBSfwaFdL1Z23Rl-YkZ2Ow,803
74
74
  nmdc_runtime/site/validation/jgi.py,sha256=LdJfhqBVHWCDp0Kzyk8eJZMwEI5NQ-zuTda31BcGwOA,1299
75
75
  nmdc_runtime/site/validation/util.py,sha256=GGbMDSwR090sr_E_fHffCN418gpYESaiot6XghS7OYk,3349
76
- nmdc_runtime-2.0.1.dist-info/LICENSE,sha256=VWiv65r7gHGjgtr3jMJYVmQny5GRpQ6H-W9sScb1x70,2408
77
- nmdc_runtime-2.0.1.dist-info/METADATA,sha256=zYs4CYP5zWAJdBu6go5MvGlWUZ1ZD14uFLIDFr6iHss,7302
78
- nmdc_runtime-2.0.1.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
79
- nmdc_runtime-2.0.1.dist-info/entry_points.txt,sha256=JxdvOnvxHK_8046cwlvE30s_fV0-k-eTpQtkKYA69nQ,224
80
- nmdc_runtime-2.0.1.dist-info/top_level.txt,sha256=b0K1s09L_iHH49ueBKaLrB5-lh6cyrSv9vL6x4Qvyz8,13
81
- nmdc_runtime-2.0.1.dist-info/RECORD,,
76
+ nmdc_runtime-2.1.0.dist-info/LICENSE,sha256=VWiv65r7gHGjgtr3jMJYVmQny5GRpQ6H-W9sScb1x70,2408
77
+ nmdc_runtime-2.1.0.dist-info/METADATA,sha256=AfyiRup3egPo7_udHDVKq4gyna0z4C2pfWMz33NeDXw,7329
78
+ nmdc_runtime-2.1.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
79
+ nmdc_runtime-2.1.0.dist-info/entry_points.txt,sha256=JxdvOnvxHK_8046cwlvE30s_fV0-k-eTpQtkKYA69nQ,224
80
+ nmdc_runtime-2.1.0.dist-info/top_level.txt,sha256=b0K1s09L_iHH49ueBKaLrB5-lh6cyrSv9vL6x4Qvyz8,13
81
+ nmdc_runtime-2.1.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.5.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5