Skip to content

Commit

Permalink
feat: point to schema root (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwinston authored Mar 1, 2024
1 parent 7d0dad9 commit aca4339
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nmdc_runtime/api/endpoints/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def get_object_info(
"""
Resolution strategy:
0. if object_id == 'nmdc', go to <https://microbiomedata.github.io/nmdc-schema/>.
1. if object_id.startswith("sty"): # nmdc:Study typecode
then try https://data.microbiomedata.org/details/study/nmdc:{object_id}
2. if object_id.startswith("bsm"): # nmdc:Biosample typecode
Expand All @@ -116,6 +117,11 @@ def get_object_info(
4. try https://microbiomedata.github.io/nmdc-schema/{object_id}
5. try mdb.objects.find_one({"id": object_id})
"""
if object_id == "nmdc":
return RedirectResponse(
"https://microbiomedata.github.io/nmdc-schema",
status_code=status.HTTP_307_TEMPORARY_REDIRECT,
)
if object_id.startswith("sty"):
url_to_try = f"https://data.microbiomedata.org/api/study/nmdc:{object_id}"
rv = requests.get(
Expand Down

0 comments on commit aca4339

Please sign in to comment.