From 24b7f00a57e6232beb79d31a2bf437a79afd8ffb Mon Sep 17 00:00:00 2001 From: eecavanna Date: Wed, 18 Sep 2024 00:01:09 -0700 Subject: [PATCH 1/2] Update Swagger tag descriptions to match Berkeley API GUI how-to guide Here's a link to the aforementioned how-to guide: https://github.com/microbiomedata/NMDC_documentation/blob/7f0ce6d7f671785e4733fdc14eac0c2f766b6cb9/docs/howto_guides/api_gui.md --- nmdc_runtime/api/main.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/nmdc_runtime/api/main.py b/nmdc_runtime/api/main.py index 6f5986c4..47c3f2d4 100644 --- a/nmdc_runtime/api/main.py +++ b/nmdc_runtime/api/main.py @@ -222,11 +222,8 @@ { "name": "metadata", "description": """ -The [metadata endpoints](https://api.microbiomedata.org/docs#/metadata) can be used to get and filter metadata from -collection set types (including [studies](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/Study.html), -[biosamples](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/Biosample.html), -[data objects](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/DataObject.html), and -[activities](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/Activity.html)).
+The [metadata endpoints](https://api.microbiomedata.org/docs#/metadata) can be used to get and filter metadata from collection set types (including studies, biosamples, planned processes, and data objects as discussed in the __find__ section). +
The __metadata__ endpoints allow users to retrieve metadata from the data portal using the various GET endpoints that are slightly different than the __find__ endpoints, but some can be used similarly. As with the __find__ endpoints, @@ -254,11 +251,8 @@ { "name": "find", "description": """ -The [find endpoints](https://api.microbiomedata.org/docs#/find:~:text=Find%20NMDC-,metadata,-entities.) are provided with -NMDC metadata entities already specified - where metadata about [studies](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/Study.html), -[biosamples](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/Biosample.html), -[data objects](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/DataObject.html), and -[activities](https://nmdc-documentation.readthedocs.io/en/latest/reference/metadata/Activity.html) can be retrieved using GET requests. +The [find endpoints](https://api.microbiomedata.org/docs#/find:~:text=Find%20NMDC-,metadata,-entities.) are provided with NMDC metadata entities already specified - where metadata about [studies](https://w3id.org/nmdc/Study), [biosamples](https://w3id.org/nmdc/Biosample), [data objects](https://w3id.org/nmdc/DataObject/), and [planned processes](https://w3id.org/nmdc/PlannedProcess/) can be retrieved using GET requests. +
Each endpoint is unique and requires the applicable attribute names to be known in order to structure a query in a meaningful way. Please note that endpoints with parameters that do not have a red ___* required___ label next to them are optional.
@@ -280,7 +274,8 @@ | study_id | The unique identifier of a study | Curie e.g. `prefix:identifier` | `nmdc:sty-11-34xj1150` | | sample_id | The unique identifier of a biosample | Curie e.g. `prefix:identifier` | `nmdc:bsm-11-w43vsm21` | | data_object_id | The unique identifier of a data object | Curie e.g. `prefix:identifier` | `nmdc:dobj-11-7c6np651` | -| activity_id | The unique identifier for an NMDC workflow execution activity | Curie e.g. `prefix:identifier` | `nmdc:wfmgan-11-hvcnga50.1`|
+| planned_process_id | The unique identifier for an NMDC planned process | Curie e.g. `prefix:identifier` | `nmdc:wfmgan-11-hvcnga50.1`| +
From 5c080db1786c26e2eaa85091cef0134bd8980ba1 Mon Sep 17 00:00:00 2001 From: eecavanna Date: Wed, 18 Sep 2024 00:16:37 -0700 Subject: [PATCH 2/2] Remove buggy expand/collapse functionality within metadata descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The implementation contained a bug: it relied on a `
` element that accepted user clicks; but was within an element that was already listening for user clicks (i.e. the metadata description element). Clicking on the `
` element also counted as clicking on all of its parent elements (there was no `event.stopPropagation()` call). As a result, when the `
` element was expanded, the endpoints would be collapsed—and vice versa. --- nmdc_runtime/api/main.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/nmdc_runtime/api/main.py b/nmdc_runtime/api/main.py index 47c3f2d4..4e9013b3 100644 --- a/nmdc_runtime/api/main.py +++ b/nmdc_runtime/api/main.py @@ -233,9 +233,6 @@ uses [MongoDB-like language querying](https://www.mongodb.com/docs/manual/tutorial/query-documents/). The applicable parameters of the __metadata__ endpoints, with acceptable syntax and examples, are in the table below. -
-More Details - | Parameter | Description | Syntax | Example | | :---: | :-----------: | :-------: | :---: | | collection_name | The name of the collection to be queried. For a list of collection names please see the [Database class](https://microbiomedata.github.io/nmdc-schema/Database/) of the NMDC Schema | String | `biosample_set` | @@ -245,7 +242,7 @@ | projection | Indicates the desired attributes to be included in the response. Helpful for trimming down the returned results | Comma-separated list of attributes that belong to the documents in the collection being queried | `name, ecosystem_type` | | doc_id | The unique identifier of the item being requested. For example, the identifier of a biosample or an extraction | Curie e.g. `prefix:identifier` | `nmdc:bsm-11-ha3vfb58` |

-
+ """, }, { @@ -259,8 +256,6 @@ The applicable parameters of the ___find___ endpoints, with acceptable syntax and examples, are in the table below. -
More Details - | Parameter | Description | Syntax | Example | | :---: | :-----------: | :-------: | :---: | | filter | Allows conditions to be set as part of the query, returning only results that satisfy the conditions | Comma separated string of attribute:value pairs. Can include comparison operators like >=, <=, <, and >. May use a `.search` after the attribute name to conduct a full text search of the field that are of type string. e.g. `attribute:value,attribute.search:value` | `ecosystem_category:Plants, lat_lon.latitude:>35.0` | @@ -277,7 +272,6 @@ | planned_process_id | The unique identifier for an NMDC planned process | Curie e.g. `prefix:identifier` | `nmdc:wfmgan-11-hvcnga50.1`|
-
""", },