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

[Add Check]: age Duration range and Best Practice #209

Open
2 tasks done
CodyCBakerPhD opened this issue May 5, 2022 · 5 comments · Fixed by #252
Open
2 tasks done

[Add Check]: age Duration range and Best Practice #209

CodyCBakerPhD opened this issue May 5, 2022 · 5 comments · Fixed by #252
Assignees
Labels
category: new check a new best practices check to apply to all NWBFiles and their contents

Comments

@CodyCBakerPhD
Copy link
Collaborator

What would you like to see added to the NWBInspector?

From discussion the other day, need to formalize a Best Practice for using the age of Subject as a free-form text field to account for some additional properties.

We already recommend ISO 8601 when exact age is known. If only a range is available, this uncertainty should be indicated.

I think what we landed on was using interval notation, e.g., age="(P4W, P6W)" to indicate subject age could have been as low as 4 weeks and as high as 6 weeks old, but exact age unknown.

There was also the reference time of 'birth' or 'stage' of development, which can be added on using a separation character such as '-', for the form age="P4D - <reference point>", .e.g. age="P4D - Conception" for in utero mouse studies, or age="P1D - Adulthood" for Drosophila melanogaster studies, with global default <reference point> being "birth".

Pseudocode or other logic of the check

No response

Do you have any interest in helping implement the check function?

Yes.

Code of Conduct

@CodyCBakerPhD CodyCBakerPhD added the category: new check a new best practices check to apply to all NWBFiles and their contents label May 5, 2022
@CodyCBakerPhD
Copy link
Collaborator Author

I think @h-mayorquin expressed interest in leading this

@bendichter
Copy link
Contributor

I believe we decided to use attributes of the dataset.

  • It is recommended, if known, to use ISO 8601 duration for the age field.
  • If a precise age is not known, enter any string for age, e.g. "6-8 weeks".
  • If exact age is not known but an age range is known, use the attributes age.lower_bound and age.upper_bound, which if used are required to be ISO 8610 duration format.
  • If the age is with respect to fertilization time, set age.reference = "fertilization".

@h-mayorquin
Copy link
Contributor

Commenting here for the to-do list.

@bendichter
Copy link
Contributor

bendichter commented Mar 29, 2023

DANDI landed on using a slash for age range. We have already added this to the docs here and to the code here:

@register_check(importance=Importance.BEST_PRACTICE_SUGGESTION, neurodata_type=Subject)
def check_subject_age(subject: Subject):
"""Check if the Subject age is in ISO 8601 or our extension of it for ranges."""
if subject.age is None:
if subject.date_of_birth is None:
return InspectorMessage(message="Subject is missing age and date_of_birth.")
else:
return
if re.fullmatch(pattern=duration_regex, string=subject.age):
return
if "/" in subject.age:
subject_lower_age_bound, subject_upper_age_bound = subject.age.split("/")
if re.fullmatch(pattern=duration_regex, string=subject_lower_age_bound) and (
re.fullmatch(pattern=duration_regex, string=subject_upper_age_bound) or subject_upper_age_bound == ""
):
return
return InspectorMessage(
message=(
f"Subject age, '{subject.age}', does not follow ISO 8601 duration format, e.g. 'P2Y' for 2 years "
"or 'P23W' for 23 weeks. You may also specify a range using a '/' separator, e.g., 'P1D/P3D' for an "
"age range somewhere from 1 to 3 days. If you cannot specify the upper bound of the range, "
"you may leave the right side blank, e.g., 'P90Y/' means 90 years old or older."
)
)

Age reference is now a field within NWB.

The only final point is one of "growth stage", which I have only ever seen come up for C. elegens, so maybe we should make a species-specific exception there

@CodyCBakerPhD
Copy link
Collaborator Author

The only final point is one of "growth stage", which I have only ever seen come up for C. elegens, so maybe we should make a species-specific exception there

Didn't fly life stages (or maybe it was also fly larvae) also follow a similar type of customized pattern?

@CodyCBakerPhD CodyCBakerPhD removed their assignment Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: new check a new best practices check to apply to all NWBFiles and their contents
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants