nmdc-runtime 1.0.12__py3-none-any.whl → 1.0.14__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/translation/gold_translator.py +30 -19
- {nmdc_runtime-1.0.12.dist-info → nmdc_runtime-1.0.14.dist-info}/METADATA +4 -4
- {nmdc_runtime-1.0.12.dist-info → nmdc_runtime-1.0.14.dist-info}/RECORD +7 -7
- {nmdc_runtime-1.0.12.dist-info → nmdc_runtime-1.0.14.dist-info}/LICENSE +0 -0
- {nmdc_runtime-1.0.12.dist-info → nmdc_runtime-1.0.14.dist-info}/WHEEL +0 -0
- {nmdc_runtime-1.0.12.dist-info → nmdc_runtime-1.0.14.dist-info}/entry_points.txt +0 -0
- {nmdc_runtime-1.0.12.dist-info → nmdc_runtime-1.0.14.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import collections
|
|
2
2
|
import re
|
|
3
|
-
from typing import List, Union
|
|
3
|
+
from typing import List, Tuple, Union
|
|
4
4
|
from nmdc_schema import nmdc
|
|
5
5
|
|
|
6
6
|
from nmdc_runtime.site.translation.translator import JSON_OBJECT, Translator
|
|
@@ -188,37 +188,48 @@ class GoldStudyTranslator(Translator):
|
|
|
188
188
|
def _get_quantity_value(
|
|
189
189
|
self,
|
|
190
190
|
gold_entity: JSON_OBJECT,
|
|
191
|
-
gold_field: str,
|
|
191
|
+
gold_field: Union[str, Tuple[str, str]],
|
|
192
192
|
unit: Union[str, None] = None,
|
|
193
193
|
) -> Union[nmdc.QuantityValue, None]:
|
|
194
194
|
"""Get any field of a GOLD entity object as a QuantityValue
|
|
195
195
|
|
|
196
196
|
This method extracts any single field of a GOLD entity object (study, biosample, etc)
|
|
197
197
|
and if it is not `None` returns it as an `nmdc:QuantityValue`. A has_numeric_value will
|
|
198
|
-
be inferred from the gold_field value in gold_entity
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
`None` will be returned.
|
|
198
|
+
be inferred from the gold_field value in gold_entity if it is a simple string value. If
|
|
199
|
+
it is a tuple of two fields, a has_minimum_numeric_value and has_maximum_numeric_value
|
|
200
|
+
will be inferred from the gold_field values in gold_entity.
|
|
202
201
|
|
|
203
202
|
:param gold_entity: GOLD entity object
|
|
204
|
-
:param gold_field: Name of the field to extract
|
|
203
|
+
:param gold_field: Name of the field to extract, or a tuple of two fields to extract a range
|
|
205
204
|
:param unit: An optional unit as a string, defaults to None
|
|
206
205
|
:return: QuantityValue object
|
|
207
206
|
"""
|
|
207
|
+
if isinstance(gold_field, tuple):
|
|
208
|
+
minimum_numeric_value = gold_entity.get(gold_field[0])
|
|
209
|
+
maximum_numeric_value = gold_entity.get(gold_field[1])
|
|
210
|
+
|
|
211
|
+
if minimum_numeric_value is None and maximum_numeric_value is None:
|
|
212
|
+
return None
|
|
213
|
+
elif minimum_numeric_value is not None and maximum_numeric_value is None:
|
|
214
|
+
return nmdc.QuantityValue(
|
|
215
|
+
has_raw_value=field_value,
|
|
216
|
+
has_numeric_value=nmdc.Double(minimum_numeric_value),
|
|
217
|
+
has_unit=unit,
|
|
218
|
+
)
|
|
219
|
+
else:
|
|
220
|
+
return nmdc.QuantityValue(
|
|
221
|
+
has_minimum_numeric_value=nmdc.Double(minimum_numeric_value),
|
|
222
|
+
has_maximum_numeric_value=nmdc.Double(maximum_numeric_value),
|
|
223
|
+
has_unit=unit,
|
|
224
|
+
)
|
|
225
|
+
|
|
208
226
|
field_value = gold_entity.get(gold_field)
|
|
209
227
|
if field_value is None:
|
|
210
228
|
return None
|
|
211
229
|
|
|
212
|
-
numeric_value = None
|
|
213
|
-
# TODO: in the future we will need better handling
|
|
214
|
-
# to parse out the numerical portion of the quantity value
|
|
215
|
-
# ex. temp might be 3 C, and we will need to parse out 3.0 from it
|
|
216
|
-
if unit == "meters":
|
|
217
|
-
numeric_value = nmdc.Double(field_value)
|
|
218
|
-
|
|
219
230
|
return nmdc.QuantityValue(
|
|
220
231
|
has_raw_value=field_value,
|
|
221
|
-
has_numeric_value=
|
|
232
|
+
has_numeric_value=nmdc.Double(field_value),
|
|
222
233
|
has_unit=unit,
|
|
223
234
|
)
|
|
224
235
|
|
|
@@ -390,7 +401,7 @@ class GoldStudyTranslator(Translator):
|
|
|
390
401
|
"""
|
|
391
402
|
return nmdc.Study(
|
|
392
403
|
description=gold_study.get("description"),
|
|
393
|
-
gold_study_identifiers=self._get_curie("
|
|
404
|
+
gold_study_identifiers=self._get_curie("gold", gold_study["studyGoldId"]),
|
|
394
405
|
id=nmdc_study_id,
|
|
395
406
|
name=gold_study.get("studyName"),
|
|
396
407
|
principal_investigator=self._get_pi(gold_study),
|
|
@@ -427,7 +438,7 @@ class GoldStudyTranslator(Translator):
|
|
|
427
438
|
collected_from=nmdc_field_site_id,
|
|
428
439
|
collection_date=self._get_collection_date(gold_biosample),
|
|
429
440
|
depth=self._get_quantity_value(
|
|
430
|
-
gold_biosample, "depthInMeters", unit="meters"
|
|
441
|
+
gold_biosample, ("depthInMeters", "depthInMeters2"), unit="meters"
|
|
431
442
|
),
|
|
432
443
|
description=gold_biosample.get("description"),
|
|
433
444
|
diss_oxygen=self._get_quantity_value(gold_biosample, "oxygenConcentration"),
|
|
@@ -440,7 +451,7 @@ class GoldStudyTranslator(Translator):
|
|
|
440
451
|
env_local_scale=self._get_env_term_value(gold_biosample, "envoLocalScale"),
|
|
441
452
|
env_medium=self._get_env_term_value(gold_biosample, "envoMedium"),
|
|
442
453
|
geo_loc_name=self._get_text_value(gold_biosample, "geoLocation"),
|
|
443
|
-
gold_biosample_identifiers=self._get_curie("
|
|
454
|
+
gold_biosample_identifiers=self._get_curie("gold", gold_biosample_id),
|
|
444
455
|
habitat=gold_biosample.get("habitat"),
|
|
445
456
|
host_name=gold_biosample.get("hostName"),
|
|
446
457
|
host_taxid=self._get_text_value(gold_biosample, "hostNcbiTaxid"),
|
|
@@ -498,7 +509,7 @@ class GoldStudyTranslator(Translator):
|
|
|
498
509
|
id=nmdc_omics_processing_id,
|
|
499
510
|
name=gold_project.get("projectName"),
|
|
500
511
|
gold_sequencing_project_identifiers=self._get_curie(
|
|
501
|
-
"
|
|
512
|
+
"gold", gold_project_id
|
|
502
513
|
),
|
|
503
514
|
ncbi_project_name=gold_project.get("projectName"),
|
|
504
515
|
type="nmdc:OmicsProcessing",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nmdc-runtime
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.14
|
|
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
|
|
@@ -137,10 +137,10 @@ make up-dev
|
|
|
137
137
|
Docker Compose is used to start local MongoDB and PostgresSQL (used by Dagster) instances, as well
|
|
138
138
|
as a Dagster web server (dagit) and daemon (dagster-daemon).
|
|
139
139
|
|
|
140
|
-
The Dagit web server is viewable at http://
|
|
140
|
+
The Dagit web server is viewable at http://127.0.0.1:3000/.
|
|
141
141
|
|
|
142
|
-
The FastAPI service is viewable at http://
|
|
143
|
-
http://
|
|
142
|
+
The FastAPI service is viewable at http://127.0.0.1:8000/ -- e.g., rendered documentation at
|
|
143
|
+
http://127.0.0.1:8000/redoc/.
|
|
144
144
|
|
|
145
145
|
## Local Testing
|
|
146
146
|
|
|
@@ -60,7 +60,7 @@ nmdc_runtime/site/terminusdb/schema.py,sha256=3e39rHUSZsNbN_F0SHHNsvcEGRWtYa6O9K
|
|
|
60
60
|
nmdc_runtime/site/translation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
61
|
nmdc_runtime/site/translation/emsl.py,sha256=l6Q9Jj3RNJFQNYAU_TtKTJ7cyFcR93xBRs_lLdX0bMQ,1244
|
|
62
62
|
nmdc_runtime/site/translation/gold.py,sha256=R3W99sdQb7Pgu_esN7ruIC-tyREQD_idJ4xCzkqWuGw,1622
|
|
63
|
-
nmdc_runtime/site/translation/gold_translator.py,sha256=
|
|
63
|
+
nmdc_runtime/site/translation/gold_translator.py,sha256=vqTmZ5dqmaExIgA8nXpBYCs0d2OedNZgwbWJrt5Tm_M,26441
|
|
64
64
|
nmdc_runtime/site/translation/jgi.py,sha256=bh73r0uq5BT3ywXwIa1OEKKtz9LbFsSng472tdr-xtg,875
|
|
65
65
|
nmdc_runtime/site/translation/neon_translator.py,sha256=RjLMm2VHm1ASFr8J7p-EEWqPiE4KpUWtQdbTLsKha58,43440
|
|
66
66
|
nmdc_runtime/site/translation/submission_portal_translator.py,sha256=qHMWqe3IwqhTYuwMYLmHHkewkWvJHC5nmsuwO3CFBP4,27608
|
|
@@ -71,9 +71,9 @@ nmdc_runtime/site/validation/emsl.py,sha256=TgckqKkFquHDLso77sn-jZRu5ZaBevGCt5p8
|
|
|
71
71
|
nmdc_runtime/site/validation/gold.py,sha256=kJ1L081SZb-8qKpF731r5aQOueM206SUfUYMTTNTFMc,802
|
|
72
72
|
nmdc_runtime/site/validation/jgi.py,sha256=lBo-FCtEYedT74CpW-Kdj512Ib963ik-4YIYmY5puDo,1298
|
|
73
73
|
nmdc_runtime/site/validation/util.py,sha256=GGbMDSwR090sr_E_fHffCN418gpYESaiot6XghS7OYk,3349
|
|
74
|
-
nmdc_runtime-1.0.
|
|
75
|
-
nmdc_runtime-1.0.
|
|
76
|
-
nmdc_runtime-1.0.
|
|
77
|
-
nmdc_runtime-1.0.
|
|
78
|
-
nmdc_runtime-1.0.
|
|
79
|
-
nmdc_runtime-1.0.
|
|
74
|
+
nmdc_runtime-1.0.14.dist-info/LICENSE,sha256=VWiv65r7gHGjgtr3jMJYVmQny5GRpQ6H-W9sScb1x70,2408
|
|
75
|
+
nmdc_runtime-1.0.14.dist-info/METADATA,sha256=O9nKIzZVMbCcPZUVDRUkky4UmdWlxTbePQnierx4mrY,7425
|
|
76
|
+
nmdc_runtime-1.0.14.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
77
|
+
nmdc_runtime-1.0.14.dist-info/entry_points.txt,sha256=nfH6-K9tDKv7va8ENfShsBnxVQoYJdEe7HHdwtkbh1Y,289
|
|
78
|
+
nmdc_runtime-1.0.14.dist-info/top_level.txt,sha256=b0K1s09L_iHH49ueBKaLrB5-lh6cyrSv9vL6x4Qvyz8,13
|
|
79
|
+
nmdc_runtime-1.0.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|