Skip to content

Commit

Permalink
Instrument Rdrc (#50)
Browse files Browse the repository at this point in the history
* moves InstrumentRdrc to instrument.py

* moves deprecated message to docstring
  • Loading branch information
mekhlakapoor authored Oct 19, 2024
1 parent 73f8f76 commit c34b16a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
3 changes: 2 additions & 1 deletion src/aind_slims_api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from aind_slims_api.models.attachment import SlimsAttachment
from aind_slims_api.models.behavior_session import SlimsBehaviorSession
from aind_slims_api.models.instrument import SlimsInstrument
from aind_slims_api.models.instrument import SlimsInstrument, SlimsInstrumentRdrc
from aind_slims_api.models.metadata import SlimsMetadataReference
from aind_slims_api.models.mouse import SlimsMouseContent
from aind_slims_api.models.unit import SlimsUnit
Expand All @@ -16,6 +16,7 @@
"SlimsAttachment",
"SlimsBehaviorSession",
"SlimsInstrument",
"SlimsInstrumentRdrc",
"SlimsMouseContent",
"SlimsUnit",
"SlimsUser",
Expand Down
24 changes: 2 additions & 22 deletions src/aind_slims_api/models/ecephys_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class SlimsStimulusEpochsResult(SlimsBaseModel):
)
stimulus_name: Optional[str] = Field(
default=None,
serialization_alias="rslt_cf_stimulusDeviceNames",
validation_alias="rslt_cf_stimulusDeviceNames",
serialization_alias="rslt_cf_stimulusName",
validation_alias="rslt_cf_stimulusName",
)
stimulus_modalities: Optional[List] = Field(
default=None,
Expand Down Expand Up @@ -378,26 +378,6 @@ class SlimsEphysInsertionResult(SlimsBaseModel):
}


class SlimsInstrumentRdrc(SlimsBaseModel):
"""Model for Instrument Rdrc"""

pk: Optional[int] = Field(
default=None, serialization_alias="rdrc_pk", validation_alias="rdrc_pk"
)
name: Optional[str] = Field(
default=None, serialization_alias="rdrc_name", validation_alias="rdrc_name"
)
created_on: Optional[datetime] = Field(
default=None,
serialization_alias="rdrc_createdOn",
validation_alias="rdrc_createdOn",
)
_slims_table = "ReferenceDataRecord"
_base_fetch_filters: ClassVar[dict[str, str]] = {
"rdty_name": "AIND Instruments",
}


class SlimsDomeModuleRdrc(SlimsBaseModel):
"""Model for Dome Module Reference Data"""

Expand Down
24 changes: 22 additions & 2 deletions src/aind_slims_api/models/instrument.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
"""Contains a model for the instrument content, and a method for fetching it"""

from datetime import datetime
from typing import Optional
from typing import Optional, ClassVar

from pydantic import Field

from aind_slims_api.models.base import SlimsBaseModel


class SlimsInstrumentRdrc(SlimsBaseModel):
"""Model for Instrument Rdrc"""

pk: Optional[int] = Field(
default=None, serialization_alias="rdrc_pk", validation_alias="rdrc_pk"
)
name: Optional[str] = Field(
default=None, serialization_alias="rdrc_name", validation_alias="rdrc_name"
)
created_on: Optional[datetime] = Field(
default=None,
serialization_alias="rdrc_createdOn",
validation_alias="rdrc_createdOn",
)
_slims_table = "ReferenceDataRecord"
_base_fetch_filters: ClassVar[dict[str, str]] = {
"rdty_name": "AIND Instruments",
}


class SlimsInstrument(SlimsBaseModel):
"""Model for a SLIMS instrument record.
This model may be deprecated. Use SlimsInstrumentRdrc for newer instruments.
Examples
--------
>>> from aind_slims_api.core import SlimsClient
Expand Down
2 changes: 1 addition & 1 deletion src/aind_slims_api/operations/ecephys_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
SlimsGroupOfSessionsRunStep,
SlimsMouseSessionRunStep,
SlimsBrainStructureRdrc,
SlimsInstrumentRdrc,
)
from aind_slims_api.models import SlimsInstrumentRdrc

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_operations/test_ecephys_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
SlimsExperimentRunStepContent,
SlimsExperimentRunStep,
SlimsBrainStructureRdrc,
SlimsInstrumentRdrc,
)
from aind_slims_api.models.instrument import SlimsInstrumentRdrc
from aind_slims_api.operations import EcephysSession, fetch_ecephys_sessions
from aind_slims_api.operations.ecephys_session import EcephysSessionBuilder

Expand Down

0 comments on commit c34b16a

Please sign in to comment.