Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of metadata suggestion endpoint #1403

Merged
merged 3 commits into from
Oct 2, 2024

Conversation

pkalita-lbl
Copy link
Collaborator

Fixes #1382

Summary

The context for this change is Milestone 3.3 (microbiomedata/issues#473), which is about adding functionality to the submission portal where partial sample metadata is used to make suggestions for other metadata fields.

These changes add an initial metadata suggestion endpoint. It implements suggestions for elevation based on latitude and longitude (via the nmdc-geoloc-tools package). There is a bit of an eye here towards making it easy to extend this in the future.

The new endpoint is not currently used by anything. See #1381 and #1383 for more info on how this will be integrated on the client side.

Details

  • New dependency on nmdc-geoloc-tools which encapsulates requests to ORNL geolocation services. That codebase was provided a looong time ago by someone at ORNL. I recently went in and cleaned up the repo to get it ready for publishing to PyPI, but I don't know a lot about the services it interacts with. Because of that I added an autouse test fixture (tests/conftest.py) which stubs out all of the methods that make external network requests.
  • New class SampleMetadataSuggester which is responsible for generating metadata suggestions. The main method here is get_suggestions which in turn defers to methods focused on providing suggestions for a individual metadata fields. Currently there is only one such method, suggest_elevation_from_lat_lon.
  • A new /metadata_submission/suggest is added which accepts list of partial sample metadata records (the "rows" terminology is derived from the fact that, in practice, this information will come from DataHarmonizer) and returns a list of suggested changes.

Copy link
Collaborator

@naglepuff naglepuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Tests passed, I played around with the endpoint from swagger

@pkalita-lbl pkalita-lbl merged commit f54032d into main Oct 2, 2024
2 checks passed
@pkalita-lbl pkalita-lbl deleted the issue-1382-metadata-suggestion-backend branch October 2, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create metadata suggestion API endpoint
2 participants