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

Auto-fill "Collection time" with a "Set to right now" button ? #212

Open
simroux opened this issue Dec 18, 2024 · 5 comments
Open

Auto-fill "Collection time" with a "Set to right now" button ? #212

simroux opened this issue Dec 18, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@simroux
Copy link
Collaborator

simroux commented Dec 18, 2024

This would be a similar UI as "Set to today" for "Collection Date" except it would set "Collection Time" field to the current time (in the right format and the right time zone).
Not sure how to deal with the fact that the timezone we ask for may not be the time zone of the user, so either auto-convert to UTC (which may look confusing) or make sure the schema also accepts time zone info (but then auto-fill would be even more helpful as that'd be one more unusual data to enter in a controlled format that may be confusing for users)

@eecavanna
Copy link
Collaborator

Thanks for bringing up the timezone aspect, @simroux.

I am just passing through while reviewing the squad board.

The schema currently neither infers—nor requires the submitter to say—a timezone for collection_date, although it does allows for one to be indicated in the submitted value. I think is a problem in the schema, because a date is a timezone-dependent value in reality (e.g. the same real world instant of time might be late on 1/2/2025 in California while being early on 1/3/2025 in New York). I'll file a ticket in nmdc-schema about this. Off the top of my head, I don't know whether the date we auto-fill into the collection_date field is in the user's local timezone or in UTC.

The schema does specify a timezone—always UTC—for collection_time, though.

@pkalita-lbl
Copy link
Collaborator

pkalita-lbl commented Jan 28, 2025

It's tricky because, as ISO 8601 suggests, there's no such thing as a date with a timezone attached. A date -- on its own -- doesn't indicate any particular instant in time and therefore timezones don't apply. But once you join a date and a time into a datetime, then the timezone matters. When you convert a datetime from one timezone to another the date might change, making it seem like a date could be subject to a timezone.

nmdc-schema inherits the collection_date slot from MIxS. The MIxS description of the slot implies (despite the name) that it can either be a date or a datetime. That's a little shoddy to start when it comes to timezone information (i.e. one of those things can include a timezone and the other can't). Then nmdc-schema adds an additional collection_time slot. Now we're all topsy-turvy! The time could be stored in one of two places? And in one it's sort of disconnected from the date?

@simroux
Copy link
Collaborator Author

simroux commented Jan 28, 2025

I was thinking only of the field "collection time, GMT" (per the soil template), but I think this field may need some review/work anyway (the regular expression seems to imply some hours/minutes/seconds, but the examples are "813", and "48835").

Also looks like I missed the "GMT" info the first time, but I guess then what we could try is maybe to have a button that "set to current time (GMT)", and then in the display we also add the timezone info (i.e. "GMT") next to it, e.g. "2:18:11 am GMT" ? That way as a user taking a sample at 4pm, I may be confused initially why "set to now" would enter 2am, but if it's clearly labeled "GMT" on the button itself and after in the field value, then I'd be "oh right, ok".

@pkalita-lbl
Copy link
Collaborator

the examples are "813", and "48835"

That's a bug and was fixed as part of microbiomedata/submission-schema#284. The app will inherit that change after the next production release (scheduled for Feb 3)

@mslarae13
Copy link

I'm going to add this to the submission portal board as well. Same problem to settle there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Status: 📋 Backlog, Todo
Development

No branches or pull requests

4 participants