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

feat: replace experimenter_full_name with Investigator class #1223

Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/source/example_workflow/example_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
import pandas as pd
from aind_data_schema_models.modalities import Modality
from aind_data_schema_models.organizations import Organization
from aind_data_schema_models.pid_names import PIDName
from aind_data_schema_models.platforms import Platform

from aind_data_schema.core.data_description import Funding, RawDataDescription
from aind_data_schema.core.procedures import NanojectInjection, Perfusion, Procedures, Surgery, ViralMaterial
from aind_data_schema.core.subject import BreedingInfo, Housing, Species, Subject

from aind_data_schema.components.identifiers import Investigator

sessions_df = pd.read_excel("example_workflow.xlsx", sheet_name="sessions")
mice_df = pd.read_excel("example_workflow.xlsx", sheet_name="mice")
procedures_df = pd.read_excel("example_workflow.xlsx", sheet_name="procedures")

# everything was done by one person, so it's not in the spreadsheet
experimenter = "Sam Student"
investigator = Investigator(name="Some Investigator")

# in our spreadsheet, we stored sex as M/F instead of Male/Female
subject_sex_lookup = {
Expand All @@ -35,7 +36,7 @@
subject_id=str(session["mouse_id"]),
creation_time=session["end_time"].to_pydatetime(),
institution=Organization.OTHER,
investigators=[PIDName(name="Some Investigator")],
investigators=[investigator],
funding_source=[Funding(funder=Organization.NIMH)],
)

Expand Down Expand Up @@ -88,7 +89,7 @@
start_date=proc_row["injection_date"].to_pydatetime().date(),
protocol_id=protocol,
ethics_review_id=ethics_review_id,
experimenter_full_name=experimenter,
investigators=[investigator],
procedures=[
NanojectInjection(
protocol_id=protocol,
Expand All @@ -111,7 +112,7 @@
),
Surgery(
start_date=proc_row["perfusion_date"].to_pydatetime().date(),
experimenter_full_name=experimenter,
investigators=[investigator],
ethics_review_id=ethics_review_id,
protocol_id=protocol,
procedures=[Perfusion(protocol_id=protocol, output_specimen_ids=["1"])],
Expand Down
88 changes: 80 additions & 8 deletions examples/aibs_smartspim_procedures.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
"procedure_type": "Surgery",
"protocol_id": "doi_of_protocol_surgery",
"start_date": "2022-11-17",
"experimenter_full_name": "LAS",
"investigators": [
{
"name": "LAS",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"ethics_review_id": "xxxx",
"animal_weight_prior": null,
"animal_weight_post": null,
Expand All @@ -33,7 +42,16 @@
"specimen_id": "651286",
"start_date": "2023-01-13",
"end_date": "2023-01-17",
"experimenter_full_name": "John Smith",
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"protocol_id": [
"unknown"
],
Expand Down Expand Up @@ -74,7 +92,16 @@
"specimen_id": "651286",
"start_date": "2023-01-17",
"end_date": "2023-01-18",
"experimenter_full_name": "John Smith",
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"protocol_id": [
"unknown"
],
Expand Down Expand Up @@ -103,7 +130,16 @@
"specimen_id": "651286",
"start_date": "2023-01-18",
"end_date": "2023-01-19",
"experimenter_full_name": "John Smith",
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"protocol_id": [
"unknown"
],
Expand Down Expand Up @@ -132,7 +168,16 @@
"specimen_id": "651286",
"start_date": "2023-01-19",
"end_date": "2023-01-20",
"experimenter_full_name": "John Smith",
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"protocol_id": [
"unknown"
],
Expand Down Expand Up @@ -173,7 +218,16 @@
"specimen_id": "651286",
"start_date": "2023-01-30",
"end_date": "2023-01-31",
"experimenter_full_name": "John Smith",
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"protocol_id": [
"unknown"
],
Expand Down Expand Up @@ -214,7 +268,16 @@
"specimen_id": "651286",
"start_date": "2023-01-31",
"end_date": "2023-02-02",
"experimenter_full_name": "John Smith",
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"protocol_id": [
"unknown"
],
Expand Down Expand Up @@ -243,7 +306,16 @@
"specimen_id": "651286",
"start_date": "2023-01-31",
"end_date": "2023-02-02",
"experimenter_full_name": "John Smith",
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"protocol_id": [
"unknown"
],
Expand Down
19 changes: 10 additions & 9 deletions examples/aibs_smartspim_procedures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from aind_data_schema_models.organizations import Organization

from aind_data_schema.components.identifiers import Investigator
from aind_data_schema.core import procedures

experimenter = "John Smith"
investigators = [Investigator(name="John Smith")]
# subject and specimen id can be the same?
specimen_id = "651286"

Expand Down Expand Up @@ -35,7 +36,7 @@

perfusion = procedures.Surgery(
start_date=date(2022, 11, 17),
experimenter_full_name="LAS",
investigators=[Investigator(name="LAS")],
ethics_review_id="xxxx",
protocol_id="doi_of_protocol_surgery",
procedures=[
Expand All @@ -55,7 +56,7 @@
procedure_type="Fixation",
start_date=date(2023, 1, 13),
end_date=date(2023, 1, 17),
experimenter_full_name=experimenter,
investigators=investigators,
protocol_id=["unknown"],
reagents=[shield_buffer, shield_epoxy],
)
Expand All @@ -67,7 +68,7 @@
procedure_type="Fixation",
start_date=date(2023, 1, 17),
end_date=date(2023, 1, 18),
experimenter_full_name=experimenter,
investigators=investigators,
protocol_id=["unknown"],
reagents=[
shield_on,
Expand All @@ -81,7 +82,7 @@
procedure_type="Soak",
start_date=date(2023, 1, 18),
end_date=date(2023, 1, 19),
experimenter_full_name=experimenter,
investigators=investigators,
protocol_id=["unknown"],
reagents=[
delipidation_buffer,
Expand All @@ -95,7 +96,7 @@
procedure_name="Active Delipidation",
start_date=date(2023, 1, 19),
end_date=date(2023, 1, 20),
experimenter_full_name=experimenter,
investigators=investigators,
protocol_id=["unknown"],
reagents=[delipidation_buffer, conductivity_buffer],
)
Expand All @@ -107,7 +108,7 @@
procedure_name="EasyIndex 50%",
start_date=date(2023, 1, 30),
end_date=date(2023, 1, 31),
experimenter_full_name=experimenter,
investigators=investigators,
protocol_id=["unknown"],
reagents=[
easy_index,
Expand All @@ -122,7 +123,7 @@
procedure_name="EasyIndex 100%",
start_date=date(2023, 1, 31),
end_date=date(2023, 2, 2),
experimenter_full_name=experimenter,
investigators=investigators,
protocol_id=["unknown"],
reagents=[
easy_index,
Expand All @@ -135,7 +136,7 @@
procedure_type="Embedding",
start_date=date(2023, 1, 31),
end_date=date(2023, 2, 2),
experimenter_full_name=experimenter,
investigators=investigators,
protocol_id=["unknown"],
reagents=[
easy_index,
Expand Down
11 changes: 9 additions & 2 deletions examples/bergamo_ophys_session.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
"describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/session.py",
"schema_version": "1.1.4",
"protocol_id": [],
"experimenter_full_name": [
"John Doe"
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"session_start_time": "2022-07-12T07:00:00Z",
"session_end_time": "2022-07-12T07:00:00Z",
Expand Down
3 changes: 2 additions & 1 deletion examples/bergamo_ophys_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from aind_data_schema_models.modalities import Modality
from aind_data_schema_models.units import FrequencyUnit

from aind_data_schema.components.identifiers import Investigator
from aind_data_schema.components.stimulus import PhotoStimulation, PhotoStimulationGroup
from aind_data_schema.core.session import (
DetectorConfig,
Expand All @@ -22,7 +23,7 @@
t = datetime(2022, 7, 12, 7, 00, 00, tzinfo=timezone.utc)

s = Session(
experimenter_full_name=["John Doe"],
investigators=[Investigator(name="John Smith")],
session_start_time=t,
session_end_time=t,
subject_id="652567",
Expand Down
6 changes: 4 additions & 2 deletions examples/data_description.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
"investigators": [
{
"name": "Jane Smith",
"abbreviation": null,
"registry": null,
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
Expand Down
4 changes: 2 additions & 2 deletions examples/data_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from aind_data_schema_models.modalities import Modality
from aind_data_schema_models.organizations import Organization
from aind_data_schema_models.pid_names import PIDName
from aind_data_schema_models.platforms import Platform

from aind_data_schema.components.identifiers import Investigator
from aind_data_schema.core.data_description import Funding, RawDataDescription

d = RawDataDescription(
Expand All @@ -15,7 +15,7 @@
subject_id="12345",
creation_time=datetime(2022, 2, 21, 16, 30, 1, tzinfo=timezone.utc),
institution=Organization.AIND,
investigators=[PIDName(name="Jane Smith")],
investigators=[Investigator(name="Jane Smith")],
funding_source=[Funding(funder=Organization.AI)],
)

Expand Down
12 changes: 9 additions & 3 deletions examples/ephys_session.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/session.py",
"schema_version": "1.1.4",
"protocol_id": [],
"experimenter_full_name": [
"Max Quibble",
"Finn Tickle"
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"session_start_time": "2023-04-25T02:35:00Z",
"session_end_time": "2023-04-25T03:16:00Z",
Expand Down
3 changes: 2 additions & 1 deletion examples/ephys_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from aind_data_schema_models.modalities import Modality

from aind_data_schema.components.devices import Software
from aind_data_schema.components.identifiers import Investigator
from aind_data_schema.core.session import (
CcfCoords,
Coordinates3d,
Expand All @@ -19,7 +20,7 @@
from aind_data_schema_models.brain_atlas import CCFStructure

session = Session(
experimenter_full_name=["Max Quibble", "Finn Tickle"],
investigators=[Investigator(name="John Smith")],
subject_id="664484",
session_start_time=datetime(year=2023, month=4, day=25, hour=2, minute=35, second=0, tzinfo=timezone.utc),
session_end_time=datetime(year=2023, month=4, day=25, hour=3, minute=16, second=0, tzinfo=timezone.utc),
Expand Down
11 changes: 9 additions & 2 deletions examples/exaspim_acquisition.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
"describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/acquisition.py",
"schema_version": "1.0.5",
"protocol_id": [],
"experimenter_full_name": [
"###"
"investigators": [
{
"name": "John Smith",
"registry": {
"name": "Open Researcher and Contributor ID",
"abbreviation": "ORCID"
},
"registry_identifier": null
}
],
"specimen_id": "###",
"subject_id": "###",
Expand Down
Loading
Loading