biopragmatics / bioregistry

📮 An integrative registry of biological databases, ontologies, and nomenclatures.
https://bioregistry.io
MIT License
108 stars 47 forks source link

Add URI parsing endpoint #1070

Closed cthoyt closed 3 months ago

cthoyt commented 3 months ago

Closes #1065

This PR adds the /api/uri/parse endpoint that takes in a uri body parameter, and returns some useful information in return

import requests

uri = "http://id.nlm.nih.gov/mesh/C063233"
res = requests.get("http://localhost:5000/api/uri/parse", json={"uri": uri}).json()

gives the following:

{
    "uri": "http://id.nlm.nih.gov/mesh/C063233",
    "reference": {"prefix": "mesh", "identifier": "C063233"},
    "providers": {
        "default": "https://meshb.nlm.nih.gov/record/ui?ui=C063233",
        "rdf": "http://id.nlm.nih.gov/mesh/C063233",
        ...
    }
}

cc @rombaum

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 40.28%. Comparing base (3a46873) to head (3102db7). Report is 34 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1070 +/- ## ========================================== + Coverage 40.26% 40.28% +0.02% ========================================== Files 150 150 Lines 8308 8321 +13 Branches 1924 1926 +2 ========================================== + Hits 3345 3352 +7 - Misses 4754 4763 +9 + Partials 209 206 -3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rombaum commented 3 months ago

It looks good for me. Thanks for the quick change!

cthoyt commented 3 months ago

@rombaum note I made a minor update to the path to this endpoint before merging