From e2553d35c1334e8f6398b768a3d93768991ff7b7 Mon Sep 17 00:00:00 2001 From: Patrick Kalita Date: Wed, 11 Mar 2026 16:51:15 -0700 Subject: [PATCH 1/5] Upgrade to nmdc-schema v11.17.0 --- pyproject.toml | 2 +- uv.lock | 28 ++++++++++------------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 188d54907..da01354dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ dependencies = [ # We use `nmdc-schema` to interpret data residing in—and validate data # destined for—the NMDC database (i.e. the MongoDB database named `nmdc`). # Docs: https://microbiomedata.github.io/nmdc-schema/ - "nmdc-schema==11.16.1", + "nmdc-schema==11.17.0", "pandas", "passlib[bcrypt]", "pymongo", diff --git a/uv.lock b/uv.lock index 5ed1ac804..a3c233a6e 100644 --- a/uv.lock +++ b/uv.lock @@ -1359,7 +1359,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7d/ed/6bfa4109fcb23a58819600392564fea69cdc6551ffd5e69ccf1d52a40cbc/greenlet-3.2.4-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:8c68325b0d0acf8d91dde4e6f930967dd52a5302cd4062932a6b2e7c2969f47c", size = 271061, upload-time = "2025-08-07T13:17:15.373Z" }, { url = "https://files.pythonhosted.org/packages/2a/fc/102ec1a2fc015b3a7652abab7acf3541d58c04d3d17a8d3d6a44adae1eb1/greenlet-3.2.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:94385f101946790ae13da500603491f04a76b6e4c059dab271b3ce2e283b2590", size = 629475, upload-time = "2025-08-07T13:42:54.009Z" }, { url = "https://files.pythonhosted.org/packages/c5/26/80383131d55a4ac0fb08d71660fd77e7660b9db6bdb4e8884f46d9f2cc04/greenlet-3.2.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:f10fd42b5ee276335863712fa3da6608e93f70629c631bf77145021600abc23c", size = 640802, upload-time = "2025-08-07T13:45:25.52Z" }, - { url = "https://files.pythonhosted.org/packages/9f/7c/e7833dbcd8f376f3326bd728c845d31dcde4c84268d3921afcae77d90d08/greenlet-3.2.4-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:c8c9e331e58180d0d83c5b7999255721b725913ff6bc6cf39fa2a45841a4fd4b", size = 636703, upload-time = "2025-08-07T13:53:12.622Z" }, { url = "https://files.pythonhosted.org/packages/e9/49/547b93b7c0428ede7b3f309bc965986874759f7d89e4e04aeddbc9699acb/greenlet-3.2.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:58b97143c9cc7b86fc458f215bd0932f1757ce649e05b640fea2e79b54cedb31", size = 635417, upload-time = "2025-08-07T13:18:25.189Z" }, { url = "https://files.pythonhosted.org/packages/7f/91/ae2eb6b7979e2f9b035a9f612cf70f1bf54aad4e1d125129bef1eae96f19/greenlet-3.2.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c2ca18a03a8cfb5b25bc1cbe20f3d9a4c80d8c3b13ba3df49ac3961af0b1018d", size = 584358, upload-time = "2025-08-07T13:18:23.708Z" }, { url = "https://files.pythonhosted.org/packages/f7/85/433de0c9c0252b22b16d413c9407e6cb3b41df7389afc366ca204dbc1393/greenlet-3.2.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:9fe0a28a7b952a21e2c062cd5756d34354117796c6d9215a87f55e38d15402c5", size = 1113550, upload-time = "2025-08-07T13:42:37.467Z" }, @@ -1370,7 +1369,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a4/de/f28ced0a67749cac23fecb02b694f6473f47686dff6afaa211d186e2ef9c/greenlet-3.2.4-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:96378df1de302bc38e99c3a9aa311967b7dc80ced1dcc6f171e99842987882a2", size = 272305, upload-time = "2025-08-07T13:15:41.288Z" }, { url = "https://files.pythonhosted.org/packages/09/16/2c3792cba130000bf2a31c5272999113f4764fd9d874fb257ff588ac779a/greenlet-3.2.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:1ee8fae0519a337f2329cb78bd7a8e128ec0f881073d43f023c7b8d4831d5246", size = 632472, upload-time = "2025-08-07T13:42:55.044Z" }, { url = "https://files.pythonhosted.org/packages/ae/8f/95d48d7e3d433e6dae5b1682e4292242a53f22df82e6d3dda81b1701a960/greenlet-3.2.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:94abf90142c2a18151632371140b3dba4dee031633fe614cb592dbb6c9e17bc3", size = 644646, upload-time = "2025-08-07T13:45:26.523Z" }, - { url = "https://files.pythonhosted.org/packages/d5/5e/405965351aef8c76b8ef7ad370e5da58d57ef6068df197548b015464001a/greenlet-3.2.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:4d1378601b85e2e5171b99be8d2dc85f594c79967599328f95c1dc1a40f1c633", size = 640519, upload-time = "2025-08-07T13:53:13.928Z" }, { url = "https://files.pythonhosted.org/packages/25/5d/382753b52006ce0218297ec1b628e048c4e64b155379331f25a7316eb749/greenlet-3.2.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:0db5594dce18db94f7d1650d7489909b57afde4c580806b8d9203b6e79cdc079", size = 639707, upload-time = "2025-08-07T13:18:27.146Z" }, { url = "https://files.pythonhosted.org/packages/1f/8e/abdd3f14d735b2929290a018ecf133c901be4874b858dd1c604b9319f064/greenlet-3.2.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2523e5246274f54fdadbce8494458a2ebdcdbc7b802318466ac5606d3cded1f8", size = 587684, upload-time = "2025-08-07T13:18:25.164Z" }, { url = "https://files.pythonhosted.org/packages/5d/65/deb2a69c3e5996439b0176f6651e0052542bb6c8f8ec2e3fba97c9768805/greenlet-3.2.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:1987de92fec508535687fb807a5cea1560f6196285a4cde35c100b8cd632cc52", size = 1116647, upload-time = "2025-08-07T13:42:38.655Z" }, @@ -1381,7 +1379,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/44/69/9b804adb5fd0671f367781560eb5eb586c4d495277c93bde4307b9e28068/greenlet-3.2.4-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:3b67ca49f54cede0186854a008109d6ee71f66bd57bb36abd6d0a0267b540cdd", size = 274079, upload-time = "2025-08-07T13:15:45.033Z" }, { url = "https://files.pythonhosted.org/packages/46/e9/d2a80c99f19a153eff70bc451ab78615583b8dac0754cfb942223d2c1a0d/greenlet-3.2.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:ddf9164e7a5b08e9d22511526865780a576f19ddd00d62f8a665949327fde8bb", size = 640997, upload-time = "2025-08-07T13:42:56.234Z" }, { url = "https://files.pythonhosted.org/packages/3b/16/035dcfcc48715ccd345f3a93183267167cdd162ad123cd93067d86f27ce4/greenlet-3.2.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:f28588772bb5fb869a8eb331374ec06f24a83a9c25bfa1f38b6993afe9c1e968", size = 655185, upload-time = "2025-08-07T13:45:27.624Z" }, - { url = "https://files.pythonhosted.org/packages/31/da/0386695eef69ffae1ad726881571dfe28b41970173947e7c558d9998de0f/greenlet-3.2.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:5c9320971821a7cb77cfab8d956fa8e39cd07ca44b6070db358ceb7f8797c8c9", size = 649926, upload-time = "2025-08-07T13:53:15.251Z" }, { url = "https://files.pythonhosted.org/packages/68/88/69bf19fd4dc19981928ceacbc5fd4bb6bc2215d53199e367832e98d1d8fe/greenlet-3.2.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c60a6d84229b271d44b70fb6e5fa23781abb5d742af7b808ae3f6efd7c9c60f6", size = 651839, upload-time = "2025-08-07T13:18:30.281Z" }, { url = "https://files.pythonhosted.org/packages/19/0d/6660d55f7373b2ff8152401a83e02084956da23ae58cddbfb0b330978fe9/greenlet-3.2.4-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3b3812d8d0c9579967815af437d96623f45c0f2ae5f04e366de62a12d83a8fb0", size = 607586, upload-time = "2025-08-07T13:18:28.544Z" }, { url = "https://files.pythonhosted.org/packages/8e/1a/c953fdedd22d81ee4629afbb38d2f9d71e37d23caace44775a3a969147d4/greenlet-3.2.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:abbf57b5a870d30c4675928c37278493044d7c14378350b3aa5d484fa65575f0", size = 1123281, upload-time = "2025-08-07T13:42:39.858Z" }, @@ -1392,7 +1389,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/49/e8/58c7f85958bda41dafea50497cbd59738c5c43dbbea5ee83d651234398f4/greenlet-3.2.4-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:1a921e542453fe531144e91e1feedf12e07351b1cf6c9e8a3325ea600a715a31", size = 272814, upload-time = "2025-08-07T13:15:50.011Z" }, { url = "https://files.pythonhosted.org/packages/62/dd/b9f59862e9e257a16e4e610480cfffd29e3fae018a68c2332090b53aac3d/greenlet-3.2.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cd3c8e693bff0fff6ba55f140bf390fa92c994083f838fece0f63be121334945", size = 641073, upload-time = "2025-08-07T13:42:57.23Z" }, { url = "https://files.pythonhosted.org/packages/f7/0b/bc13f787394920b23073ca3b6c4a7a21396301ed75a655bcb47196b50e6e/greenlet-3.2.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:710638eb93b1fa52823aa91bf75326f9ecdfd5e0466f00789246a5280f4ba0fc", size = 655191, upload-time = "2025-08-07T13:45:29.752Z" }, - { url = "https://files.pythonhosted.org/packages/f2/d6/6adde57d1345a8d0f14d31e4ab9c23cfe8e2cd39c3baf7674b4b0338d266/greenlet-3.2.4-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:c5111ccdc9c88f423426df3fd1811bfc40ed66264d35aa373420a34377efc98a", size = 649516, upload-time = "2025-08-07T13:53:16.314Z" }, { url = "https://files.pythonhosted.org/packages/7f/3b/3a3328a788d4a473889a2d403199932be55b1b0060f4ddd96ee7cdfcad10/greenlet-3.2.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d76383238584e9711e20ebe14db6c88ddcedc1829a9ad31a584389463b5aa504", size = 652169, upload-time = "2025-08-07T13:18:32.861Z" }, { url = "https://files.pythonhosted.org/packages/ee/43/3cecdc0349359e1a527cbf2e3e28e5f8f06d3343aaf82ca13437a9aa290f/greenlet-3.2.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:23768528f2911bcd7e475210822ffb5254ed10d71f4028387e5a99b4c6699671", size = 610497, upload-time = "2025-08-07T13:18:31.636Z" }, { url = "https://files.pythonhosted.org/packages/b8/19/06b6cf5d604e2c382a6f31cafafd6f33d5dea706f4db7bdab184bad2b21d/greenlet-3.2.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:00fadb3fedccc447f517ee0d3fd8fe49eae949e1cd0f6a611818f4f6fb7dc83b", size = 1121662, upload-time = "2025-08-07T13:42:41.117Z" }, @@ -1403,7 +1399,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/22/5c/85273fd7cc388285632b0498dbbab97596e04b154933dfe0f3e68156c68c/greenlet-3.2.4-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:49a30d5fda2507ae77be16479bdb62a660fa51b1eb4928b524975b3bde77b3c0", size = 273586, upload-time = "2025-08-07T13:16:08.004Z" }, { url = "https://files.pythonhosted.org/packages/d1/75/10aeeaa3da9332c2e761e4c50d4c3556c21113ee3f0afa2cf5769946f7a3/greenlet-3.2.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:299fd615cd8fc86267b47597123e3f43ad79c9d8a22bebdce535e53550763e2f", size = 686346, upload-time = "2025-08-07T13:42:59.944Z" }, { url = "https://files.pythonhosted.org/packages/c0/aa/687d6b12ffb505a4447567d1f3abea23bd20e73a5bed63871178e0831b7a/greenlet-3.2.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:c17b6b34111ea72fc5a4e4beec9711d2226285f0386ea83477cbb97c30a3f3a5", size = 699218, upload-time = "2025-08-07T13:45:30.969Z" }, - { url = "https://files.pythonhosted.org/packages/dc/8b/29aae55436521f1d6f8ff4e12fb676f3400de7fcf27fccd1d4d17fd8fecd/greenlet-3.2.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b4a1870c51720687af7fa3e7cda6d08d801dae660f75a76f3845b642b4da6ee1", size = 694659, upload-time = "2025-08-07T13:53:17.759Z" }, { url = "https://files.pythonhosted.org/packages/92/2e/ea25914b1ebfde93b6fc4ff46d6864564fba59024e928bdc7de475affc25/greenlet-3.2.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:061dc4cf2c34852b052a8620d40f36324554bc192be474b9e9770e8c042fd735", size = 695355, upload-time = "2025-08-07T13:18:34.517Z" }, { url = "https://files.pythonhosted.org/packages/72/60/fc56c62046ec17f6b0d3060564562c64c862948c9d4bc8aa807cf5bd74f4/greenlet-3.2.4-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:44358b9bf66c8576a9f57a590d5f5d6e72fa4228b763d0e43fee6d3b06d3a337", size = 657512, upload-time = "2025-08-07T13:18:33.969Z" }, { url = "https://files.pythonhosted.org/packages/23/6e/74407aed965a4ab6ddd93a7ded3180b730d281c77b765788419484cdfeef/greenlet-3.2.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:2917bdf657f5859fbf3386b12d68ede4cf1f04c90c3a6bc1f013dd68a22e2269", size = 1612508, upload-time = "2025-11-04T12:42:23.427Z" }, @@ -2241,7 +2236,7 @@ wheels = [ [[package]] name = "linkml" -version = "1.9.6" +version = "1.10.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "antlr4-python3-runtime" }, @@ -2270,9 +2265,9 @@ dependencies = [ { name = "typing-extensions", marker = "python_full_version < '3.12'" }, { name = "watchdog" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/0d/52/1e4e6e0af2296074822bbb26d60761a5dbd0b977b843fe263da8cc0a4be1/linkml-1.9.6.tar.gz", hash = "sha256:d2ef74bbb52bf5e48b67b5d9319ca2e4acb8184dd40bf43d00635222b2dc1d4c", size = 42963392, upload-time = "2025-12-01T22:14:54.962Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f3/57/e480d016c94ac1dcfeccde3fd751fa1464545e3de2446c9ebf9fe66dd393/linkml-1.10.0.tar.gz", hash = "sha256:ca70bba1474bc7de37edd33005a8a556d4718190584ab2c88f7c46d090477d55", size = 334216, upload-time = "2026-02-25T17:13:32.086Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/94/ff/b965a845fc0a9ca2331d8d6043e262cc834f5328ac0f1970db1622bac2cf/linkml-1.9.6-py3-none-any.whl", hash = "sha256:4ac3d2b7b6ea38c9da70e264a434977281a655f5e6040b33e65be76c63ab95cd", size = 402879, upload-time = "2025-12-01T22:14:52.579Z" }, + { url = "https://files.pythonhosted.org/packages/b3/54/0d01e407b3b8657cb1a58031e3f23e7039d26338173a130a3be30fdd8e0b/linkml-1.10.0-py3-none-any.whl", hash = "sha256:2d4934f000977489352307336267a8a4270de3156187c3394d542a0a4b8130e5", size = 434438, upload-time = "2026-02-25T17:13:29.068Z" }, ] [[package]] @@ -2292,7 +2287,7 @@ wheels = [ [[package]] name = "linkml-runtime" -version = "1.9.5" +version = "1.10.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "click" }, @@ -2310,9 +2305,9 @@ dependencies = [ { name = "rdflib" }, { name = "requests" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/e0/38/38ac19a5b81982f03709cda0a008327dc775d11f008d0cbdc0f2a5389e24/linkml_runtime-1.9.5.tar.gz", hash = "sha256:78dc1383adf11ad5f20bb11b6adde56ed566fbd2429a292d57699ad4596c738a", size = 480288, upload-time = "2025-08-15T22:22:51.098Z" } +sdist = { url = "https://files.pythonhosted.org/packages/36/3d/031e2e8ef7ca872340fb7b7102cfd1fe4a0b329dc04ff694ad9ec6ccaddc/linkml_runtime-1.10.0.tar.gz", hash = "sha256:899889d584ce8056c5c44512b2d247bdc84a8484c3aa228aeb2db283e3a9d2ec", size = 589957, upload-time = "2026-02-25T17:13:34.034Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/34/28/cdcbe1f0521a98b891dd30249513eef1ddcc7bb406be953b4a8d7825e68f/linkml_runtime-1.9.5-py3-none-any.whl", hash = "sha256:fece3e8aa25a4246165c6528b6a7fe83a929b985d2ce1951cc8a0f4da1a30b90", size = 576405, upload-time = "2025-08-15T22:22:49.264Z" }, + { url = "https://files.pythonhosted.org/packages/1c/2d/6ab4127bb9aa6e3b54ad5d81fd0c0c12e4d1a80300f2bfdac8f2e18f9d17/linkml_runtime-1.10.0-py3-none-any.whl", hash = "sha256:b7caf806e1b49bf62005d8f398b070c282742c5f6626469fdc1660add0c9da58", size = 584001, upload-time = "2026-02-25T17:13:30.603Z" }, ] [[package]] @@ -3016,7 +3011,7 @@ requires-dist = [ { name = "linkml" }, { name = "linkml-runtime" }, { name = "lxml" }, - { name = "nmdc-schema", specifier = "==11.16.1" }, + { name = "nmdc-schema", specifier = "==11.17.0" }, { name = "ontology-loader", specifier = "==0.2.2" }, { name = "pandas" }, { name = "passlib", extras = ["bcrypt"] }, @@ -3062,29 +3057,26 @@ docs = [ [[package]] name = "nmdc-schema" -version = "11.16.1" +version = "11.17.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "click" }, { name = "click-log" }, - { name = "curies" }, { name = "deprecated" }, { name = "jsonasobj2" }, { name = "jsonschema" }, { name = "linkml" }, { name = "linkml-runtime" }, - { name = "pyasn1" }, { name = "pymdown-extensions" }, { name = "pymongo" }, { name = "python-dotenv" }, { name = "pyyaml" }, { name = "rdflib" }, { name = "requests" }, - { name = "urllib3" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/3d/0c/729edaf6404203d77b277a431e5ce2fcbe079f4ce4cb10f78722d9c4b192/nmdc_schema-11.16.1.tar.gz", hash = "sha256:c51fe6598794017224c9e886f480411b28d482cf508c894797b22b3810b06a2e", size = 713878, upload-time = "2026-02-09T21:03:02.009Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f4/ca/6c6ff982f6755c25ec2b56d49c5525939f4423f6407746e435734f1ec014/nmdc_schema-11.17.0.tar.gz", hash = "sha256:cf8d82feb9202c2669c1fd07c1cf8ba653615f445a856c2f35ec508cf248d774", size = 714495, upload-time = "2026-03-11T21:48:05.085Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/8c/2f/c864c29f9675ca88ee0667d936d2fcf7a70ebe3b383ccf1b532a662cb4ee/nmdc_schema-11.16.1-py3-none-any.whl", hash = "sha256:d0723711f0fa1707a2010eadcdcf5437efd6575c4c3bfdb8970f906a70caeb26", size = 786232, upload-time = "2026-02-09T21:02:59.8Z" }, + { url = "https://files.pythonhosted.org/packages/1d/73/d6b9995900fa32a578dca071a18a7dced5fabb25b0d66beae72ec0684280/nmdc_schema-11.17.0-py3-none-any.whl", hash = "sha256:cff858c70c30116dd71c4a6d67b724bb498d64cc7be5da4219b941f4e22e31ab", size = 786960, upload-time = "2026-03-11T21:48:03.588Z" }, ] [[package]] From 8e2b38f7227c979b2da6a00c3387601d1494d9bd Mon Sep 17 00:00:00 2001 From: Patrick Kalita Date: Wed, 11 Mar 2026 16:57:04 -0700 Subject: [PATCH 2/5] Populate provenance_metadata slot on Study, Biosample, and NucleotideSequencing objects --- .../submission_portal_translator.py | 47 +- .../nucleotide_sequencing_mapping_input.yaml | 2 +- .../nucleotide_sequencing_mapping_output.yaml | 244 ++++---- .../test_data/data/plant_air_jgi_output.yaml | 556 +++++++++++------- .../test_data/data/sequencing_data_input.yaml | 6 +- .../data/sequencing_data_output.yaml | 190 ++++-- .../data/soil_sample_link_output.yaml | 307 +++++----- .../test_submission_portal_translator.py | 18 +- 8 files changed, 818 insertions(+), 552 deletions(-) diff --git a/nmdc_runtime/site/translation/submission_portal_translator.py b/nmdc_runtime/site/translation/submission_portal_translator.py index 9f0ac7ac7..0ce3e21ce 100644 --- a/nmdc_runtime/site/translation/submission_portal_translator.py +++ b/nmdc_runtime/site/translation/submission_portal_translator.py @@ -1,11 +1,12 @@ import logging import re from collections import namedtuple -from datetime import datetime +from datetime import datetime, timezone from decimal import Decimal from enum import Enum from functools import lru_cache from importlib import resources +from importlib.metadata import version from typing import Any, List, Optional, Union, Tuple from urllib.parse import urlparse @@ -583,7 +584,10 @@ def _parse_sample_link(self, sample_link: str) -> tuple[str, list[str]] | None: return match.group(1), split_strip(match.group(2), ",") def _translate_study( - self, metadata_submission: JSON_OBJECT, nmdc_study_id: str + self, + metadata_submission: JSON_OBJECT, + nmdc_study_id: str, + provenance_metadata: nmdc.ProvenanceMetadata, ) -> nmdc.Study: """Translate a metadata submission into an `nmdc:Study` object. @@ -592,12 +596,14 @@ def _translate_study( :param gold_study: metadata submission object :param nmdc_study_id: Minted nmdc:Study identifier for the translated object + :param provenance_metadata: ProvenanceMetadata object to associate with the Study :return: nmdc:Study object """ return nmdc.Study( alternative_names=self._get_from( metadata_submission, ["studyForm", "alternativeNames"] ), + associated_dois=self._get_study_dois(metadata_submission), description=self._get_from( metadata_submission, ["studyForm", "description"] ), @@ -623,13 +629,13 @@ def _translate_study( name=self._get_from(metadata_submission, ["studyForm", "studyName"]), notes=self._get_from(metadata_submission, ["studyForm", "notes"]), principal_investigator=self._get_pi(metadata_submission), + provenance_metadata=provenance_metadata, study_category=self.study_category, title=self._get_from(metadata_submission, ["studyForm", "studyName"]), type="nmdc:Study", websites=self._get_from( metadata_submission, ["studyForm", "linkOutWebpage"] ), - associated_dois=self._get_study_dois(metadata_submission), ) def _transform_value_for_slot( @@ -733,6 +739,7 @@ def _translate_biosample( sample_data: List[JSON_OBJECT], nmdc_biosample_id: str, nmdc_study_id: str, + provenance_metadata: nmdc.ProvenanceMetadata, ) -> nmdc.Biosample: """Translate sample data from portal submission into an `nmdc:Biosample` object. @@ -747,6 +754,7 @@ def _translate_biosample( from each applicable submission portal tab :param nmdc_biosample_id: Minted nmdc:Biosample identifier for the translated object :param nmdc_study_id: Minted nmdc:Study identifier for the related Study + :param provenance_metadata: ProvenanceMetadata object to associate with the Biosample :return: nmdc:Biosample """ env_idx = next( @@ -777,7 +785,7 @@ def _translate_biosample( ) slots.update(transformed_extras) - return nmdc.Biosample(**slots) + return nmdc.Biosample(**slots, provenance_metadata=provenance_metadata) def get_database(self) -> nmdc.Database: """Translate the submission portal entry to an nmdc:Database @@ -789,17 +797,33 @@ def get_database(self) -> nmdc.Database: :return: nmdc:Database object """ database = nmdc.Database() + submission_id = self.metadata_submission.get("id") metadata_submission_data = self.metadata_submission.get( "metadata_submission", {} ) + now = datetime.now(tz=timezone.utc) + provenance_metadata = nmdc.ProvenanceMetadata( + add_date=now, + git_url="https://github.com/microbiomedata/nmdc-runtime", + mod_date=now, + source_system_of_record=nmdc.SourceSystemEnum( + nmdc.SourceSystemEnum.NMDC_Submission_Portal + ), + submission_portal_identifier=submission_id, + type="nmdc:ProvenanceMetadata", + version=version("nmdc_runtime"), + ) + # Generate one Study instance based on the metadata submission, if a study_id wasn't provided if self.study_id: nmdc_study_id = self.study_id else: nmdc_study_id = self._id_minter("nmdc:Study")[0] database.study_set = [ - self._translate_study(metadata_submission_data, nmdc_study_id) + self._translate_study( + metadata_submission_data, nmdc_study_id, provenance_metadata + ) ] # Automatically populate the `env_package` field in the sample data based on which @@ -887,6 +911,7 @@ def get_database(self) -> nmdc.Database: sample_data, nmdc_biosample_id=sample_data_to_nmdc_biosample_ids[sample_data_id], nmdc_study_id=nmdc_study_id, + provenance_metadata=provenance_metadata, ) database.biosample_set.append(biosample) @@ -896,7 +921,6 @@ def get_database(self) -> nmdc.Database: database.data_object_set = [] database.instrument_set = [] database.manifest_set = [] - today = datetime.now().strftime("%Y-%m-%d") for sample_data_id, sample_data in sample_data_by_id.items(): for tab in sample_data: tab_name = tab.get(TAB_NAME_KEY) @@ -917,8 +941,6 @@ def get_database(self) -> nmdc.Database: "has_input": sample_data_to_nmdc_biosample_ids[sample_data_id], "has_output": [], "associated_studies": [nmdc_study_id], - "add_date": today, - "mod_date": today, "analyte_category": analyte_category, "type": "nmdc:NucleotideSequencing", } @@ -959,7 +981,8 @@ def get_database(self) -> nmdc.Database: self._transform_dict_for_class(tab, "NucleotideSequencing") ) nucleotide_sequencing = nmdc.NucleotideSequencing( - **nucleotide_sequencing_slots + **nucleotide_sequencing_slots, + provenance_metadata=provenance_metadata, ) database.data_generation_set.append(nucleotide_sequencing) @@ -1002,7 +1025,6 @@ def get_database(self) -> nmdc.Database: database.data_generation_set = [] database.data_object_set = [] data_objects_by_sample_data_id = {} - today = datetime.now().strftime("%Y-%m-%d") if self.data_object_mapping: # If DataObject mapping data was provided, group it by the sample ID key and then @@ -1037,8 +1059,6 @@ def get_database(self) -> nmdc.Database: "has_input": [nmdc_biosample_id], "has_output": [], "associated_studies": [nmdc_study_id], - "add_date": today, - "mod_date": today, "type": "nmdc:NucleotideSequencing", } nucleotide_sequencing_slots.update( @@ -1047,7 +1067,8 @@ def get_database(self) -> nmdc.Database: ) ) nucleotide_sequencing = nmdc.NucleotideSequencing( - **nucleotide_sequencing_slots + **nucleotide_sequencing_slots, + provenance_metadata=provenance_metadata, ) for data_object_row in data_objects_by_sample_data_id.get( diff --git a/tests/test_data/data/nucleotide_sequencing_mapping_input.yaml b/tests/test_data/data/nucleotide_sequencing_mapping_input.yaml index 86662ab2b..33bdf4d3c 100644 --- a/tests/test_data/data/nucleotide_sequencing_mapping_input.yaml +++ b/tests/test_data/data/nucleotide_sequencing_mapping_input.yaml @@ -1,5 +1,5 @@ metadata_submission: - id: 00000000-0000-0000-0000-000000000000, + id: 00000000-0000-0000-0000-000000000000 metadata_submission: packageName: plant-associated sampleData: diff --git a/tests/test_data/data/nucleotide_sequencing_mapping_output.yaml b/tests/test_data/data/nucleotide_sequencing_mapping_output.yaml index dc18e92b4..02d72e135 100644 --- a/tests/test_data/data/nucleotide_sequencing_mapping_output.yaml +++ b/tests/test_data/data/nucleotide_sequencing_mapping_output.yaml @@ -1,113 +1,139 @@ biosample_set: - - id: nmdc:bsm-00-4wn6isig - type: nmdc:Biosample - name: G5R1_MAIN_09MAY2016 - associated_studies: - - nmdc:sty-00-y0cq65zt - env_broad_scale: - type: nmdc:ControlledIdentifiedTermValue - has_raw_value: agricultural biome [ENVO:01001442] - term: - id: ENVO:01001442 - type: nmdc:OntologyClass - name: agricultural biome - env_local_scale: - type: nmdc:ControlledIdentifiedTermValue - has_raw_value: phyllosphere biome [ENVO:01001442] - term: - id: ENVO:01001442 - type: nmdc:OntologyClass - name: phyllosphere biome - env_medium: - type: nmdc:ControlledIdentifiedTermValue - has_raw_value: plant-associated biome [ENVO:01001001] - term: - id: ENVO:01001001 - type: nmdc:OntologyClass - name: plant-associated biome - samp_name: G5R1_MAIN_09MAY2016 - collection_date: - has_raw_value: '2016-05-09' - type: nmdc:TimestampValue - depth: - has_raw_value: '0' - has_numeric_value: 0.0 - has_unit: m - type: nmdc:QuantityValue - ecosystem: Environmental - ecosystem_category: Terrestrial - ecosystem_subtype: Leaf - ecosystem_type: Plant-associated - elev: 286.0 - env_package: - has_raw_value: plant-associated - type: nmdc:TextValue - geo_loc_name: - has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - lat_lon: - has_raw_value: 42.39 -85.37 - latitude: 42.39 - longitude: -85.37 - type: nmdc:GeolocationValue - samp_store_temp: - has_raw_value: -80 Cel - has_unit: Cel - has_numeric_value: -80.0 - type: nmdc:QuantityValue - source_mat_id: - has_raw_value: UUID:e8ed34cc-32f4-4fc5-9b9f-c2699e43163c - type: nmdc:TextValue - specific_ecosystem: Phyllosphere - analysis_type: - - metagenomics -data_object_set: - - id: nmdc:dobj-00-9gw1un94 - name: Metagenome Raw Reads - description: Metagenome Raw Reads - data_object_type: Metagenome Raw Reads - url: http://example.com/data.fastq.gz - type: nmdc:DataObject - data_category: instrument_data +- id: nmdc:bsm-00-4wn6isig + type: nmdc:Biosample + name: G5R1_MAIN_09MAY2016 + associated_studies: + - nmdc:sty-00-y0cq65zt + env_broad_scale: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: agricultural biome [ENVO:01001442] + term: + id: ENVO:01001442 + type: nmdc:OntologyClass + name: agricultural biome + env_local_scale: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: phyllosphere biome [ENVO:01001442] + term: + id: ENVO:01001442 + type: nmdc:OntologyClass + name: phyllosphere biome + env_medium: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] + term: + id: ENVO:01001001 + type: nmdc:OntologyClass + name: plant-associated biome + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - 00000000-0000-0000-0000-000000000000 + collection_date: + type: nmdc:TimestampValue + has_raw_value: '2016-05-09' + depth: + type: nmdc:QuantityValue + has_raw_value: '0' + has_unit: m + has_numeric_value: 0 + elev: 286.0 + env_package: + type: nmdc:TextValue + has_raw_value: plant-associated + geo_loc_name: + type: nmdc:TextValue + has_raw_value: 'USA: Kellogg Biological Station, Michigan' + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field + lat_lon: + type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 + latitude: 42.39 + longitude: -85.37 + samp_name: G5R1_MAIN_09MAY2016 + samp_store_temp: + type: nmdc:QuantityValue + has_raw_value: -80 Cel + has_unit: Cel + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:e8ed34cc-32f4-4fc5-9b9f-c2699e43163c + ecosystem: Environmental + ecosystem_category: Terrestrial + ecosystem_type: Plant-associated + ecosystem_subtype: Leaf + specific_ecosystem: Phyllosphere + analysis_type: + - metagenomics data_generation_set: - - id: nmdc:dgns-00-q8jtgev4 - has_input: - - nmdc:bsm-00-4wn6isig - add_date: '2023-10-17' - has_output: - - nmdc:dobj-00-9gw1un94 - instrument_used: nmdc:inst-00-00000000 - mod_date: '2023-10-17' - analyte_category: metagenome - associated_studies: - - nmdc:sty-00-y0cq65zt - processing_institution: JGI - type: nmdc:NucleotideSequencing +- id: nmdc:dgns-00-q8jtgev4 + type: nmdc:NucleotideSequencing + has_input: + - nmdc:bsm-00-4wn6isig + has_output: + - nmdc:dobj-00-9gw1un94 + processing_institution: JGI + analyte_category: metagenome + associated_studies: + - nmdc:sty-00-y0cq65zt + instrument_used: + - nmdc:inst-00-00000000 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - 00000000-0000-0000-0000-000000000000 +data_object_set: +- id: nmdc:dobj-00-9gw1un94 + type: nmdc:DataObject + name: Metagenome Raw Reads + description: Metagenome Raw Reads + data_category: instrument_data + data_object_type: Metagenome Raw Reads + url: http://example.com/data.fastq.gz study_set: - - id: nmdc:sty-00-y0cq65zt - type: nmdc:Study - name: A test submission - description: This is a test submission - funding_sources: - - Some award ABC - - Some award XYZ - has_credit_associations: - - applies_to_person: - orcid: 0000-0000-0000-0000 - name: Test Testerson - type: nmdc:PersonValue - applied_roles: - - Principal Investigator - type: nmdc:CreditAssociation - principal_investigator: - orcid: 0000-0000-0000-0000 - email: test.testerson@example.com - name: Test Testerson +- id: nmdc:sty-00-y0cq65zt + type: nmdc:Study + name: A test submission + description: This is a test submission + study_category: research_study + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - 00000000-0000-0000-0000-000000000000 + funding_sources: + - Some award ABC + - Some award XYZ + has_credit_associations: + - applies_to_person: type: nmdc:PersonValue - study_category: research_study - title: A test submission - websites: - - http://www.example.com/submission-test + name: Test Testerson + orcid: 0000-0000-0000-0000 + applied_roles: + - Principal Investigator + type: prov:Association + principal_investigator: + type: nmdc:PersonValue + email: test.testerson@example.com + name: Test Testerson + orcid: 0000-0000-0000-0000 + title: A test submission + websites: + - http://www.example.com/submission-test diff --git a/tests/test_data/data/plant_air_jgi_output.yaml b/tests/test_data/data/plant_air_jgi_output.yaml index 0cee46100..f1a008746 100644 --- a/tests/test_data/data/plant_air_jgi_output.yaml +++ b/tests/test_data/data/plant_air_jgi_output.yaml @@ -1,6 +1,7 @@ biosample_set: - id: nmdc:bsm-00-4wn6isig type: nmdc:Biosample + name: G5R1_MAIN_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -18,54 +19,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R1_MAIN_09MAY2016 - name: G5R1_MAIN_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R1_MAIN_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:e8ed34cc-32f4-4fc5-9b9f-c2699e43163c ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:e8ed34cc-32f4-4fc5-9b9f-c2699e43163c analysis_type: - metagenomics - id: nmdc:bsm-00-q8jtgev4 type: nmdc:Biosample + name: G5R2_MAIN_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -83,54 +93,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R2_MAIN_09MAY2016 - name: G5R2_MAIN_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R2_MAIN_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:774bb4b9-5ebe-48d5-8236-1a60baa6af7a ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:774bb4b9-5ebe-48d5-8236-1a60baa6af7a analysis_type: - metagenomics - id: nmdc:bsm-00-9gw1un94 type: nmdc:Biosample + name: G5R3_MAIN_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -148,54 +167,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R3_MAIN_09MAY2016 - name: G5R3_MAIN_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R3_MAIN_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:c0bb595b-9992-4475-8019-775189b5250a ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:c0bb595b-9992-4475-8019-775189b5250a analysis_type: - metagenomics - id: nmdc:bsm-00-27qd9afz type: nmdc:Biosample + name: G5R4_MAIN_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -213,54 +241,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R4_MAIN_09MAY2016 - name: G5R4_MAIN_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R4_MAIN_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:d74181a3-6fb9-406e-89f8-2d4861a4646c ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:d74181a3-6fb9-406e-89f8-2d4861a4646c analysis_type: - metagenomics - id: nmdc:bsm-00-a5vpuemo type: nmdc:Biosample + name: G5R1_NF_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -278,54 +315,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R1_NF_09MAY2016 - name: G5R1_NF_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R1_NF_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:edfd5080-ccc2-495b-b17a-190ad6649291 ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:edfd5080-ccc2-495b-b17a-190ad6649291 analysis_type: - metagenomics - id: nmdc:bsm-00-pj82ffu6 type: nmdc:Biosample + name: G5R2_NF_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -343,54 +389,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R2_NF_09MAY2016 - name: G5R2_NF_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R2_NF_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:483921c0-7fa9-4a31-b281-e09565a0d6f9 ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:483921c0-7fa9-4a31-b281-e09565a0d6f9 analysis_type: - metagenomics - id: nmdc:bsm-00-5gt9sh9v type: nmdc:Biosample + name: G5R3_NF_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -408,54 +463,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R3_NF_09MAY2016 - name: G5R3_NF_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R3_NF_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:3b9aab19-0110-415b-8e29-849f0696de47 ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:3b9aab19-0110-415b-8e29-849f0696de47 analysis_type: - metagenomics - id: nmdc:bsm-00-8n9s2fyu type: nmdc:Biosample + name: G5R4_NF_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -473,54 +537,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G5R4_NF_09MAY2016 - name: G5R4_NF_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G5R4_NF_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:579ec4b9-57c4-4431-8df9-432138233b0b ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:579ec4b9-57c4-4431-8df9-432138233b0b analysis_type: - metagenomics - id: nmdc:bsm-00-pslmlcq4 type: nmdc:Biosample + name: G6R1_MAIN_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -538,54 +611,63 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G6R1_MAIN_09MAY2016 - name: G6R1_MAIN_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G6R1_MAIN_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:69dd84ff-d777-4d1e-ac22-9cdac87074f5 ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:69dd84ff-d777-4d1e-ac22-9cdac87074f5 analysis_type: - metagenomics - id: nmdc:bsm-00-efijcf8z type: nmdc:Biosample + name: G6R2_MAIN_09MAY2016 associated_studies: - nmdc:sty-00-y0cq65zt env_broad_scale: @@ -603,99 +685,116 @@ biosample_set: type: nmdc:OntologyClass name: phyllosphere biome env_medium: - has_raw_value: plant-associated biome [ENVO:01001001] type: nmdc:ControlledIdentifiedTermValue + has_raw_value: plant-associated biome [ENVO:01001001] term: id: ENVO:01001001 type: nmdc:OntologyClass name: plant-associated biome - samp_name: G6R2_MAIN_09MAY2016 - name: G6R2_MAIN_09MAY2016 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - has_raw_value: '2016-05-09' type: nmdc:TimestampValue + has_raw_value: '2016-05-09' depth: + type: nmdc:QuantityValue has_raw_value: '0' - has_numeric_value: 0.0 has_unit: m - type: nmdc:QuantityValue + has_numeric_value: 0 elev: 286.0 env_package: - has_raw_value: plant-associated type: nmdc:TextValue + has_raw_value: plant-associated geo_loc_name: + type: nmdc:TextValue has_raw_value: 'USA: Kellogg Biological Station, Michigan' - type: nmdc:TextValue + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: field lat_lon: - has_raw_value: 42.39 -85.37 type: nmdc:GeolocationValue + has_raw_value: 42.39 -85.37 latitude: 42.39 longitude: -85.37 + samp_name: G6R2_MAIN_09MAY2016 samp_store_temp: - has_raw_value: -80 Cel type: nmdc:QuantityValue + has_raw_value: -80 Cel has_unit: Cel - has_numeric_value: -80.0 + has_numeric_value: -80 + source_mat_id: + type: nmdc:TextValue + has_raw_value: UUID:c0c4a2b5-0382-450a-8728-a176fa438efe ecosystem: Environmental ecosystem_category: Terrestrial ecosystem_type: Plant-associated ecosystem_subtype: Leaf specific_ecosystem: Phyllosphere - growth_facil: - has_raw_value: field - type: nmdc:ControlledTermValue - source_mat_id: - type: nmdc:TextValue - has_raw_value: UUID:c0c4a2b5-0382-450a-8728-a176fa438efe analysis_type: - metagenomics - id: nmdc:bsm-00-7r7pn0r2 - type: 'nmdc:Biosample' - name: 'wedw' + type: nmdc:Biosample + name: wedw associated_studies: - - 'nmdc:sty-00-y0cq65zt' + - nmdc:sty-00-y0cq65zt env_broad_scale: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'ewdwed [ENVO:123]' + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: ewdwed [ENVO:123] term: - id: 'ENVO:123' - type: 'nmdc:OntologyClass' - name: 'ewdwed' + id: ENVO:123 + type: nmdc:OntologyClass + name: ewdwed env_local_scale: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'asdxasd [ENV:234]' + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: asdxasd [ENV:234] term: - id: 'ENV:234' - type: 'nmdc:OntologyClass' - name: 'asdxasd' + id: ENV:234 + type: nmdc:OntologyClass + name: asdxasd env_medium: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'abcd [ENVO:00001998]' + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: abcd [ENVO:00001998] term: - id: 'ENVO:00001998' - type: 'nmdc:OntologyClass' - name: 'abcd' - samp_name: 'wedw' + id: ENVO:00001998 + type: nmdc:OntologyClass + name: abcd + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 collection_date: - type: 'nmdc:TimestampValue' + type: nmdc:TimestampValue has_raw_value: '2021' elev: 225.0 env_package: - type: 'nmdc:TextValue' - has_raw_value: 'air' + type: nmdc:TextValue + has_raw_value: air geo_loc_name: - type: 'nmdc:TextValue' + type: nmdc:TextValue has_raw_value: 'USA: Maryland, Bethesda' lat_lon: - type: 'nmdc:GeolocationValue' - has_raw_value: '50.586825 6.408977' + type: nmdc:GeolocationValue + has_raw_value: 50.586825 6.408977 latitude: 50.586825 longitude: 6.408977 + samp_name: wedw samp_store_temp: - type: 'nmdc:QuantityValue' - has_raw_value: '-80 Cel' - has_unit: 'Cel' - has_numeric_value: -80.0 + type: nmdc:QuantityValue + has_raw_value: -80 Cel + has_unit: Cel + has_numeric_value: -80 analysis_type: - metaproteomics study_set: @@ -717,23 +816,35 @@ study_set: non-ribosomal peptide pathways that are poorly annotated. Our findings support that leaf-associated bacterial populations are seasonally dynamic and responsive to host cues. - principal_investigator: - orcid: 0000-0002-7189-3067 - email: shade.ashley@gmail.com - name: Ashley Shade - type: nmdc:PersonValue - funding_sources: - - Some award ABC - - Some award XYZ study_category: research_study - title: Seasonal activities of the phyllosphere microbiome of perennial crops - websites: - - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9950430/ + emsl_project_identifiers: + - emsl.project:45678 + gold_study_identifiers: + - gold:Gs0123456 + insdc_bioproject_identifiers: + - bioproject:PRJNA1234567 + jgi_portal_study_identifiers: + - jgi.proposal:123456 + alternative_names: + - foo + - bar + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - d32b5eb6-71e8-4c98-8a57-3e64d05718b4 + funding_sources: + - Some award ABC + - Some award XYZ has_credit_associations: - applies_to_person: - orcid: 0000-0002-7705-343X - name: Adina Howe type: nmdc:PersonValue + name: Adina Howe + orcid: 0000-0002-7705-343X applied_roles: - Writing review and editing - Visualization @@ -750,15 +861,12 @@ study_set: - Software - Principal Investigator - Funding acquisition - type: nmdc:CreditAssociation - alternative_names: - - foo - - bar - gold_study_identifiers: - - gold:Gs0123456 - jgi_portal_study_identifiers: - - jgi.proposal:123456 - insdc_bioproject_identifiers: - - bioproject:PRJNA1234567 - emsl_project_identifiers: - - emsl.project:45678 + type: prov:Association + principal_investigator: + type: nmdc:PersonValue + email: shade.ashley@gmail.com + name: Ashley Shade + orcid: 0000-0002-7189-3067 + title: Seasonal activities of the phyllosphere microbiome of perennial crops + websites: + - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9950430/ diff --git a/tests/test_data/data/sequencing_data_input.yaml b/tests/test_data/data/sequencing_data_input.yaml index 48cc894e9..a7e869ef2 100644 --- a/tests/test_data/data/sequencing_data_input.yaml +++ b/tests/test_data/data/sequencing_data_input.yaml @@ -66,7 +66,7 @@ metadata_submission: sampleData: soil_data: - elev: 1325 - depth: 0 - 0.1 + depth: 0 - 1 lat_lon: 43 -120 samp_name: "001" env_medium: bulk soil [ENVO:00005802] @@ -81,7 +81,7 @@ metadata_submission: samp_store_temp: -80 Cel slope_gradient: 8% - elev: 1325 - depth: 0 - 0.1 + depth: 0 - 1 lat_lon: 43 -120 samp_name: "002" env_medium: bulk soil [ENVO:00005802] @@ -97,7 +97,7 @@ metadata_submission: samp_store_temp: -80 Cel slope_gradient: 0% - elev: 1325 - depth: 0 - 0.1 + depth: 0 - 1 lat_lon: 43 -120 samp_name: "003" env_medium: bulk soil [ENVO:00005802] diff --git a/tests/test_data/data/sequencing_data_output.yaml b/tests/test_data/data/sequencing_data_output.yaml index 8bf4f3540..d29695e7a 100644 --- a/tests/test_data/data/sequencing_data_output.yaml +++ b/tests/test_data/data/sequencing_data_output.yaml @@ -25,16 +25,24 @@ biosample_set: id: ENVO:00005802 type: nmdc:OntologyClass name: bulk soil - samp_name: '001' + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 collection_date: type: nmdc:TimestampValue has_raw_value: '2025-01-01' depth: type: nmdc:QuantityValue - has_raw_value: 0 - 0.1 - has_maximum_numeric_value: '0.1' - has_minimum_numeric_value: '0.0' + has_raw_value: 0 - 1 has_unit: m + has_maximum_numeric_value: 1 + has_minimum_numeric_value: 0 elev: 1325.0 env_package: type: nmdc:TextValue @@ -50,21 +58,22 @@ biosample_set: has_raw_value: 43 -120 latitude: 43.0 longitude: -120.0 + samp_name: '001' samp_store_temp: type: nmdc:QuantityValue has_raw_value: -80 Cel - has_numeric_value: -80.0 has_unit: Cel + has_numeric_value: -80 + slope_gradient: + type: nmdc:QuantityValue + has_raw_value: 8% + has_unit: '%' + has_numeric_value: 8 store_cond: type: nmdc:TextValue has_raw_value: frozen analysis_type: - metagenomics - slope_gradient: - type: nmdc:QuantityValue - has_raw_value: '8%' - has_numeric_value: 8 - has_unit: '%' - id: nmdc:bsm-00-q8jtgev4 type: nmdc:Biosample name: '002' @@ -91,16 +100,24 @@ biosample_set: id: ENVO:00005802 type: nmdc:OntologyClass name: bulk soil - samp_name: '002' + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 collection_date: type: nmdc:TimestampValue has_raw_value: '2025-01-01' depth: type: nmdc:QuantityValue - has_raw_value: 0 - 0.1 - has_maximum_numeric_value: '0.1' - has_minimum_numeric_value: '0.0' + has_raw_value: 0 - 1 has_unit: m + has_maximum_numeric_value: 1 + has_minimum_numeric_value: 0 elev: 1325.0 env_package: type: nmdc:TextValue @@ -116,22 +133,23 @@ biosample_set: has_raw_value: 43 -120 latitude: 43.0 longitude: -120.0 + samp_name: '002' samp_store_temp: type: nmdc:QuantityValue has_raw_value: -80 Cel - has_numeric_value: -80.0 has_unit: Cel + has_numeric_value: -80 + slope_gradient: + type: nmdc:QuantityValue + has_raw_value: 0% + has_unit: '%' + has_numeric_value: 0 store_cond: type: nmdc:TextValue has_raw_value: frozen analysis_type: - metagenomics - metatranscriptomics - slope_gradient: - type: nmdc:QuantityValue - has_raw_value: '0%' - has_numeric_value: 0 - has_unit: '%' - id: nmdc:bsm-00-9gw1un94 type: nmdc:Biosample name: '003' @@ -158,16 +176,24 @@ biosample_set: id: ENVO:00005802 type: nmdc:OntologyClass name: bulk soil - samp_name: '003' + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 collection_date: type: nmdc:TimestampValue has_raw_value: '2025-01-01' depth: type: nmdc:QuantityValue - has_raw_value: 0 - 0.1 - has_maximum_numeric_value: '0.1' - has_minimum_numeric_value: '0.0' + has_raw_value: 0 - 1 has_unit: m + has_maximum_numeric_value: 1 + has_minimum_numeric_value: 0 elev: 1325.0 env_package: type: nmdc:TextValue @@ -183,21 +209,22 @@ biosample_set: has_raw_value: 43 -120 latitude: 43.0 longitude: -120.0 + samp_name: '003' samp_store_temp: type: nmdc:QuantityValue has_raw_value: -80 Cel - has_numeric_value: -80.0 has_unit: Cel + has_numeric_value: -80 + slope_gradient: + type: nmdc:QuantityValue + has_raw_value: 0.5% + has_unit: '%' + has_numeric_value: 0.5 store_cond: type: nmdc:TextValue has_raw_value: frozen analysis_type: - metatranscriptomics - slope_gradient: - type: nmdc:QuantityValue - has_raw_value: '0.5%' - has_numeric_value: 0.5 - has_unit: '%' data_generation_set: - id: nmdc:dgns-00-27qd9afz type: nmdc:NucleotideSequencing @@ -213,10 +240,17 @@ data_generation_set: analyte_category: metagenome associated_studies: - nmdc:sty-00-y0cq65zt - add_date: '2023-10-17' - mod_date: '2023-10-17' instrument_used: - - nmdc:inst-00-00000001 + - nmdc:inst-00-00000001 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 insdc_bioproject_identifiers: - bioproject:PRJNA366857 insdc_experiment_identifiers: @@ -235,10 +269,17 @@ data_generation_set: analyte_category: metagenome associated_studies: - nmdc:sty-00-y0cq65zt - add_date: '2023-10-17' - mod_date: '2023-10-17' instrument_used: - - nmdc:inst-00-00000001 + - nmdc:inst-00-00000001 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 insdc_bioproject_identifiers: - bioproject:PRJNA366857 insdc_experiment_identifiers: @@ -256,10 +297,17 @@ data_generation_set: analyte_category: metatranscriptome associated_studies: - nmdc:sty-00-y0cq65zt - add_date: '2023-10-17' - mod_date: '2023-10-17' instrument_used: - - nmdc:inst-00-00000002 + - nmdc:inst-00-00000002 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 insdc_bioproject_identifiers: - bioproject:PRJNA366858 insdc_experiment_identifiers: @@ -278,10 +326,17 @@ data_generation_set: analyte_category: metatranscriptome associated_studies: - nmdc:sty-00-y0cq65zt - add_date: '2023-10-17' - mod_date: '2023-10-17' instrument_used: - - nmdc:inst-00-00000002 + - nmdc:inst-00-00000002 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 insdc_bioproject_identifiers: - bioproject:PRJNA366858 insdc_experiment_identifiers: @@ -291,97 +346,106 @@ data_object_set: type: nmdc:DataObject name: 001-1.fastq.gz description: Metagenome Raw Read 1 for nmdc:dgns-00-27qd9afz + data_category: instrument_data + data_object_type: Metagenome Raw Read 1 insdc_experiment_identifiers: - insdc.sra:ERX000000 md5_checksum: b1946ac92492d2347c6235b4d2611184 url: http://example.com/001-1.fastq.gz was_generated_by: nmdc:dgns-00-27qd9afz - data_category: instrument_data - data_object_type: Metagenome Raw Read 1 - id: nmdc:dobj-00-pj82ffu6 type: nmdc:DataObject name: 001-2.fastq.gz description: Metagenome Raw Read 2 for nmdc:dgns-00-27qd9afz + data_category: instrument_data + data_object_type: Metagenome Raw Read 2 insdc_experiment_identifiers: - insdc.sra:ERX000000 md5_checksum: 94baaad4d1347ec6e15ae35c88ee8bc8 url: http://example.com/001-2.fastq.gz was_generated_by: nmdc:dgns-00-27qd9afz - data_category: instrument_data - data_object_type: Metagenome Raw Read 2 - id: nmdc:dobj-00-8n9s2fyu type: nmdc:DataObject name: 002-1.fastq.gz description: Metagenome Raw Read 1 for nmdc:dgns-00-5gt9sh9v + data_category: instrument_data + data_object_type: Metagenome Raw Read 1 insdc_experiment_identifiers: - insdc.sra:ERX000000 md5_checksum: 916f4c31aaa35d6b867dae9a7f54270d url: http://example.com/002-1.fastq.gz was_generated_by: nmdc:dgns-00-5gt9sh9v - data_category: instrument_data - data_object_type: Metagenome Raw Read 1 - id: nmdc:dobj-00-pslmlcq4 type: nmdc:DataObject name: 002-2.fastq.gz description: Metagenome Raw Read 2 for nmdc:dgns-00-5gt9sh9v + data_category: instrument_data + data_object_type: Metagenome Raw Read 2 insdc_experiment_identifiers: - insdc.sra:ERX000000 md5_checksum: 764efa883dda1e11db47671c4a3bbd9e url: http://example.com/002-2.fastq.gz was_generated_by: nmdc:dgns-00-5gt9sh9v - data_category: instrument_data - data_object_type: Metagenome Raw Read 2 - id: nmdc:dobj-00-7r7pn0r2 type: nmdc:DataObject name: 002-metat.fastq.gz description: Metatranscriptome Raw Reads for nmdc:dgns-00-efijcf8z + data_category: instrument_data + data_object_type: Metatranscriptome Raw Reads insdc_experiment_identifiers: - insdc.sra:DRX000001 md5_checksum: 93ee47243d79217978cbed946c4e203a url: http://example.org/002-metat.fastq.gz was_generated_by: nmdc:dgns-00-efijcf8z - data_category: instrument_data - data_object_type: Metatranscriptome Raw Reads - id: nmdc:dobj-00-pbrhoxkv type: nmdc:DataObject name: 003-metat-a.fastq.gz description: Metatranscriptome Raw Reads for nmdc:dgns-00-5wfuh5vm + data_category: instrument_data + data_object_type: Metatranscriptome Raw Reads insdc_experiment_identifiers: - - insdc.sra:DRX000002 + - insdc.sra:DRX000002 md5_checksum: 8a7a02537074949bbef514cba5d669d8 url: http://example.org/003-metat-a.fastq.gz was_generated_by: nmdc:dgns-00-5wfuh5vm - data_category: instrument_data in_manifest: - - nmdc:manif-00-bhmhzfxh - data_object_type: Metatranscriptome Raw Reads + - nmdc:manif-00-bhmhzfxh - id: nmdc:dobj-00-1dgjoc8e type: nmdc:DataObject name: 003-metat-b.fastq.gz description: Metatranscriptome Raw Reads for nmdc:dgns-00-5wfuh5vm + data_category: instrument_data + data_object_type: Metatranscriptome Raw Reads insdc_experiment_identifiers: - - insdc.sra:DRX000002 + - insdc.sra:DRX000002 md5_checksum: 2dee554dd9bd8d2403e3b5430d19e3c3 url: http://example.org/003-metat-b.fastq.gz was_generated_by: nmdc:dgns-00-5wfuh5vm - data_category: instrument_data in_manifest: - - nmdc:manif-00-bhmhzfxh - data_object_type: Metatranscriptome Raw Reads + - nmdc:manif-00-bhmhzfxh manifest_set: - id: nmdc:manif-00-bhmhzfxh - type: 'nmdc:Manifest' + type: nmdc:Manifest manifest_category: poolable_replicates study_set: - id: nmdc:sty-00-y0cq65zt type: nmdc:Study name: asdfasdf study_category: research_study + emsl_project_identifiers: + - emsl.project:12312 + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - e12d0754-c00c-4417-9a25-6eb372054182 principal_investigator: type: nmdc:PersonValue email: pkalita@lbl.gov name: '' orcid: '' title: asdfasdf - emsl_project_identifiers: - - 'emsl.project:12312' diff --git a/tests/test_data/data/soil_sample_link_output.yaml b/tests/test_data/data/soil_sample_link_output.yaml index 6b37dd358..b1f13fe90 100644 --- a/tests/test_data/data/soil_sample_link_output.yaml +++ b/tests/test_data/data/soil_sample_link_output.yaml @@ -1,139 +1,174 @@ biosample_set: - - id: 'nmdc:bsm-00-4wn6isig' - type: 'nmdc:Biosample' - name: '00001' - associated_studies: ['nmdc:sty-00-y0cq65zt'] - env_broad_scale: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'urban biome [ENVO:01000249]' - term: - id: 'ENVO:01000249' - type: 'nmdc:OntologyClass' - name: 'urban biome' - env_local_scale: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'tunnel [ENVO:00000068]' - term: - id: 'ENVO:00000068' - type: 'nmdc:OntologyClass' - name: 'tunnel' - env_medium: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'bare soil [ENVO:01001616]' - term: - id: 'ENVO:01001616' - type: 'nmdc:OntologyClass' - name: 'bare soil' - collection_date: - type: 'nmdc:TimestampValue' - has_raw_value: '2022-01-15' - depth: - type: 'nmdc:QuantityValue' - has_raw_value: '0 - 1' - has_unit: 'm' - has_maximum_numeric_value: 1 - has_minimum_numeric_value: 0 - elev: 123.0 - env_package: - type: 'nmdc:TextValue' - has_raw_value: 'soil' - geo_loc_name: - type: 'nmdc:TextValue' - has_raw_value: 'USA: Nowhere, Oklahoma' - growth_facil: - type: 'nmdc:ControlledTermValue' - has_raw_value: 'greenhouse' - lat_lon: - type: 'nmdc:GeolocationValue' - has_raw_value: '35.211445 -98.464612' - latitude: 35.211445 - longitude: -98.464612 - samp_name: '00001' - samp_store_temp: - type: 'nmdc:QuantityValue' - has_raw_value: '-80 Cel' - has_unit: 'Cel' - has_numeric_value: -80 - store_cond: - type: 'nmdc:TextValue' - has_raw_value: 'frozen' - analysis_type: ['metagenomics'] - - id: 'nmdc:bsm-00-q8jtgev4' - type: 'nmdc:Biosample' - name: '00002' - associated_studies: [ 'nmdc:sty-00-y0cq65zt' ] - env_broad_scale: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'urban biome [ENVO:01000249]' - term: - id: 'ENVO:01000249' - type: 'nmdc:OntologyClass' - name: 'urban biome' - env_local_scale: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'tunnel [ENVO:00000068]' - term: - id: 'ENVO:00000068' - type: 'nmdc:OntologyClass' - name: 'tunnel' - env_medium: - type: 'nmdc:ControlledIdentifiedTermValue' - has_raw_value: 'bare soil [ENVO:01001616]' - term: - id: 'ENVO:01001616' - type: 'nmdc:OntologyClass' - name: 'bare soil' - collection_date: - type: 'nmdc:TimestampValue' - has_raw_value: '2022-01-15' - depth: - type: 'nmdc:QuantityValue' - has_raw_value: '0 - 1' - has_unit: 'm' - has_maximum_numeric_value: 1 - has_minimum_numeric_value: 0 - elev: 123.0 - env_package: - type: 'nmdc:TextValue' - has_raw_value: 'soil' - geo_loc_name: - type: 'nmdc:TextValue' - has_raw_value: 'USA: Nowhere, Oklahoma' - growth_facil: - type: 'nmdc:ControlledTermValue' - has_raw_value: 'greenhouse' - lat_lon: - type: 'nmdc:GeolocationValue' - has_raw_value: '35.211445 -98.464612' - latitude: 35.211445 - longitude: -98.464612 - samp_name: '00002' - samp_store_temp: - type: 'nmdc:QuantityValue' - has_raw_value: '-80 Cel' - has_unit: 'Cel' - has_numeric_value: -80 - store_cond: - type: 'nmdc:TextValue' - has_raw_value: 'frozen' - analysis_type: [ 'metagenomics' ] -processed_sample_set: - - id: 'nmdc:procsm-00-27qd9afz' - type: 'nmdc:ProcessedSample' - name: '00003-POOLED' +- id: nmdc:bsm-00-4wn6isig + type: nmdc:Biosample + name: '00001' + associated_studies: + - nmdc:sty-00-y0cq65zt + env_broad_scale: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: urban biome [ENVO:01000249] + term: + id: ENVO:01000249 + type: nmdc:OntologyClass + name: urban biome + env_local_scale: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: tunnel [ENVO:00000068] + term: + id: ENVO:00000068 + type: nmdc:OntologyClass + name: tunnel + env_medium: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: bare soil [ENVO:01001616] + term: + id: ENVO:01001616 + type: nmdc:OntologyClass + name: bare soil + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - 406e6ce5-ec5f-4617-badd-dc061358da24 + collection_date: + type: nmdc:TimestampValue + has_raw_value: '2022-01-15' + depth: + type: nmdc:QuantityValue + has_raw_value: 0 - 1 + has_unit: m + has_maximum_numeric_value: 1 + has_minimum_numeric_value: 0 + elev: 123.0 + env_package: + type: nmdc:TextValue + has_raw_value: soil + geo_loc_name: + type: nmdc:TextValue + has_raw_value: 'USA: Nowhere, Oklahoma' + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: greenhouse + lat_lon: + type: nmdc:GeolocationValue + has_raw_value: 35.211445 -98.464612 + latitude: 35.211445 + longitude: -98.464612 + samp_name: '00001' + samp_store_temp: + type: nmdc:QuantityValue + has_raw_value: -80 Cel + has_unit: Cel + has_numeric_value: -80 + store_cond: + type: nmdc:TextValue + has_raw_value: frozen + analysis_type: + - metagenomics +- id: nmdc:bsm-00-q8jtgev4 + type: nmdc:Biosample + name: '00002' + associated_studies: + - nmdc:sty-00-y0cq65zt + env_broad_scale: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: urban biome [ENVO:01000249] + term: + id: ENVO:01000249 + type: nmdc:OntologyClass + name: urban biome + env_local_scale: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: tunnel [ENVO:00000068] + term: + id: ENVO:00000068 + type: nmdc:OntologyClass + name: tunnel + env_medium: + type: nmdc:ControlledIdentifiedTermValue + has_raw_value: bare soil [ENVO:01001616] + term: + id: ENVO:01001616 + type: nmdc:OntologyClass + name: bare soil + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - 406e6ce5-ec5f-4617-badd-dc061358da24 + collection_date: + type: nmdc:TimestampValue + has_raw_value: '2022-01-15' + depth: + type: nmdc:QuantityValue + has_raw_value: 0 - 1 + has_unit: m + has_maximum_numeric_value: 1 + has_minimum_numeric_value: 0 + elev: 123.0 + env_package: + type: nmdc:TextValue + has_raw_value: soil + geo_loc_name: + type: nmdc:TextValue + has_raw_value: 'USA: Nowhere, Oklahoma' + growth_facil: + type: nmdc:ControlledTermValue + has_raw_value: greenhouse + lat_lon: + type: nmdc:GeolocationValue + has_raw_value: 35.211445 -98.464612 + latitude: 35.211445 + longitude: -98.464612 + samp_name: '00002' + samp_store_temp: + type: nmdc:QuantityValue + has_raw_value: -80 Cel + has_unit: Cel + has_numeric_value: -80 + store_cond: + type: nmdc:TextValue + has_raw_value: frozen + analysis_type: + - metagenomics material_processing_set: - - id: 'nmdc:poolp-00-a5vpuemo' - type: 'nmdc:Pooling' - has_input: ['nmdc:bsm-00-4wn6isig', 'nmdc:bsm-00-q8jtgev4'] - has_output: ['nmdc:procsm-00-27qd9afz'] +- id: nmdc:poolp-00-a5vpuemo + type: nmdc:Pooling + has_input: + - nmdc:bsm-00-4wn6isig + - nmdc:bsm-00-q8jtgev4 + has_output: + - nmdc:procsm-00-27qd9afz +processed_sample_set: +- id: nmdc:procsm-00-27qd9afz + type: nmdc:ProcessedSample + name: 00003-POOLED study_set: - - id: 'nmdc:sty-00-y0cq65zt' - type: 'nmdc:Study' - name: 'A test submission where sample_link is used to generate processed sample records' - study_category: research_study - principal_investigator: - type: 'nmdc:PersonValue' - email: 'test.testerson@example.com' - name: 'Test Testerson' - orcid: '0000-0000-0000-000X' - title: 'A test submission where sample_link is used to generate processed sample records' +- id: nmdc:sty-00-y0cq65zt + type: nmdc:Study + name: A test submission where sample_link is used to generate processed sample records + study_category: research_study + provenance_metadata: + type: nmdc:ProvenanceMetadata + add_date: '2023-10-17T09:00:00+00:00' + git_url: https://github.com/microbiomedata/nmdc-runtime + mod_date: '2023-10-17T09:00:00+00:00' + version: 999.9.9 + source_system_of_record: NMDC_Submission_Portal + submission_portal_identifier: + - 406e6ce5-ec5f-4617-badd-dc061358da24 + principal_investigator: + type: nmdc:PersonValue + email: test.testerson@example.com + name: Test Testerson + orcid: 0000-0000-0000-000X + title: A test submission where sample_link is used to generate processed sample + records diff --git a/tests/test_data/test_submission_portal_translator.py b/tests/test_data/test_submission_portal_translator.py index c961c691a..66d661878 100644 --- a/tests/test_data/test_submission_portal_translator.py +++ b/tests/test_data/test_submission_portal_translator.py @@ -497,20 +497,32 @@ def test_instruments(test_minter): ], ) def test_get_database(test_minter, monkeypatch, data_file_base): - # OmicsProcess objects have an add_date and a mod_date slot that are populated with the - # current date. In order to compare with a static expected output we need to patch - # the datetime.now() call to return a predefined date. + # ProvenanceMetadata objects have an add_date and a mod_date slot that are populated with the + # current datetime. In order to compare with a static expected output we need to patch + # the datetime.now() call to return a predefined datetime. the_time = datetime.datetime(2023, 10, 17, 9, 0, 0) class FrozenDatetime(datetime.datetime): @classmethod def now(cls, **kwargs): + # If tz was provided, make the_time timezone aware with that tz, otherwise return a + # naive datetime. We could hardcode the timzeone in the_time, but this makes the test + # a little more robust by allowing the translator to attempt to use naive datetimes. + # This would cause the validation at the end of this test to fail. + if "tz" in kwargs: + return the_time.replace(tzinfo=kwargs["tz"]) return the_time + def mock_version(package_name): + if package_name == "nmdc_runtime": + return "999.9.9" + raise ValueError(f"Unexpected package name: {package_name}") + monkeypatch.setattr( "nmdc_runtime.site.translation.submission_portal_translator.datetime", FrozenDatetime, ) + monkeypatch.setattr("nmdc_runtime.site.translation.submission_portal_translator.version", mock_version) mongo_db = get_mongo_test_db() data_path = Path(__file__).parent / "data" From 05209f3b78e1ac2b25503dc058db38f2a0461503 Mon Sep 17 00:00:00 2001 From: Patrick Kalita Date: Wed, 11 Mar 2026 17:33:11 -0700 Subject: [PATCH 3/5] Populate provenance_metadata slot on Study, Biosample, and NucleotideSequencing objects --- .../site/translation/gold_translator.py | 42 +++++++++---------- .../submission_portal_translator.py | 14 +------ nmdc_runtime/site/translation/translator.py | 23 ++++++++++ tests/test_data/test_gold_translator.py | 15 ------- .../test_submission_portal_translator.py | 7 +--- 5 files changed, 48 insertions(+), 53 deletions(-) diff --git a/nmdc_runtime/site/translation/gold_translator.py b/nmdc_runtime/site/translation/gold_translator.py index 665dae11d..044d156c7 100644 --- a/nmdc_runtime/site/translation/gold_translator.py +++ b/nmdc_runtime/site/translation/gold_translator.py @@ -144,21 +144,6 @@ def _get_pi(self, gold_entity: JSON_OBJECT) -> Union[nmdc.PersonValue, None]: type="nmdc:PersonValue", ) - def _get_mod_date(self, gold_entity: JSON_OBJECT) -> Union[str, None]: - """Get a mod_date for a GOLD entity - - Return the `modDate` field if it exists and is not `None`. Otherwise return - the `addDate` field if it exists. Otherwise return `None`. - - :param gold_entity: GOLD entity with `modDate` or `addDate` fields - :return: Date string or `None` - """ - mod_date = gold_entity.get("modDate") - if mod_date is not None: - return mod_date - - return gold_entity.get("addDate") - def _get_insdc_biosample_identifiers(self, gold_biosample_id: str) -> List[str]: """Get a list of INDSC biosample identifiers related to the given GOLD biosample identifier @@ -519,7 +504,10 @@ def _get_field_site_name(self, gold_biosample: JSON_OBJECT) -> Union[str, None]: return samp_name[:last_space_index] def _translate_study( - self, gold_study: JSON_OBJECT, nmdc_study_id: str + self, + gold_study: JSON_OBJECT, + nmdc_study_id: str, + provenance_metadata: nmdc.ProvenanceMetadata, ) -> nmdc.Study: """Translate a GOLD study object into an `nmdc:Study` object. @@ -530,6 +518,7 @@ def _translate_study( :param gold_study: GOLD study object :param nmdc_study_id: Minted nmdc:Study identifier for the translated object + :param provenance_metadata: ProvenanceMetadata object to attach to the translated object :return: nmdc:Study object """ return nmdc.Study( @@ -539,6 +528,7 @@ def _translate_study( ), id=nmdc_study_id, name=gold_study.get("studyName"), + provenance_metadata=provenance_metadata, principal_investigator=self._get_pi(gold_study), title=gold_study.get("studyName"), type="nmdc:Study", @@ -551,6 +541,7 @@ def _translate_biosample( nmdc_biosample_id: str, nmdc_study_id: str, nmdc_field_site_id: str, + provenance_metadata: nmdc.ProvenanceMetadata, ) -> nmdc.Biosample: """Translate a GOLD biosample object into an `nmdc:Biosample` object. @@ -563,11 +554,11 @@ def _translate_biosample( :param nmdc_biosample_id: Minted nmdc:Biosample identifier for the translated object :param nmdc_study_id: Minted nmdc:Study identifier for the related Study :param nmdc_field_site_id: Minted nmdc:FieldResearchSite identifier for the related site + :param provenance_metadata: ProvenanceMetadata object to attach to the translated object :return: nmdc:Biosample object """ gold_biosample_id = gold_biosample["biosampleGoldId"] return nmdc.Biosample( - add_date=gold_biosample.get("addDate"), alt=self._get_quantity_value(gold_biosample, "altitudeInMeters", unit="m"), collected_from=nmdc_field_site_id, collection_date=self._get_collection_date(gold_biosample), @@ -598,12 +589,12 @@ def _translate_biosample( ), lat_lon=self._get_lat_lon(gold_biosample), location=gold_biosample.get("isoCountry"), - mod_date=self._get_mod_date(gold_biosample), name=gold_biosample.get("biosampleName"), ncbi_taxonomy_name=gold_biosample.get("ncbiTaxName"), nitrite=self._get_quantity_value(gold_biosample, "nitrateConcentration"), ph=gold_biosample.get("ph"), pressure=self._get_quantity_value(gold_biosample, "pressure"), + provenance_metadata=provenance_metadata, samp_name=self._get_samp_name(gold_biosample), samp_taxon_id=self._get_samp_taxon_id(gold_biosample), sample_collection_site=gold_biosample.get( @@ -626,6 +617,7 @@ def _translate_nucleotide_sequencing( nmdc_nucleotide_sequencing_id: str, nmdc_biosample_id: str, nmdc_study_id: str, + provenance_metadata: nmdc.ProvenanceMetadata, ): """Translate a GOLD project object into an `nmdc:NucleotideSequencing` object. @@ -638,6 +630,7 @@ def _translate_nucleotide_sequencing( :param nmdc_omics_processing_id: Minted nmdc:NucleotideSequencing identifier for the translated object :param nmdc_biosample_id: Minted nmdc:Biosample identifier for the related Biosample :param nmdc_study_id: Minted nmdc:Study identifier for the related Study + :param provenance_metadata: ProvenanceMetadata object to attach to the translated object :return: nmdc:NucleotideSequencing object """ gold_project_id = gold_project["projectGoldId"] @@ -660,11 +653,10 @@ def _translate_nucleotide_sequencing( ncbi_project_name=gold_project.get("projectName"), type="nmdc:NucleotideSequencing", has_input=nmdc_biosample_id, - add_date=gold_project.get("addDate"), - mod_date=self._get_mod_date(gold_project), insdc_bioproject_identifiers=insdc_bioproject_identifiers, principal_investigator=self._get_pi(gold_project), processing_institution=self._get_processing_institution(gold_project), + provenance_metadata=provenance_metadata, instrument_used=self._get_instrument(gold_project), analyte_category=( gold_project.get("sequencingStrategy").lower() @@ -722,7 +714,13 @@ def get_database(self) -> nmdc.Database: zip(gold_project_ids, nmdc_nucleotide_sequencing_ids) ) - database.study_set = [self._translate_study(self.study, nmdc_study_id)] + provenance_metadata = self._get_provenance_metadata( + source_system_of_record=nmdc.SourceSystemEnum.GOLD.text, + ) + + database.study_set = [ + self._translate_study(self.study, nmdc_study_id, provenance_metadata) + ] database.biosample_set = [ self._translate_biosample( biosample, @@ -733,6 +731,7 @@ def get_database(self) -> nmdc.Database: nmdc_field_site_id=gold_biosample_to_nmdc_field_site_ids.get( biosample["biosampleGoldId"], None ), + provenance_metadata=provenance_metadata, ) for biosample in self.biosamples ] @@ -751,6 +750,7 @@ def get_database(self) -> nmdc.Database: project["biosampleGoldId"] ], nmdc_study_id=nmdc_study_id, + provenance_metadata=provenance_metadata, ) for project in self.projects ] diff --git a/nmdc_runtime/site/translation/submission_portal_translator.py b/nmdc_runtime/site/translation/submission_portal_translator.py index 0ce3e21ce..283f2ea11 100644 --- a/nmdc_runtime/site/translation/submission_portal_translator.py +++ b/nmdc_runtime/site/translation/submission_portal_translator.py @@ -801,20 +801,10 @@ def get_database(self) -> nmdc.Database: metadata_submission_data = self.metadata_submission.get( "metadata_submission", {} ) - - now = datetime.now(tz=timezone.utc) - provenance_metadata = nmdc.ProvenanceMetadata( - add_date=now, - git_url="https://github.com/microbiomedata/nmdc-runtime", - mod_date=now, - source_system_of_record=nmdc.SourceSystemEnum( - nmdc.SourceSystemEnum.NMDC_Submission_Portal - ), + provenance_metadata = self._get_provenance_metadata( + source_system_of_record=nmdc.SourceSystemEnum.NMDC_Submission_Portal.text, submission_portal_identifier=submission_id, - type="nmdc:ProvenanceMetadata", - version=version("nmdc_runtime"), ) - # Generate one Study instance based on the metadata submission, if a study_id wasn't provided if self.study_id: nmdc_study_id = self.study_id diff --git a/nmdc_runtime/site/translation/translator.py b/nmdc_runtime/site/translation/translator.py index 0e6429648..eecb1e593 100644 --- a/nmdc_runtime/site/translation/translator.py +++ b/nmdc_runtime/site/translation/translator.py @@ -1,7 +1,9 @@ import logging import re from abc import ABC, abstractmethod +from datetime import datetime, timezone from decimal import Decimal +from importlib.metadata import version from typing import Any, Callable, Dict, List, Optional, Union from nmdc_schema import nmdc @@ -90,3 +92,24 @@ def _parse_quantity_value( quantity_value_kwargs["has_unit"] = match.group(3) return nmdc.QuantityValue(**quantity_value_kwargs) + + def _get_provenance_metadata( + self, + *, + source_system_of_record: str, + submission_portal_identifier: Optional[str] = None, + ) -> nmdc.ProvenanceMetadata: + now = datetime.now(tz=timezone.utc) + provide_metadata = nmdc.ProvenanceMetadata( + add_date=now, + git_url="https://github.com/microbiomedata/nmdc-runtime", + mod_date=now, + source_system_of_record=nmdc.SourceSystemEnum(source_system_of_record), + type="nmdc:ProvenanceMetadata", + version=version("nmdc_runtime"), + ) + if submission_portal_identifier: + provide_metadata.submission_portal_identifier = [ + submission_portal_identifier + ] + return provide_metadata diff --git a/tests/test_data/test_gold_translator.py b/tests/test_data/test_gold_translator.py index ea28291be..1d56e5e78 100644 --- a/tests/test_data/test_gold_translator.py +++ b/tests/test_data/test_gold_translator.py @@ -95,21 +95,6 @@ def test_get_pi(): assert pi_person_value is None -def test_get_mod_date(): - translator = GoldStudyTranslator() - - mod_date = translator._get_mod_date( - {"modDate": "2023-03-02", "addDate": "2023-01-01"} - ) - assert mod_date == "2023-03-02" - - mod_date = translator._get_mod_date({"modDate": None, "addDate": "2023-01-01"}) - assert mod_date == "2023-01-01" - - mod_date = translator._get_mod_date({"modDate": None, "addDate": None}) - assert mod_date is None - - def test_get_insdc_biosample_identifiers(): projects = [ { diff --git a/tests/test_data/test_submission_portal_translator.py b/tests/test_data/test_submission_portal_translator.py index 66d661878..d5d2034da 100644 --- a/tests/test_data/test_submission_portal_translator.py +++ b/tests/test_data/test_submission_portal_translator.py @@ -518,11 +518,8 @@ def mock_version(package_name): return "999.9.9" raise ValueError(f"Unexpected package name: {package_name}") - monkeypatch.setattr( - "nmdc_runtime.site.translation.submission_portal_translator.datetime", - FrozenDatetime, - ) - monkeypatch.setattr("nmdc_runtime.site.translation.submission_portal_translator.version", mock_version) + monkeypatch.setattr("nmdc_runtime.site.translation.translator.datetime", FrozenDatetime) + monkeypatch.setattr("nmdc_runtime.site.translation.translator.version", mock_version) mongo_db = get_mongo_test_db() data_path = Path(__file__).parent / "data" From 3d19c4cc7ff003958c737709912cfc0ff2494754 Mon Sep 17 00:00:00 2001 From: Patrick Kalita Date: Thu, 12 Mar 2026 09:43:19 -0700 Subject: [PATCH 4/5] Add migration notebook for nmdc-schema 11.17.0 --- .../migrate_11_16_1_to_11_17_0.ipynb | 832 ++++++++++++++++++ 1 file changed, 832 insertions(+) create mode 100644 db/migrations/notebooks/migrate_11_16_1_to_11_17_0.ipynb diff --git a/db/migrations/notebooks/migrate_11_16_1_to_11_17_0.ipynb b/db/migrations/notebooks/migrate_11_16_1_to_11_17_0.ipynb new file mode 100644 index 000000000..0bb0acd49 --- /dev/null +++ b/db/migrations/notebooks/migrate_11_16_1_to_11_17_0.ipynb @@ -0,0 +1,832 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "86266489462d10d5", + "metadata": {}, + "source": "# Migrate MongoDB database from `nmdc-schema` `v11.16.1` to `v11.17.0`" + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "## Introduction\n", + "\n", + "This notebook will be used to migrate the database from `v11.16.1` ([released](https://github.com/microbiomedata/nmdc-schema/releases/tag/v11.16.1) February 9, 2026) to `v11.17.0` ([released](https://github.com/microbiomedata/nmdc-schema/releases/tag/v11.17.0) March 11, 2026).\n", + "\n", + "### Notice\n", + "\n", + "In each migration notebook between schema `v10.9.1` and `v11.3.0`, we dumped **all collections** from the Mongo database. We started doing that once migrations involved _collection_-level operations (i.e., creating, renaming, and deleting them), as opposed to only _document_-level operations.\n", + "\n", + "In _this_ migration notebook, we dump only **specific collection** from the Mongo database. We opted to do this after understanding the scope of the `Migrator` class imported by this notebook. This eliminates some overhead from the migration process (i.e. dumping and restoring unrelated collections)." + ], + "id": "f2b7a851361edae6" + }, + { + "metadata": {}, + "cell_type": "code", + "source": [ + "# Confirm that the `COLLECTION_NAMES` list below contains the names of all collections\n", + "# accessed by the migrator—including any partial migrators that it invokes—we will be running.\n", + "COLLECTION_NAMES = list({\n", + " \"biosample_set\",\n", + " \"data_generation_set\",\n", + "})" + ], + "id": "75c9c5379e521cd2", + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "dffc8fac414e6b8a", + "metadata": {}, + "source": [ + "## Prerequisites" + ] + }, + { + "cell_type": "markdown", + "id": "f033049a3dd6d9d", + "metadata": {}, + "source": [ + "### 1. Coordinate with stakeholders.\n", + "\n", + "We will be enacting full Runtime and Database downtime for this migration. Ensure stakeholders are aware of that." + ] + }, + { + "cell_type": "markdown", + "id": "4fedebacf9793fc9", + "metadata": {}, + "source": [] + }, + { + "cell_type": "markdown", + "id": "8be6e542187f9a62", + "metadata": {}, + "source": [ + "### 2. Set up notebook environment.\n", + "\n", + "Here, you'll prepare an environment for running this notebook.\n", + "\n", + "1. Start a **MongoDB server** on your local machine (and ensure it does **not** already contain a database having the name specified in the notebook configuration file).\n", + " 1. You can start a [Docker](https://hub.docker.com/_/mongo)-based MongoDB server at `localhost:27055` by running the following command. A MongoDB server started this way will be accessible without a username or password.\n" + ] + }, + { + "cell_type": "code", + "id": "14b2b2c65f62c309", + "metadata": {}, + "source": [ + "# Migrators can now use transactions, so start the MongoDB server in replica set mode.\n", + "!/usr/local/bin/docker run \\\n", + " --rm \\\n", + " --detach \\\n", + " --name mongo-migration-transformer \\\n", + " -p 27055:27017 \\\n", + " -v ./.docker/01-init.js:/docker-entrypoint-initdb.d/01-init.js \\\n", + " mongo:8.2.3 \\\n", + " --replSet rs0" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "d516ac8a1c15c660", + "metadata": {}, + "source": [ + "2. Create and populate a **notebook configuration file** named `.notebook.env`.\n", + " > You can use `.notebook.env.example` as a template." + ] + }, + { + "cell_type": "markdown", + "id": "48d25f7b40726502", + "metadata": {}, + "source": [ + "## Procedure" + ] + }, + { + "cell_type": "markdown", + "id": "e025d76e8fcdc5bf", + "metadata": {}, + "source": [ + "### Install Python packages\n", + "\n", + "In this step, you'll [install](https://saturncloud.io/blog/what-is-the-difference-between-and-in-jupyter-notebooks/) the Python packages upon which this notebook depends.\n", + "\n", + "> Note: If the output of this cell says \"Note: you may need to restart the kernel to use updated packages\", restart the kernel (not the notebook cells), then proceed to the next cell.\n", + "\n", + "##### References\n", + "\n", + "| Description | Link |\n", + "|---------------------------------------------------------------------------------|--------------------------------------------------------|\n", + "| NMDC Schema PyPI package | https://pypi.org/project/nmdc-schema |\n", + "| How to `pip install` from a Git branch
instead of PyPI | https://stackoverflow.com/a/20101940 |" + ] + }, + { + "metadata": {}, + "cell_type": "code", + "source": [ + "%pip install --upgrade pip\n", + "%pip install -r requirements.txt\n", + "%pip install nmdc-schema==11.17.0" + ], + "id": "680540e2c80954a4", + "outputs": [], + "execution_count": null + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "### Import Python dependencies\n", + "\n", + "Import the Python objects upon which this notebook depends.\n", + "\n", + "#### References\n", + "\n", + "| Description | Link |\n", + "|----------------------------------------|-------------------------------------------------------------------------------------------------------|\n", + "| Dynamically importing a Python module | [`importlib.import_module`](https://docs.python.org/3/library/importlib.html#importlib.import_module) |\n", + "| Confirming something is a Python class | [`inspect.isclass`](https://docs.python.org/3/library/inspect.html#inspect.isclass) |" + ], + "id": "f8419eb0ef2302ee" + }, + { + "metadata": {}, + "cell_type": "code", + "source": [ + "# Source: https://github.com/microbiomedata/nmdc-schema/blob/main/nmdc_schema/migrators/migrator_from_11_16_1_to_11_17_0.py\n", + "MIGRATOR_MODULE_NAME = \"migrator_from_11_16_1_to_11_17_0\"" + ], + "id": "b342b67af78adb4b", + "outputs": [], + "execution_count": null + }, + { + "metadata": {}, + "cell_type": "code", + "source": [ + "# Standard library packages:\n", + "import subprocess\n", + "from typing import List\n", + "import importlib\n", + "from inspect import isclass\n", + "\n", + "# Third-party packages:\n", + "import pymongo\n", + "from linkml.validator import Validator, ValidationReport\n", + "from linkml.validator.plugins import JsonschemaValidationPlugin\n", + "from nmdc_schema.nmdc_schema_validation_plugin import NmdcSchemaValidationPlugin\n", + "from nmdc_schema.nmdc_data import get_nmdc_schema_definition\n", + "from nmdc_schema.migrators.adapters.mongo_adapter import MongoAdapter\n", + "from linkml_runtime import SchemaView\n", + "\n", + "# First-party packages:\n", + "from helpers import Config, setup_logger, get_collection_names_from_schema, derive_schema_class_name_from_document\n", + "from bookkeeper import Bookkeeper, MigrationEvent\n", + "\n", + "# Dynamic imports:\n", + "migrator_module = importlib.import_module(f\".{MIGRATOR_MODULE_NAME}\", package=\"nmdc_schema.migrators\")\n", + "Migrator = getattr(migrator_module, \"Migrator\") # gets the class\n", + "assert isclass(Migrator), \"Failed to import Migrator class.\"" + ], + "id": "272a0275343c4b70", + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "b496f19c849e733d", + "metadata": {}, + "source": [ + "### Parse configuration files\n", + "\n", + "Parse the notebook and Mongo configuration files." + ] + }, + { + "cell_type": "code", + "id": "7ba2424242fb74e4", + "metadata": {}, + "source": [ + "cfg = Config()\n", + "\n", + "# Define some aliases we can use to make the shell commands in this notebook easier to read.\n", + "mongodump = cfg.mongodump_path\n", + "mongorestore = cfg.mongorestore_path\n", + "mongosh = cfg.mongosh_path\n", + "\n", + "# Make the base CLI options for Mongo shell commands.\n", + "origin_mongo_cli_base_options = Config.make_mongo_cli_base_options(\n", + " mongo_host=cfg.origin_mongo_host,\n", + " mongo_port=cfg.origin_mongo_port,\n", + " mongo_username=cfg.origin_mongo_username,\n", + " mongo_password=cfg.origin_mongo_password,\n", + ")\n", + "transformer_mongo_cli_base_options = Config.make_mongo_cli_base_options(\n", + " mongo_host=cfg.transformer_mongo_host,\n", + " mongo_port=cfg.transformer_mongo_port,\n", + " mongo_username=cfg.transformer_mongo_username,\n", + " mongo_password=cfg.transformer_mongo_password,\n", + ")\n", + "\n", + "# Perform a sanity test of the application paths.\n", + "!{mongodump} --version\n", + "!{mongorestore} --version\n", + "!{mongosh} --version" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "6ab8f0802ebed34", + "metadata": {}, + "source": [ + "### Create MongoDB clients\n", + "\n", + "Create MongoDB clients you can use to access the \"origin\" and \"transformer\" MongoDB servers." + ] + }, + { + "cell_type": "code", + "id": "a883186068ed590d", + "metadata": {}, + "source": [ + "# Mongo client for \"origin\" MongoDB server.\n", + "origin_mongo_client = pymongo.MongoClient(host=cfg.origin_mongo_host,\n", + " port=int(cfg.origin_mongo_port),\n", + " username=cfg.origin_mongo_username,\n", + " password=cfg.origin_mongo_password,\n", + " directConnection=True)\n", + "\n", + "# Mongo client for \"transformer\" MongoDB server.\n", + "transformer_mongo_client = pymongo.MongoClient(host=cfg.transformer_mongo_host,\n", + " port=int(cfg.transformer_mongo_port),\n", + " username=cfg.transformer_mongo_username,\n", + " password=cfg.transformer_mongo_password,\n", + " directConnection=True)\n", + "\n", + "# Perform sanity tests of those MongoDB clients' abilities to access their respective MongoDB servers.\n", + "with pymongo.timeout(3):\n", + " # Display the MongoDB server version (running on the \"origin\" Mongo server).\n", + " print(\"Origin Mongo server version: \" + origin_mongo_client.server_info()[\"version\"])\n", + "\n", + " # Sanity test: Ensure the origin database exists.\n", + " assert cfg.origin_mongo_database_name in origin_mongo_client.list_database_names(), \"Origin database does not exist.\"\n", + "\n", + " # Display the MongoDB server version (running on the \"transformer\" Mongo server).\n", + " print(\"Transformer Mongo server version: \" + transformer_mongo_client.server_info()[\"version\"])\n", + "\n", + " # Sanity test: Ensure the transformation database does not exist.\n", + " assert cfg.transformer_mongo_database_name not in transformer_mongo_client.list_database_names(), \"Transformation database already exists.\"" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "846e97bb0b6544ae", + "metadata": {}, + "source": [ + "Delete the transformer database from the transformer MongoDB server if that database already exists there (e.g. if it was left over from an experiment).\n", + "\n", + "#### References\n", + "\n", + "| Description | Link |\n", + "|------------------------------|---------------------------------------------------------------|\n", + "| Python's `subprocess` module | https://docs.python.org/3/library/subprocess.html |\n", + "| `mongosh` CLI options | https://www.mongodb.com/docs/mongodb-shell/reference/options/ |" + ] + }, + { + "cell_type": "code", + "id": "331093f3ce6c50a8", + "metadata": {}, + "source": [ + "# Note: I run this command via Python's `subprocess` module instead of via an IPython magic `!` command\n", + "# because I expect to eventually use regular Python scripts—not Python notebooks—for migrations.\n", + "shell_command = f\"\"\"\n", + " {cfg.mongosh_path} {transformer_mongo_cli_base_options} \\\n", + " --eval 'use {cfg.transformer_mongo_database_name}' \\\n", + " --eval 'db.dropDatabase()' \\\n", + " --quiet\n", + "\"\"\"\n", + "completed_process = subprocess.run(shell_command, shell=True)\n", + "print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "8839f276a4402775", + "metadata": {}, + "source": [ + "### Create validator\n", + "\n", + "In this step, you'll create a validator that can be used to check whether data conforms to the NMDC Schema. You'll use it later, to do that.\n", + "\n", + "#### References\n", + "\n", + "| Description | Link |\n", + "|------------------------------|------------------------------------------------------------------------------|\n", + "| LinkML's `Validator` class | https://linkml.io/linkml/code/validator.html#linkml.validator.Validator |\n", + "| Validating data using LinkML | https://linkml.io/linkml/data/validating-data.html#validation-in-python-code |" + ] + }, + { + "cell_type": "code", + "id": "cd01c9f52db7f6e1", + "metadata": {}, + "source": [ + "schema_definition = get_nmdc_schema_definition()\n", + "validator = Validator(\n", + " schema=schema_definition,\n", + " validation_plugins=[\n", + " JsonschemaValidationPlugin(closed=True),\n", + " NmdcSchemaValidationPlugin()\n", + " ],\n", + ")\n", + "\n", + "# Perform a sanity test of the validator.\n", + "assert callable(validator.validate), \"Failed to instantiate a validator\"\n", + "\n", + "schema_definition.version" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "7d45f8a5d3aa9f3", + "metadata": {}, + "source": [ + "### Create SchemaView\n", + "\n", + "In this step, you'll instantiate a `SchemaView` that is bound to the destination schema.\n", + "\n", + "#### References\n", + "\n", + "| Description | Link |\n", + "|-----------------------------|-----------------------------------------------------|\n", + "| LinkML's `SchemaView` class | https://linkml.io/linkml/developers/schemaview.html |" + ] + }, + { + "cell_type": "code", + "id": "1778be5cd7b68ad2", + "metadata": {}, + "source": [ + "schema_view = SchemaView(get_nmdc_schema_definition())\n", + "\n", + "# As a sanity test, confirm we can use the `SchemaView` instance to access a schema class.\n", + "schema_view.get_class(class_name=\"Database\")[\"name\"]" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "2413c292652103a2", + "metadata": {}, + "source": [ + "### Revoke access from the \"origin\" MongoDB server\n", + "\n", + "We revoke both \"write\" and \"read\" access to the server.\n", + "\n", + "#### Rationale\n", + "\n", + "We revoke \"write\" access so people don't make changes to the original data while the migration is happening, given that the migration ends with an overwriting of the original data (which would wipe out any changes made in the meantime).\n", + "\n", + "We also revoke \"read\" access. The revocation of \"read\" access is technically optional, but (a) the JavaScript mongosh script will be easier for me to maintain if it revokes everything and (b) this prevents people from reading data during the restore step, during which the database may not be self-consistent.\n", + "\n", + "#### References\n", + "\n", + "| Description | Link |\n", + "|--------------------------------|-----------------------------------------------------------|\n", + "| Running a script via `mongosh` | https://www.mongodb.com/docs/mongodb-shell/write-scripts/ |" + ] + }, + { + "cell_type": "code", + "id": "7eef0f264af138f", + "metadata": {}, + "source": [ + "shell_command = f\"\"\"\n", + " {cfg.mongosh_path} {origin_mongo_cli_base_options} \\\n", + " --file='mongosh-scripts/revoke-privileges.mongo.js' \\\n", + " --quiet\n", + "\"\"\"\n", + "completed_process = subprocess.run(shell_command, shell=True)\n", + "print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "1295c7a43cfbd083", + "metadata": {}, + "source": [ + "### Delete obsolete dumps from previous migrations\n", + "\n", + "Delete any existing dumps before we create new ones in this notebook. This is so the dumps you generate with this notebook do not get merged with any unrelated ones." + ] + }, + { + "cell_type": "code", + "id": "d5d721e946414514", + "metadata": {}, + "source": [ + "!rm -rf {cfg.origin_dump_folder_path}\n", + "!rm -rf {cfg.transformer_dump_folder_path}" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "cd224e2f5d6ccd5", + "metadata": {}, + "source": [ + "### Dump collection(s) from the \"origin\" MongoDB server\n", + "\n", + "Use `mongodump` to dump specific collection(s) **from** the \"origin\" MongoDB server **into** a local directory.\n", + "\n", + "> Note: The reason we do this in a loop is that the `mongodump` program does not allow the user to specify multiple collections to dump. A distinct collection will be dumped on each iteration of the loop.\n" + ] + }, + { + "cell_type": "code", + "id": "725dcb33c1728521", + "metadata": {}, + "source": [ + "# Dump the specified collections from the \"origin\" database.\n", + "for collection_name in COLLECTION_NAMES:\n", + " shell_command = f\"\"\"\n", + " {mongodump} {origin_mongo_cli_base_options} \\\n", + " --db='{cfg.origin_mongo_database_name}' \\\n", + " --out='{cfg.origin_dump_folder_path}' \\\n", + " --gzip \\\n", + " --collection='{collection_name}'\n", + " \"\"\"\n", + " completed_process = subprocess.run(shell_command, shell=True)\n", + " print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "9a7865d1a9d31945", + "metadata": {}, + "source": [ + "### Load the dumped collection(s) into the \"transformer\" MongoDB server\n", + "\n", + "Use `mongorestore` to load the dumped collection(s) **from** the local directory **into** the \"transformer\" MongoDB server.\n", + "\n", + "References:\n", + "- https://www.mongodb.com/docs/database-tools/mongorestore/#std-option-mongorestore\n", + "- https://www.mongodb.com/docs/database-tools/mongorestore/mongorestore-examples/#copy-clone-a-database" + ] + }, + { + "cell_type": "code", + "id": "6c047360d46e09cb", + "metadata": {}, + "source": [ + "# Restore the dumped collections to the \"transformer\" MongoDB server.\n", + "shell_command = f\"\"\"\n", + " {mongorestore} {transformer_mongo_cli_base_options} \\\n", + " --nsFrom='{cfg.origin_mongo_database_name}.*' \\\n", + " --nsTo='{cfg.transformer_mongo_database_name}.*' \\\n", + " --dir='{cfg.origin_dump_folder_path}' \\\n", + " --stopOnError \\\n", + " --drop \\\n", + " --gzip\n", + "\"\"\"\n", + "completed_process = subprocess.run(shell_command, shell=True)\n", + "print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "1d3e516513c3b7a8", + "metadata": {}, + "source": [ + "### Transform the collections within the \"transformer\" MongoDB server\n", + "\n", + "Use the migrator to transform the collections in the \"transformer\" database.\n", + "\n", + "> Reminder: The database transformation functions are defined in the `nmdc-schema` Python package installed earlier.\n", + "\n", + "> Reminder: The \"origin\" database is **not** affected by this step." + ] + }, + { + "cell_type": "code", + "id": "282941a1a07a94cd", + "metadata": {}, + "source": [ + "# Instantiate a MongoAdapter bound to the \"transformer\" database.\n", + "adapter = MongoAdapter(\n", + " database=transformer_mongo_client[cfg.transformer_mongo_database_name],\n", + " on_collection_created=lambda name: print(f'Created collection \"{name}\"'),\n", + " on_collection_renamed=lambda old_name, name: print(f'Renamed collection \"{old_name}\" to \"{name}\"'),\n", + " on_collection_deleted=lambda name: print(f'Deleted collection \"{name}\"'),\n", + ")\n", + "\n", + "# Instantiate a Migrator bound to that adapter.\n", + "logger = setup_logger()\n", + "migrator = Migrator(adapter=adapter, logger=logger)\n", + "\n", + "# Execute the Migrator's `upgrade` method to perform the migration.\n", + "migrator.upgrade(commit_changes=True)" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "673e10ac5be8f3d8", + "metadata": {}, + "source": [ + "### Validate the transformed documents\n", + "\n", + "Now that we have transformed the database, validate each document in each collection in the \"transformer\" MongoDB server." + ] + }, + { + "cell_type": "code", + "id": "b70d83efc93ba0e8", + "metadata": {}, + "source": [ + "# Get the names of all collections.\n", + "collection_names: List[str] = get_collection_names_from_schema(schema_view)\n", + "\n", + "# Ensure that, if the (large) \"functional_annotation_agg\" collection is present in `collection_names`,\n", + "# it goes at the end of the list we process. That way, we can find out about validation errors in\n", + "# other collections without having to wait for that (large) collection to be validated.\n", + "ordered_collection_names = sorted(collection_names.copy())\n", + "large_collection_name = \"functional_annotation_agg\"\n", + "if large_collection_name in ordered_collection_names:\n", + " ordered_collection_names = list(filter(lambda n: n != large_collection_name, ordered_collection_names))\n", + " ordered_collection_names.append(large_collection_name) # puts it last\n", + "\n", + "# Process each collection.\n", + "for collection_name in ordered_collection_names:\n", + " collection = transformer_mongo_client[cfg.transformer_mongo_database_name][collection_name]\n", + " num_documents_in_collection = collection.count_documents({})\n", + " print(f\"Validating collection {collection_name} ({num_documents_in_collection} documents) [\", end=\"\") # no newline\n", + "\n", + " # Calculate how often we'll display a tick mark (i.e. a sign of life).\n", + " num_documents_per_tick = num_documents_in_collection * 0.10 # one tenth of the total\n", + " num_documents_since_last_tick = 0\n", + "\n", + " for document in collection.find():\n", + " # Validate the transformed document.\n", + " #\n", + " # Reference: https://github.com/microbiomedata/nmdc-schema/blob/main/src/docs/schema-validation.md\n", + " #\n", + " # Note: Dictionaries originating as Mongo documents include a Mongo-generated key named `_id`. However,\n", + " # the NMDC Schema does not describe that key and, indeed, data validators consider dictionaries\n", + " # containing that key to be invalid with respect to the NMDC Schema. So, here, we validate a\n", + " # copy (i.e. a shallow copy) of the document that lacks that specific key.\n", + " #\n", + " # Note: The reason we don't use a progress bar library such as `rich[jupyter]`, `tqdm`, or `ipywidgets`\n", + " # is that _PyCharm's_ Jupyter Notebook integration doesn't fully work with any of them. :(\n", + " #\n", + " schema_class_name = derive_schema_class_name_from_document(schema_view=schema_view, document=document)\n", + " document_without_underscore_id_key = {key: value for key, value in document.items() if key != \"_id\"}\n", + " validation_report: ValidationReport = validator.validate(document_without_underscore_id_key, schema_class_name)\n", + " if len(validation_report.results) > 0:\n", + " result_messages = [result.message for result in validation_report.results]\n", + " raise TypeError(f\"Document is invalid.\\n{result_messages=}\\n{document_without_underscore_id_key=}\")\n", + "\n", + " # Display a tick mark if we have validated enough documents since we last displayed one.\n", + " num_documents_since_last_tick += 1\n", + " if num_documents_since_last_tick >= num_documents_per_tick:\n", + " num_documents_since_last_tick = 0\n", + " print(\".\", end=\"\") # no newline\n", + "\n", + " print(\"]\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "992778323e5abf6a", + "metadata": {}, + "source": [ + "### Dump the collections from the \"transformer\" MongoDB server\n", + "\n", + "Now that the collections have been transformed and validated, dump them **from** the \"transformer\" MongoDB server **into** a local directory." + ] + }, + { + "cell_type": "code", + "id": "e05899950263caa8", + "metadata": {}, + "source": [ + "# Dump the database from the \"transformer\" MongoDB server.\n", + "shell_command = f\"\"\"\n", + " {mongodump} {transformer_mongo_cli_base_options} \\\n", + " --db='{cfg.transformer_mongo_database_name}' \\\n", + " --out='{cfg.transformer_dump_folder_path}' \\\n", + " --gzip\n", + "\"\"\"\n", + "completed_process = subprocess.run(shell_command, shell=True)\n", + "print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "333a58b11c25631", + "metadata": {}, + "source": [ + "### Create a bookkeeper\n", + "\n", + "Create a `Bookkeeper` that can be used to document migration events in the \"origin\" server." + ] + }, + { + "cell_type": "code", + "id": "b35d302475b22ea9", + "metadata": {}, + "source": [ + "bookkeeper = Bookkeeper(mongo_client=origin_mongo_client)" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "2e0866a47939597d", + "metadata": {}, + "source": [ + "### Indicate — on the \"origin\" server — that the migration is underway\n", + "\n", + "Add an entry to the migration log collection to indicate that this migration has started." + ] + }, + { + "cell_type": "code", + "id": "b08824e7b1f59c46", + "metadata": {}, + "source": [ + "bookkeeper.record_migration_event(migrator=migrator, event=MigrationEvent.MIGRATION_STARTED)" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "2982d126803c6558", + "metadata": {}, + "source": [ + "### Skipped: Drop the original collections from the \"origin\" MongoDB server\n", + "\n", + "Note: This step is necessary for migrations where collections are being renamed or deleted. (The `--drop` option of `mongorestore` would only drop collections that exist in the dump being restored, which would not include renamed or deleted collections.)\n", + "\n", + "In the case of _this_ migration, no collections are being renamed or deleted. So, we can skip this step. The collections that the migrator _did_ transform, will still be dropped when we run `mongorestore` with the `--drop` option later in this notebook.\n" + ] + }, + { + "cell_type": "code", + "id": "1b5a6f4e30f3d6f1", + "metadata": {}, + "source": [ + "print(\"skipped\")\n", + "\n", + "# shell_command = f\"\"\"\n", + "# {cfg.mongosh_path} {origin_mongo_cli_base_options} \\\n", + "# --eval 'use {cfg.origin_mongo_database_name}' \\\n", + "# --eval 'db.dropDatabase()'\n", + "# \"\"\"\n", + "# completed_process = subprocess.run(shell_command, shell=True)\n", + "# print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "8d2845a0322bfc8c", + "metadata": {}, + "source": [ + "### Load the collections into the \"origin\" MongoDB server\n", + "\n", + "Load the transformed collections into the \"origin\" MongoDB server." + ] + }, + { + "cell_type": "code", + "id": "248c443030832cdf", + "metadata": {}, + "source": [ + "# Load the transformed collections into the origin server, replacing any same-named ones that are there.\n", + "shell_command = f\"\"\"\n", + " {mongorestore} {origin_mongo_cli_base_options} \\\n", + " --nsFrom='{cfg.transformer_mongo_database_name}.*' \\\n", + " --nsTo='{cfg.origin_mongo_database_name}.*' \\\n", + " --dir='{cfg.transformer_dump_folder_path}' \\\n", + " --stopOnError \\\n", + " --verbose \\\n", + " --drop \\\n", + " --gzip\n", + "\"\"\"\n", + "completed_process = subprocess.run(shell_command, shell=True)\n", + "print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "777204c62e37c908", + "metadata": {}, + "source": [ + "### Indicate that the migration is complete\n", + "\n", + "Add an entry to the migration log collection to indicate that this migration is complete." + ] + }, + { + "cell_type": "code", + "id": "596aba5ac125cb65", + "metadata": {}, + "source": [ + "bookkeeper.record_migration_event(migrator=migrator, event=MigrationEvent.MIGRATION_COMPLETED)" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "a7cac4478a921c3d", + "metadata": {}, + "source": [ + "### Restore access to the \"origin\" MongoDB server\n", + "\n", + "This effectively un-does the access revocation that we did earlier." + ] + }, + { + "cell_type": "code", + "id": "db70dca5eb1e31e7", + "metadata": {}, + "source": [ + "shell_command = f\"\"\"\n", + " {cfg.mongosh_path} {origin_mongo_cli_base_options} \\\n", + " --file='mongosh-scripts/restore-privileges.mongo.js' \\\n", + " --quiet\n", + "\"\"\"\n", + "completed_process = subprocess.run(shell_command, shell=True)\n", + "print(f\"\\nReturn code: {completed_process.returncode}\")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "id": "ffdfc93c", + "metadata": {}, + "source": [], + "outputs": [], + "execution_count": null + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.8" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From b6da20c8badfca054d4202339af922c3f14a9d43 Mon Sep 17 00:00:00 2001 From: Patrick Kalita Date: Fri, 13 Mar 2026 08:21:26 -0700 Subject: [PATCH 5/5] Fix typo Co-authored-by: eecavanna <134325062+eecavanna@users.noreply.github.com> --- tests/test_data/test_submission_portal_translator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_data/test_submission_portal_translator.py b/tests/test_data/test_submission_portal_translator.py index d5d2034da..8afe32a7f 100644 --- a/tests/test_data/test_submission_portal_translator.py +++ b/tests/test_data/test_submission_portal_translator.py @@ -506,7 +506,7 @@ class FrozenDatetime(datetime.datetime): @classmethod def now(cls, **kwargs): # If tz was provided, make the_time timezone aware with that tz, otherwise return a - # naive datetime. We could hardcode the timzeone in the_time, but this makes the test + # naive datetime. We could hardcode the timezone in the_time, but this makes the test # a little more robust by allowing the translator to attempt to use naive datetimes. # This would cause the validation at the end of this test to fail. if "tz" in kwargs: