Initial implementation of metadata suggestion endpoint #1403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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 anautouse
test fixture (tests/conftest.py
) which stubs out all of the methods that make external network requests.SampleMetadataSuggester
which is responsible for generating metadata suggestions. The main method here isget_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
./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.