Skip to content

Commit 750a004

Browse files
authored
feat: adding Manipulation during acquisition (#1607)
* feat: adding Manipulation during acquisition * docs: build docs for Manipulation
1 parent 5389493 commit 750a004

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

docs/base/core/acquisition.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ For example, in the `"Brain Computer Interface"` project name, good acquisition
2727

2828
You should use the `Code.parameters` field to store your stimulus properties for each [StimulusEpoch](#stimulusepoch). We have pre-existing parameter schemas for a subset of stimuli defined [here](components/stimulus.md) or you can define your own schema.
2929

30+
## Manipulations
31+
32+
Procedures that occur during an acquisition (between the start_time and end_time) should be recorded in the `Acquisition.manipulations` using a [Manipulation](#manipulation).
33+
3034
## FAQs
3135

3236
### When should a DataStream be split in two

docs/source/acquisition.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ For example, in the `"Brain Computer Interface"` project name, good acquisition
2727

2828
You should use the `Code.parameters` field to store your stimulus properties for each [StimulusEpoch](#stimulusepoch). We have pre-existing parameter schemas for a subset of stimuli defined [here](components/stimulus.md) or you can define your own schema.
2929

30+
## Manipulations
31+
32+
Procedures that occur during an acquisition (between the start_time and end_time) should be recorded in the `Acquisition.manipulations` using a [Manipulation](#manipulation).
33+
3034
## FAQs
3135

3236
### When should a DataStream be split in two
@@ -88,6 +92,7 @@ while the StimulusEpoch represents all stimuli being presented.
8892
| `maintenance` | List[[Maintenance](components/measurements.md#maintenance)] | Maintenance (List of maintenance on instrument prior to acquisition.) |
8993
| `data_streams` | List[[DataStream](acquisition.md#datastream)] | Data streams (A data stream is a collection of devices that are acquiring data simultaneously. Each acquisition can include multiple streams. Streams should be split when configurations are changed.) |
9094
| `stimulus_epochs` | List[[StimulusEpoch](acquisition.md#stimulusepoch)] | Stimulus (A stimulus epoch captures all stimuli being presented during an acquisition. Epochs should be split when the purpose of the stimulus changes.) |
95+
| `manipulations` | List[[Manipulation](acquisition.md#manipulation)] | Manipulations (Procedures performed during the acquisition.) |
9196
| `subject_details` | Optional[[AcquisitionSubjectDetails](acquisition.md#acquisitionsubjectdetails)] | Subject details |
9297

9398

@@ -102,7 +107,7 @@ Details about the subject during an acquisition
102107
| `animal_weight_prior` | `Optional[decimal.Decimal]` | Animal weight (g) (Animal weight before procedure) |
103108
| `animal_weight_post` | `Optional[decimal.Decimal]` | Animal weight (g) (Animal weight after procedure) |
104109
| `weight_unit` | [MassUnit](aind_data_schema_models/units.md#massunit) | Weight unit |
105-
| `anaesthesia` | Optional[[Anaesthetic](components/surgery_procedures.md#anaesthetic)] | Anaesthesia |
110+
| `anaesthesia` | Optional[[Anaesthetic](components/surgery_procedures.md#anaesthetic)] | Anaesthesia (Anaesthesia present during entire acquisition, use Manipulation for partial anaesthesia) |
106111
| `mouse_platform_name` | `str` | Mouse platform |
107112
| `reward_consumed_total` | `Optional[decimal.Decimal]` | Total reward consumed (mL) |
108113
| `reward_consumed_unit` | Optional[[VolumeUnit](aind_data_schema_models/units.md#volumeunit)] | Reward consumed unit |
@@ -125,6 +130,19 @@ same time.
125130
| `connections` | List[[Connection](components/connections.md#connection)] | Connections (Connections are links between devices that are specific to this acquisition (i.e. not already defined in the Instrument)) |
126131

127132

133+
### Manipulation
134+
135+
Description of procedures performed during an acquisition.
136+
137+
| Field | Type | Title (Description) |
138+
|-------|------|-------------|
139+
| `start_time` | `datetime (timezone-aware)` | Manipulation start time (Must be between the acquisition start and end times) |
140+
| `end_time` | `datetime (timezone-aware)` | Manipulation end time (Must be between the acquisition start and end times) |
141+
| `procedures` | Optional[List[[Injection](components/injection_procedures.md#injection) or [BrainInjection](components/surgery_procedures.md#braininjection)]] | Procedures (Procedures performed during the manipulation) |
142+
| `anaesthesia` | Optional[[Anaesthetic](components/surgery_procedures.md#anaesthetic)] | Anaesthesia |
143+
| `notes` | `Optional[str]` | Notes |
144+
145+
128146
### PerformanceMetrics
129147

130148
Summary of a StimulusEpoch

docs/source/components/devices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ Description of a lick spout
529529
| `spout_diameter` | `decimal.Decimal` | Spout diameter (mm) |
530530
| `spout_diameter_unit` | [SizeUnit](../aind_data_schema_models/units.md#sizeunit) | Spout diameter unit |
531531
| `solenoid_valve` | [Device](#device) | Solenoid valve |
532-
| `lick_sensor` | [Device](#device) | Lick sensor |
532+
| `lick_sensor` | [Device](#device) or [HarpDevice](#harpdevice) | Lick sensor |
533533
| `lick_sensor_type` | Optional[[LickSensorType](../aind_data_schema_models/devices.md#licksensortype)] | Lick sensor type |
534534
| `name` | `str` | Device name |
535535
| `serial_number` | `Optional[str]` | Serial number |

docs/source/components/identifiers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Code or script identifier
1212
| `name` | `Optional[str]` | Name |
1313
| `version` | `Optional[str]` | Code version |
1414
| `container` | Optional[[Container](#container)] | Container |
15-
| `run_script` | `Optional[pathlib._local.Path]` | Run script (Path to run script) |
15+
| `run_script` | `Optional[pathlib.Path]` | Run script (Path to run script) |
1616
| `language` | `Optional[str]` | Programming language (Programming language used) |
1717
| `language_version` | `Optional[str]` | Programming language version |
1818
| `input_data` | Optional[List[[DataAsset](#dataasset) or [CombinedData](#combineddata)]] | Input data (Input data used in the code or script) |

src/aind_data_schema/core/acquisition.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from aind_data_schema.components.surgery_procedures import Anaesthetic
3838
from aind_data_schema.utils.merge import merge_notes, merge_optional_list, remove_duplicates
3939
from aind_data_schema.utils.validators import subject_specimen_id_compatibility
40+
from aind_data_schema.components.subject_procedures import Injection, BrainInjection
4041

4142
# Define the requirements for each modality
4243
# Define the mapping of modalities to their required device types
@@ -68,7 +69,10 @@ class AcquisitionSubjectDetails(DataModel):
6869
description="Animal weight after procedure",
6970
)
7071
weight_unit: MassUnit = Field(default=MassUnit.G, title="Weight unit")
71-
anaesthesia: Optional[Anaesthetic] = Field(default=None, title="Anaesthesia")
72+
anaesthesia: Optional[Anaesthetic] = Field(default=None, title="Anaesthesia", description=(
73+
"Anaesthesia present during entire acquisition, use Manipulation for partial anaesthesia"
74+
)
75+
)
7276
mouse_platform_name: str = Field(..., title="Mouse platform")
7377
reward_consumed_total: Optional[Decimal] = Field(default=None, title="Total reward consumed (mL)")
7478
reward_consumed_unit: Optional[VolumeUnit] = Field(default=None, title="Reward consumed unit")
@@ -237,6 +241,22 @@ class StimulusEpoch(DataModel):
237241
)
238242

239243

244+
class Manipulation(DataModel):
245+
"""Description of procedures performed during an acquisition."""
246+
247+
start_time: Annotated[AwareDatetimeWithDefault, TimeValidation.BETWEEN] = Field(
248+
..., title="Manipulation start time", description="Must be between the acquisition start and end times"
249+
)
250+
end_time: Annotated[AwareDatetimeWithDefault, TimeValidation.BETWEEN] = Field(
251+
..., title="Manipulation end time", description="Must be between the acquisition start and end times"
252+
)
253+
procedures: Optional[DiscriminatedList[Injection | BrainInjection]] = Field(
254+
default=None, title="Procedures", description="Procedures performed during the manipulation"
255+
)
256+
anaesthesia: Optional[Anaesthetic] = Field(default=None, title="Anaesthesia")
257+
notes: Optional[str] = Field(default=None, title="Notes")
258+
259+
240260
class Acquisition(DataCoreModel):
241261
"""Description of data acquisition metadata including streams, stimuli, and experimental setup.
242262
@@ -312,6 +332,9 @@ class Acquisition(DataCoreModel):
312332
" Epochs should be split when the purpose of the stimulus changes."
313333
),
314334
)
335+
manipulations: List[Manipulation] = Field(
336+
default=[], title="Manipulations", description="Procedures performed during the acquisition."
337+
)
315338
subject_details: Optional[AcquisitionSubjectDetails] = Field(default=None, title="Subject details")
316339

317340
@model_validator(mode="after")

0 commit comments

Comments
 (0)