microbiomedata / nmdc-server

Data portal client and server for NMDC.
https://data.microbiomedata.org
Other
9 stars 0 forks source link

Show both depth values (min/max) when present #756

Closed jeffbaumes closed 8 months ago

jeffbaumes commented 2 years ago

Split out from #740.

turbomam commented 2 years ago

We will be migrating away from use of a depth 2 slot, towards a depth slot that has subslots for discrete measurements as well as ranges.

The modeling is complete but changes have not been made to MongoDB yet.

jeffbaumes commented 2 years ago

Thanks for that info @turbomam. Can you add a "blocked on " comment here if there's an issue for what you just mentioned?

mslarae13 commented 1 year ago

We should revisit this some time soon @turbomam @jeffbaumes @naglepuff @pkalita-lbl

aclum commented 1 year ago

@jeffbaumes @naglepuff in mongo prod biosample_set id nmdc:bsm-11-2d3eam48 is an example record where a depth range is specified.

The slot depth has a value of QuantityValue relevant slots for data portal ingest are has_minimum_numeric_value, has_maximum_numeric_value, has_numeric_value

"depth": { "has_minimum_numeric_value": 0, "has_maximum_numeric_value": 0.1 }

cc @mslarae13

aclum commented 1 year ago

Time permitting adding this ticket to this sprint. NEON will have these min and max values.

ssarrafan commented 1 year ago

Per the meeting today Mongo should be updated soon so that this can be resolved. I'm moving this to the next sprint since schema was just released today. @naglepuff @aclum

aclum commented 1 year ago

There is already data in mongo with the values. This issue is to get the range displayed in the data portal

ssarrafan commented 1 year ago

This wasn't done so will be addressed after ESA. Adding backlog label. @naglepuff @aclum

mslarae13 commented 9 months ago

Should / could this be prioritized? I noticed the NEON samples don't show depth at all.

aclum commented 9 months ago

@mslarae13 Right, no depth is shown when depth is a range in mongo. As much as I would like to get this addressed there are bigger issues I'd like addressed like being able to pass a url with a search parameter. https://github.com/microbiomedata/nmdc-server/issues/1034. Leah and I are starting a around of user research now so part of that will be going through outstanding tickets.

eecavanna commented 9 months ago

I'm reading up on this issue now.

Resources

Here are some references for whoever ends up implementing this:

Questions

Questions I have:

  1. When the Mongo-to-Postgres ingest code encounters a range; what happens today? Is that range present in the Postgres database, converted into a single value there, etc.?
    • @naglepuff referred me to this snippet of code, which is where—as part of the ingest progress—the depth object is stored in a Postgres column called annotations.
  2. (TBD)
eecavanna commented 8 months ago

I got an nmdc-server development environment set up on my computer, and I got a copy of the production Postgres database loaded into it (from one of the backups).

image

I also got the client dev server running on my local machine (not shown here), and confirmed I can edit .vue files and see the changes in my web browser.

Notes

Server

When I visit http://localhost:8080/details/sample/gold:Gb0110680, the web client fetches data from http://localhost:8080/api/biosample/gold:Gb0110680.

The latter request is routed to this endpoint: https://github.com/microbiomedata/nmdc-server/blob/8d99507504e4c9500b742b55ff5b9fe9d901dc82/nmdc_server/api.py#L194-L203

The crud.get_biosample function is implemented here: https://github.com/microbiomedata/nmdc-server/blob/8d99507504e4c9500b742b55ff5b9fe9d901dc82/nmdc_server/crud.py#L233-L235

Looks like the "entire biosample" gets returned to the client.

Client

The response body associated with the latter request contains, among other things, the annotations object:

{
    "id": "gold:Gb0110680",
    //...
    "annotations": {
        "elev": 432.0,
        "depth": {
            "has_unit": "metre",
            "has_raw_value": "0.1 to 0.2 meters",
            "has_numeric_value": 0.1,
            "has_maximum_numeric_value": 0.2,
            "has_minimum_numeric_value": 0.1
        },
        //...
    },
    //...

Next thing I'll look into is the path from that response body to what gets displayed on the web page.

I think I have found the .vue file involved here:

web/src/components/Presentation/AttributeItem.vue
eecavanna commented 8 months ago

I was able to get a range showing. Tomorrow, I'll clean up and the code and run it by someone more familiar with both the Postgres data and Vue.js to see whether there's anything I've overlooked.

image

@aclum, is the way the range is shown on the left, what you had in mind?

eecavanna commented 8 months ago

I described the format minimum hyphen maximum space unit to @aclum verbally and she said it sounded good to her, so I'll move forward with that. I'll tag her in the PR I open, and include a screenshot, for her final approval.

In addition, @aclum wants single values to be followed by the unit also, when the unit is available (if available, it would be in annotations.depth.has_unit). Currently, the unit is not always available, but the team plans to make it required in the future (possibly back-filling missing ones).

On a side note, she pointed out that, currently, the unit values in the database are pretty heterogeneous (i.e. not consistent) right now (e.g. "m", "meter", "metre"). We'll eventually be implementing something that restricts them.

eecavanna commented 8 months ago

I opened a PR in which I implemented this functionality. Here's a link to the PR: https://github.com/microbiomedata/nmdc-server/pull/1133

naglepuff commented 8 months ago

I opened a PR in which I implemented this functionality. Here's a link to the PR: #1133

I'll be able to take a look at this PR next week.