The context for this change is Milestone 3.3 (https://github.com/microbiomedata/issues/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.
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.
Fixes #1382
Summary
The context for this change is Milestone 3.3 (https://github.com/microbiomedata/issues/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 https://github.com/microbiomedata/nmdc-server/issues/1381 and https://github.com/microbiomedata/nmdc-server/issues/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.