diff --git a/src/aind_slims_api/models/ecephys_result.py b/src/aind_slims_api/models/ecephys_session.py similarity index 97% rename from src/aind_slims_api/models/ecephys_result.py rename to src/aind_slims_api/models/ecephys_session.py index 67b0158..381882f 100644 --- a/src/aind_slims_api/models/ecephys_result.py +++ b/src/aind_slims_api/models/ecephys_session.py @@ -1,5 +1,6 @@ """Contains a model for an ecephys result stored in SLIMS.""" +from datetime import datetime from typing import Annotated, List, Optional, ClassVar from pydantic import Field from aind_slims_api.models.base import SlimsBaseModel @@ -18,11 +19,6 @@ class SlimsStreamsResult(SlimsBaseModel): serialization_alias="rslt_cf_fk_mouseSession_display", validation_alias="rslt_cf_fk_mouseSession_display" ) - mouse_session_pk: Optional[int] = Field( - default=None, - serialization_alias="rslt_cf_fk_mouseSession", - validation_alias="rslt_cf_fk_mouseSession" - ) stream_modalities: Optional[List] = Field( default=None, serialization_alias="rslt_cf_streamModalities", @@ -54,6 +50,16 @@ class SlimsStreamsResult(SlimsBaseModel): serialization_alias="rslt_fk_content", validation_alias="rslt_fk_content", ) + mouse_session_pk: Optional[int] = Field( + default=None, + serialization_alias="rslt_cf_fk_mouseSession", + validation_alias="rslt_cf_fk_mouseSession" + ) + created_on: Optional[datetime] = Field( + default=None, + serialization_alias="rslt_createdOn", + validation_alias="rslt_createdOn" + ) _slims_table = "Result" _base_fetch_filters: ClassVar[dict[str, str]] = { "test_name": "test_ephys_in_vivo_recording_stream", @@ -257,4 +263,3 @@ class SlimsEphysInsertionResult(SlimsBaseModel): _base_fetch_filters: ClassVar[dict[str, str]] = { "test_name": "test_ephys_insertion", } - diff --git a/tests/resources/example_fetch_ecephys_session_result.json b/tests/resources/example_fetch_ecephys_session_result.json new file mode 100644 index 0000000..b57df9b --- /dev/null +++ b/tests/resources/example_fetch_ecephys_session_result.json @@ -0,0 +1,681 @@ +[{ + "pk": 2329, + "tableName": "Result", + "columns": [ + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_content", + "title": "Content", + "position": 0, + "value": 3135, + "hidden": false, + "editable": true, + "foreignTable": "Content", + "displayValue": "725804", + "displayField": "cntn_id", + "foreignDisplayColumn": "cntn_id" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_analyte", + "title": "Analyte", + "position": 1, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "Analyte", + "displayValue": null, + "displayField": "nlyt_name", + "foreignDisplayColumn": "nlyt_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_test", + "title": "Test", + "position": 2, + "value": 71, + "hidden": false, + "editable": false, + "foreignTable": "Test", + "displayValue": "Mouse Session", + "displayField": "test_label", + "foreignDisplayColumn": "test_label" + }, + { + "datatype": "STRING", + "name": "test_name", + "title": "Name", + "position": 3, + "value": "test_session_information", + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "test_label", + "title": "Label", + "position": 4, + "value": "Mouse Session", + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "test_requireAnalyte", + "title": "Requires analyte", + "position": 5, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "test_dynamicFormat", + "title": "Format observations", + "position": 6, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_resultObservationPoint", + "title": "Observation", + "position": 7, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "ResultObservationPoint", + "displayValue": null, + "displayField": "rsbp_label", + "foreignDisplayColumn": "rsbp_label" + }, + { + "datatype": "STRING", + "name": "rsbp_label", + "title": "Label", + "position": 8, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "rsbp_offset", + "title": "Offset", + "position": 9, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_manualValue", + "title": "Manual value", + "position": 10, + "value": false, + "hidden": false, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_cf_fk_instrument", + "title": "Instrument", + "position": 11, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Instrument", + "displayValue": null, + "displayField": "rslt_cf_fk_instrument_display", + "foreignDisplayColumn": "nstr_name" + }, + { + "datatype": "INTEGER", + "name": "rslt_cf_trajectorySequence", + "title": "Session Sequence", + "position": 12, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_animalWeightPrior", + "title": "Animal Weight Prior", + "position": 13, + "value": null, + "hidden": false, + "editable": true, + "unit": "g" + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_animalWeightPost", + "title": "Animal Weight Post", + "position": 14, + "value": null, + "hidden": false, + "editable": true, + "unit": "g" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_cf_fk_rewardDelivery", + "title": "Reward Delivery", + "position": 15, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "ReferenceDataRecord", + "displayValue": null, + "displayField": "rslt_cf_fk_rewardDelivery_display", + "foreignDisplayColumn": "rdrc_name" + }, + { + "datatype": "STRING", + "name": "rslt_cf_rewardDelivery", + "title": "Reward Delivery", + "position": 16, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_rewardConsumedvolume", + "title": "Reward Consumed", + "position": 17, + "value": null, + "hidden": false, + "editable": true, + "unit": "ml" + }, + { + "datatype": "STRING", + "name": "rslt_uniqueIdentifier", + "title": "Unique identifier", + "position": 18, + "value": "RSLT0000002377", + "hidden": false, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudy", + "title": "Stability study", + "position": 19, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudy", + "displayValue": null, + "displayField": "stsd_name", + "foreignDisplayColumn": "stsd_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudyStorage", + "title": "Storage condition", + "position": 20, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudyStorage", + "displayValue": null, + "displayField": "storageName", + "foreignDisplayColumn": "sssr_uniqueIdentifier" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudyTimepoint", + "title": "Timepoint", + "position": 21, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudyTimepoint", + "displayValue": null, + "displayField": "timepointName", + "foreignDisplayColumn": "sstp_uniqueIdentifier" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_batch", + "title": "Batch", + "position": 22, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Content", + "displayValue": null, + "displayField": "enrolledBatch", + "foreignDisplayColumn": "cntn_id" + }, + { + "datatype": "ENUM", + "name": "rslt_aggregationMethod", + "title": "Aggregation method", + "position": 23, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_eventSummary", + "title": "Event summary", + "position": 24, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_valueEnteredOn", + "title": "Value entered on", + "position": 25, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_filler", + "title": "Filler", + "position": 26, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "User", + "displayValue": null, + "displayField": "user_userName", + "foreignDisplayColumn": "user_userName" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_status", + "title": "Status", + "position": 27, + "value": 12, + "hidden": false, + "editable": true, + "foreignTable": "Status", + "displayValue": "Pending", + "displayField": "stts_name", + "foreignDisplayColumn": "stts_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_workList", + "title": "Worklist", + "position": 28, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "WorkList", + "displayValue": null, + "displayField": "wrkl_name", + "foreignDisplayColumn": "wrkl_name" + }, + { + "datatype": "DATE", + "name": "rslt_workListDate", + "title": "Worklist date", + "position": 29, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "rslt_qcWarning", + "title": "Warning", + "position": 30, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_qcMarked", + "title": "Marked", + "position": 31, + "value": false, + "hidden": false, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "rslt_qcCardPosition", + "title": "Position", + "position": 32, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isARepeat", + "title": "Is a repeat", + "position": 33, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isRepeated", + "title": "Is repeated", + "position": 34, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_report", + "title": "Report", + "position": 35, + "value": true, + "hidden": false, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_createdBy", + "title": "Created by", + "position": 36, + "value": "MeghanO", + "hidden": false, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_createdOn", + "title": "Created on", + "position": 37, + "value": 1724092556053, + "hidden": false, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "rslt_modifiedBy", + "title": "Modified by", + "position": 38, + "value": "MeghanO", + "hidden": false, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_modifiedOn", + "title": "Modified on", + "position": 39, + "value": 1724112551323, + "hidden": false, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "INTEGER", + "name": "tsgr_seqNo", + "title": "Seq no", + "position": 40, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "test_seqNo", + "title": "Seq no", + "position": 41, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "grps_groupName", + "title": "Name", + "position": 42, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "stts_name", + "title": "Name", + "position": 43, + "value": "Pending", + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_previousStatus", + "title": "Previous status", + "position": 44, + "value": 12, + "hidden": true, + "editable": true, + "foreignTable": "Status", + "displayValue": "Pending", + "displayField": "stts_namePrevious", + "foreignDisplayColumn": "stts_name" + }, + { + "datatype": "INTEGER", + "name": "attachmentCount", + "title": "attachmentCount", + "position": 45, + "value": 0, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "stts_namePrevious", + "title": "stts_namePrevious", + "position": 46, + "value": "Pending", + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "test_readOnly", + "title": "Read only", + "position": 47, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_manuallyCreated", + "title": "rslt_manuallyCreated", + "position": 48, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_timepointEnrollment", + "title": "Timepoint enrollment", + "position": 49, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "TimepointEnrollment", + "displayValue": null, + "displayField": "tpnr_uniqueIdentifier", + "foreignDisplayColumn": "tpnr_uniqueIdentifier" + }, + { + "datatype": "DATE", + "name": "xprs_observationStartDate", + "title": "Start Observation", + "position": 50, + "value": 1724092554658, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "INTEGER", + "name": "rslt_pk", + "title": "rslt_pk", + "position": 51, + "value": 2329, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "user_userName", + "title": "User name", + "position": 52, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isMainTest", + "title": "Is main test", + "position": 53, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_request", + "title": "Request", + "position": 54, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Request", + "displayValue": null + }, + { + "datatype": "INTEGER", + "name": "tsgr_fk_mainTest", + "title": "Main test", + "position": 55, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_experimentRunStep", + "title": "Protocol run step", + "position": 56, + "value": 64456, + "hidden": true, + "editable": true, + "foreignTable": "ExperimentRunStep", + "displayValue": null, + "displayField": "xprs_name", + "foreignDisplayColumn": "xprs_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_order", + "title": "Order", + "position": 57, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Order", + "displayValue": null, + "displayField": "ordr_barCode", + "foreignDisplayColumn": "ordr_barCode" + } + ], + "canUpdate": true, + "canDelete": true, + "links": [ + { + "rel": "self", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result/2329" + }, + { + "rel": "rslt_fk_content", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Content/3135" + }, + { + "rel": "rslt_fk_test", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Test/71" + }, + { + "rel": "rslt_fk_status", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Status/12" + }, + { + "rel": "rslt_fk_previousStatus", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Status/12" + }, + { + "rel": "rslt_fk_experimentRunStep", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ExperimentRunStep/64456" + }, + { + "rel": "-rggr_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultAggregation?rggr_fk_result=2329" + }, + { + "rel": "-rggr_fk_aggregation", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultAggregation?rggr_fk_aggregation=2329" + }, + { + "rel": "-rqtm_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultQcTemplate?rqtm_fk_result=2329" + }, + { + "rel": "-rlvl_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/RuleEvaluation?rlvl_fk_result=2329" + }, + { + "rel": "-rslt_cf_fk_burr", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_burr=2329" + }, + { + "rel": "-rslt_cf_fk_ephysTrajectory", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_ephysTrajectory=2329" + }, + { + "rel": "-rslt_cf_fk_mouseSession", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_mouseSession=2329" + }, + { + "rel": "-qrrv_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/QcResultRuleEvaluation?qrrv_fk_result=2329" + }, + { + "rel": "attachments", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/attachment/Result/2329" + } + ] +} + ] diff --git a/tests/resources/example_fetch_ecephys_stimulus_epochs_result.json b/tests/resources/example_fetch_ecephys_stimulus_epochs_result.json new file mode 100644 index 0000000..2887acf --- /dev/null +++ b/tests/resources/example_fetch_ecephys_stimulus_epochs_result.json @@ -0,0 +1,762 @@ +[{ + "pk": 2331, + "tableName": "Result", + "columns": [ + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_content", + "title": "Content", + "position": 0, + "value": 3135, + "hidden": false, + "editable": true, + "foreignTable": "Content", + "displayValue": "725804", + "displayField": "cntn_id", + "foreignDisplayColumn": "cntn_id" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_analyte", + "title": "Analyte", + "position": 1, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "Analyte", + "displayValue": null, + "displayField": "nlyt_name", + "foreignDisplayColumn": "nlyt_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_test", + "title": "Test", + "position": 2, + "value": 72, + "hidden": false, + "editable": false, + "foreignTable": "Test", + "displayValue": "Stimulus Epochs", + "displayField": "test_label", + "foreignDisplayColumn": "test_label" + }, + { + "datatype": "STRING", + "name": "test_name", + "title": "Name", + "position": 3, + "value": "test_stimulus_epochs", + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "test_label", + "title": "Label", + "position": 4, + "value": "Stimulus Epochs", + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "test_requireAnalyte", + "title": "Requires analyte", + "position": 5, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "test_dynamicFormat", + "title": "Format observations", + "position": 6, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_resultObservationPoint", + "title": "Observation", + "position": 7, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "ResultObservationPoint", + "displayValue": null, + "displayField": "rsbp_label", + "foreignDisplayColumn": "rsbp_label" + }, + { + "datatype": "STRING", + "name": "rsbp_label", + "title": "Label", + "position": 8, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "rsbp_offset", + "title": "Offset", + "position": 9, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_manualValue", + "title": "Manual value", + "position": 10, + "value": false, + "hidden": false, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_cf_fk_instrument", + "title": "Instrument", + "position": 11, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Instrument", + "displayValue": null, + "displayField": "rslt_cf_fk_instrument_display", + "foreignDisplayColumn": "nstr_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_cf_fk_mouseSession", + "title": "Mouse Session", + "position": 12, + "value": 2329, + "hidden": false, + "editable": true, + "foreignTable": "Result", + "displayValue": "RSLT0000002377", + "displayField": "rslt_cf_fk_mouseSession_display", + "foreignDisplayColumn": "rslt_uniqueIdentifier" + }, + { + "datatype": "STRING", + "name": "rslt_cf_stimulusDeviceNames", + "title": "Stimulus Device Names", + "position": 13, + "value": "Oxxius Blue Laser Oxxius Red Laser", + "hidden": false, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_cf_stimulusName", + "title": "Stimulus Name", + "position": 14, + "value": "Laser pulses", + "hidden": false, + "editable": true + }, + { + "datatype": "MULTIPLE_ENUM", + "name": "rslt_cf_stimulusModalities2", + "title": "Stimulus modalities", + "position": 15, + "value": [ + "Optogenetics" + ], + "hidden": false, + "editable": true, + "joinedValue": "Optogenetics" + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_rewardConsumedDuringEpoch", + "title": "Reward consumed during epoch", + "position": 16, + "value": null, + "hidden": false, + "editable": true, + "unit": "ml" + }, + { + "datatype": "STRING", + "name": "rslt_cf_lightEmittingDiodeName", + "title": "Light emitting diode name", + "position": 17, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "ENUM", + "name": "rslt_cf_stimulusModalities", + "title": "Stimulus modalities", + "position": 18, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_lightEmittingDiodeExcitationPower", + "title": "Light emitting diode excitation power", + "position": 19, + "value": null, + "hidden": false, + "editable": true, + "unit": "mW" + }, + { + "datatype": "STRING", + "name": "rslt_cf_laserName", + "title": "Laser name", + "position": 20, + "value": "Coherent Red Laser", + "hidden": false, + "editable": true + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_laserWavelength", + "title": "Laser wavelength", + "position": 21, + "value": 640, + "hidden": false, + "editable": true, + "unit": "nm" + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_laserExcitationPower", + "title": "Laser excitation power", + "position": 22, + "value": null, + "hidden": false, + "editable": true, + "unit": "mW" + }, + { + "datatype": "STRING", + "name": "rslt_cf_speakerName", + "title": "Speaker name", + "position": 23, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_speakerVolume", + "title": "Speaker volume", + "position": 24, + "value": null, + "hidden": false, + "editable": true, + "unit": "dB" + }, + { + "datatype": "STRING", + "name": "rslt_comments", + "title": "Notes", + "position": 25, + "value": "", + "hidden": false, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_uniqueIdentifier", + "title": "Unique identifier", + "position": 26, + "value": "RSLT0000002379", + "hidden": false, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudy", + "title": "Stability study", + "position": 27, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudy", + "displayValue": null, + "displayField": "stsd_name", + "foreignDisplayColumn": "stsd_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudyStorage", + "title": "Storage condition", + "position": 28, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudyStorage", + "displayValue": null, + "displayField": "storageName", + "foreignDisplayColumn": "sssr_uniqueIdentifier" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudyTimepoint", + "title": "Timepoint", + "position": 29, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudyTimepoint", + "displayValue": null, + "displayField": "timepointName", + "foreignDisplayColumn": "sstp_uniqueIdentifier" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_batch", + "title": "Batch", + "position": 30, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Content", + "displayValue": null, + "displayField": "enrolledBatch", + "foreignDisplayColumn": "cntn_id" + }, + { + "datatype": "ENUM", + "name": "rslt_aggregationMethod", + "title": "Aggregation method", + "position": 31, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_eventSummary", + "title": "Event summary", + "position": 32, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_valueEnteredOn", + "title": "Value entered on", + "position": 33, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_filler", + "title": "Filler", + "position": 34, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "User", + "displayValue": null, + "displayField": "user_userName", + "foreignDisplayColumn": "user_userName" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_status", + "title": "Status", + "position": 35, + "value": 12, + "hidden": false, + "editable": true, + "foreignTable": "Status", + "displayValue": "Pending", + "displayField": "stts_name", + "foreignDisplayColumn": "stts_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_workList", + "title": "Worklist", + "position": 36, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "WorkList", + "displayValue": null, + "displayField": "wrkl_name", + "foreignDisplayColumn": "wrkl_name" + }, + { + "datatype": "DATE", + "name": "rslt_workListDate", + "title": "Worklist date", + "position": 37, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "rslt_qcWarning", + "title": "Warning", + "position": 38, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_qcMarked", + "title": "Marked", + "position": 39, + "value": false, + "hidden": false, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "rslt_qcCardPosition", + "title": "Position", + "position": 40, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isARepeat", + "title": "Is a repeat", + "position": 41, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isRepeated", + "title": "Is repeated", + "position": 42, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_report", + "title": "Report", + "position": 43, + "value": true, + "hidden": false, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_createdBy", + "title": "Created by", + "position": 44, + "value": "MeghanO", + "hidden": false, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_createdOn", + "title": "Created on", + "position": 45, + "value": 1724092556576, + "hidden": false, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "rslt_modifiedBy", + "title": "Modified by", + "position": 46, + "value": "MeghanO", + "hidden": false, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_modifiedOn", + "title": "Modified on", + "position": 47, + "value": 1724113340931, + "hidden": false, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_order", + "title": "Order", + "position": 48, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Order", + "displayValue": null, + "displayField": "ordr_barCode", + "foreignDisplayColumn": "ordr_barCode" + }, + { + "datatype": "BOOLEAN", + "name": "test_readOnly", + "title": "Read only", + "position": 49, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_previousStatus", + "title": "Previous status", + "position": 50, + "value": 12, + "hidden": true, + "editable": true, + "foreignTable": "Status", + "displayValue": "Pending", + "displayField": "stts_namePrevious", + "foreignDisplayColumn": "stts_name" + }, + { + "datatype": "BOOLEAN", + "name": "rslt_manuallyCreated", + "title": "rslt_manuallyCreated", + "position": 51, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "tsgr_fk_mainTest", + "title": "Main test", + "position": 52, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_timepointEnrollment", + "title": "Timepoint enrollment", + "position": 53, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "TimepointEnrollment", + "displayValue": null, + "displayField": "tpnr_uniqueIdentifier", + "foreignDisplayColumn": "tpnr_uniqueIdentifier" + }, + { + "datatype": "INTEGER", + "name": "rslt_pk", + "title": "rslt_pk", + "position": 54, + "value": 2331, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "attachmentCount", + "title": "attachmentCount", + "position": 55, + "value": 0, + "hidden": true, + "editable": true + }, + { + "datatype": "DATE", + "name": "xprs_observationStartDate", + "title": "Start Observation", + "position": 56, + "value": 1724092554890, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "grps_groupName", + "title": "Name", + "position": 57, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isMainTest", + "title": "Is main test", + "position": 58, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_request", + "title": "Request", + "position": 59, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Request", + "displayValue": null + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_experimentRunStep", + "title": "Protocol run step", + "position": 60, + "value": 64458, + "hidden": true, + "editable": true, + "foreignTable": "ExperimentRunStep", + "displayValue": null, + "displayField": "xprs_name", + "foreignDisplayColumn": "xprs_name" + }, + { + "datatype": "INTEGER", + "name": "test_seqNo", + "title": "Seq no", + "position": 61, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "tsgr_seqNo", + "title": "Seq no", + "position": 62, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "stts_name", + "title": "Name", + "position": 63, + "value": "Pending", + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "user_userName", + "title": "User name", + "position": 64, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "stts_namePrevious", + "title": "stts_namePrevious", + "position": 65, + "value": "Pending", + "hidden": true, + "editable": true + } + ], + "canUpdate": true, + "canDelete": true, + "links": [ + { + "rel": "self", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result/2331" + }, + { + "rel": "rslt_fk_content", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Content/3135" + }, + { + "rel": "rslt_fk_test", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Test/72" + }, + { + "rel": "rslt_cf_fk_mouseSession", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result/2329" + }, + { + "rel": "rslt_fk_status", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Status/12" + }, + { + "rel": "rslt_fk_previousStatus", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Status/12" + }, + { + "rel": "rslt_fk_experimentRunStep", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ExperimentRunStep/64458" + }, + { + "rel": "-rggr_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultAggregation?rggr_fk_result=2331" + }, + { + "rel": "-rggr_fk_aggregation", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultAggregation?rggr_fk_aggregation=2331" + }, + { + "rel": "-rqtm_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultQcTemplate?rqtm_fk_result=2331" + }, + { + "rel": "-rlvl_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/RuleEvaluation?rlvl_fk_result=2331" + }, + { + "rel": "-rslt_cf_fk_burr", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_burr=2331" + }, + { + "rel": "-rslt_cf_fk_ephysTrajectory", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_ephysTrajectory=2331" + }, + { + "rel": "-rslt_cf_fk_mouseSession", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_mouseSession=2331" + }, + { + "rel": "-qrrv_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/QcResultRuleEvaluation?qrrv_fk_result=2331" + }, + { + "rel": "attachments", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/attachment/Result/2331" + } + ] +} + ] diff --git a/tests/resources/example_fetch_ecephys_streams_result.json b/tests/resources/example_fetch_ecephys_streams_result.json new file mode 100644 index 0000000..62c2d37 --- /dev/null +++ b/tests/resources/example_fetch_ecephys_streams_result.json @@ -0,0 +1,807 @@ +[ + { + "pk": 2330, + "tableName": "Result", + "columns": [ + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_content", + "title": "Content", + "position": 0, + "value": 3135, + "hidden": false, + "editable": true, + "foreignTable": "Content", + "displayValue": "725804", + "displayField": "cntn_id", + "foreignDisplayColumn": "cntn_id" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_analyte", + "title": "Analyte", + "position": 1, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "Analyte", + "displayValue": null, + "displayField": "nlyt_name", + "foreignDisplayColumn": "nlyt_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_test", + "title": "Test", + "position": 2, + "value": 69, + "hidden": false, + "editable": false, + "foreignTable": "Test", + "displayValue": "Streams", + "displayField": "test_label", + "foreignDisplayColumn": "test_label" + }, + { + "datatype": "STRING", + "name": "test_name", + "title": "Name", + "position": 3, + "value": "test_ephys_in_vivo_recording_stream", + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "test_label", + "title": "Label", + "position": 4, + "value": "Streams", + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "test_requireAnalyte", + "title": "Requires analyte", + "position": 5, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "test_dynamicFormat", + "title": "Format observations", + "position": 6, + "value": "timeFormat", + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_resultObservationPoint", + "title": "Observation", + "position": 7, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "ResultObservationPoint", + "displayValue": null, + "displayField": "rsbp_label", + "foreignDisplayColumn": "rsbp_label" + }, + { + "datatype": "STRING", + "name": "rsbp_label", + "title": "Label", + "position": 8, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "rsbp_offset", + "title": "Offset", + "position": 9, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_manualValue", + "title": "Manual value", + "position": 10, + "value": false, + "hidden": false, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_cf_fk_instrument", + "title": "Instrument", + "position": 11, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Instrument", + "displayValue": null, + "displayField": "rslt_cf_fk_instrument_display", + "foreignDisplayColumn": "nstr_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_cf_fk_mouseSession", + "title": "Mouse Session", + "position": 12, + "value": 2329, + "hidden": false, + "editable": true, + "foreignTable": "Result", + "displayValue": "RSLT0000002377", + "displayField": "rslt_cf_fk_mouseSession_display", + "foreignDisplayColumn": "rslt_uniqueIdentifier" + }, + { + "datatype": "MULTIPLE_ENUM", + "name": "rslt_cf_streamModalities", + "title": "Stream Modalities", + "position": 13, + "value": [ + "Ecephys" + ], + "hidden": false, + "editable": true, + "joinedValue": "Ecephys" + }, + { + "datatype": "DATE", + "name": "rslt_cf_startedOn", + "title": "Stream start time", + "position": 14, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "DATE", + "name": "rslt_cf_endedOn", + "title": "Stream end time", + "position": 15, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "MULTIPLE_FOREIGN_KEY", + "name": "rslt_cf_fk_injectionMaterial2", + "title": "Modules used in this stream", + "position": 16, + "value": [ + 3418, + 3419 + ], + "hidden": false, + "editable": true, + "foreignTable": "ReferenceDataRecord", + "displayValues": [ + "725804_20240702", + "Stick Microscope" + ], + "foreignDisplayColumn": "rdrc_name", + "joinedDisplayValue": "725804_20240702, Stick Microscope" + }, + { + "datatype": "MULTIPLE_ENUM", + "name": "rslt_cf_daqNames", + "title": "DAQ Names", + "position": 17, + "value": [ + "Harp Behavior" + ], + "hidden": false, + "editable": true, + "joinedValue": "Harp Behavior" + }, + { + "datatype": "STRING", + "name": "rslt_cf_cameraNames", + "title": "Camera Names", + "position": 18, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "MULTIPLE_ENUM", + "name": "rslt_cf_cameraNames2", + "title": "Camera Names", + "position": 19, + "value": [ + "Face camera" + ], + "hidden": false, + "editable": true, + "joinedValue": "Face camera" + }, + { + "datatype": "STRING", + "name": "rslt_cf_requestorComments", + "title": "Camera Names", + "position": 20, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "MULTIPLE_FOREIGN_KEY", + "name": "rslt_cf_fk_lightSources", + "title": "Light Sources", + "position": 21, + "value": [], + "hidden": true, + "editable": true, + "foreignTable": "ReferenceDataRecord", + "displayValues": [], + "foreignDisplayColumn": "rdrc_name", + "joinedDisplayValue": "" + }, + { + "datatype": "BOOLEAN", + "name": "rslt_cf_activeMousePlatform", + "title": "Active Mouse Platform?", + "position": 22, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_cf_headframeRegistrationAttachment", + "title": "Headframe registration", + "position": 23, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "Attachment", + "displayValue": null, + "displayField": "attm_name", + "foreignDisplayColumn": "attm_name" + }, + { + "datatype": "STRING", + "name": "rslt_cf_targetRegionNotes", + "title": "Notes", + "position": 24, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "QUANTITY", + "name": "rslt_cf_rewardConsumed", + "title": "Reward Consumed", + "position": 25, + "value": null, + "hidden": true, + "editable": true, + "unit": "g" + }, + { + "datatype": "STRING", + "name": "rslt_cf_rewardDelivery", + "title": "Reward Delivery", + "position": 26, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_comments", + "title": "Notes", + "position": 27, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_uniqueIdentifier", + "title": "Unique identifier", + "position": 28, + "value": "RSLT0000002378", + "hidden": false, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudy", + "title": "Stability study", + "position": 29, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudy", + "displayValue": null, + "displayField": "stsd_name", + "foreignDisplayColumn": "stsd_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudyStorage", + "title": "Storage condition", + "position": 30, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudyStorage", + "displayValue": null, + "displayField": "storageName", + "foreignDisplayColumn": "sssr_uniqueIdentifier" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_stabilityStudyTimepoint", + "title": "Timepoint", + "position": 31, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "StabilityStudyTimepoint", + "displayValue": null, + "displayField": "timepointName", + "foreignDisplayColumn": "sstp_uniqueIdentifier" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_batch", + "title": "Batch", + "position": 32, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Content", + "displayValue": null, + "displayField": "enrolledBatch", + "foreignDisplayColumn": "cntn_id" + }, + { + "datatype": "ENUM", + "name": "rslt_aggregationMethod", + "title": "Aggregation method", + "position": 33, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_eventSummary", + "title": "Event summary", + "position": 34, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_valueEnteredOn", + "title": "Value entered on", + "position": 35, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_filler", + "title": "Filler", + "position": 36, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "User", + "displayValue": null, + "displayField": "user_userName", + "foreignDisplayColumn": "user_userName" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_status", + "title": "Status", + "position": 37, + "value": 12, + "hidden": false, + "editable": true, + "foreignTable": "Status", + "displayValue": "Pending", + "displayField": "stts_name", + "foreignDisplayColumn": "stts_name" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_workList", + "title": "Worklist", + "position": 38, + "value": null, + "hidden": false, + "editable": true, + "foreignTable": "WorkList", + "displayValue": null, + "displayField": "wrkl_name", + "foreignDisplayColumn": "wrkl_name" + }, + { + "datatype": "DATE", + "name": "rslt_workListDate", + "title": "Worklist date", + "position": 39, + "value": null, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "rslt_qcWarning", + "title": "Warning", + "position": 40, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_qcMarked", + "title": "Marked", + "position": 41, + "value": false, + "hidden": false, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "rslt_qcCardPosition", + "title": "Position", + "position": 42, + "value": null, + "hidden": false, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isARepeat", + "title": "Is a repeat", + "position": 43, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isRepeated", + "title": "Is repeated", + "position": 44, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_report", + "title": "Report", + "position": 45, + "value": true, + "hidden": false, + "editable": true + }, + { + "datatype": "STRING", + "name": "rslt_createdBy", + "title": "Created by", + "position": 46, + "value": "MeghanO", + "hidden": false, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_createdOn", + "title": "Created on", + "position": 47, + "value": 1724092556341, + "hidden": false, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "rslt_modifiedBy", + "title": "Modified by", + "position": 48, + "value": "MeghanO", + "hidden": false, + "editable": true + }, + { + "datatype": "DATE", + "name": "rslt_modifiedOn", + "title": "Modified on", + "position": 49, + "value": 1724113350481, + "hidden": false, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "user_userName", + "title": "User name", + "position": 50, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "attachmentCount", + "title": "attachmentCount", + "position": 51, + "value": 0, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "test_seqNo", + "title": "Seq no", + "position": 52, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_experimentRunStep", + "title": "Protocol run step", + "position": 53, + "value": 64457, + "hidden": true, + "editable": true, + "foreignTable": "ExperimentRunStep", + "displayValue": null, + "displayField": "xprs_name", + "foreignDisplayColumn": "xprs_name" + }, + { + "datatype": "STRING", + "name": "stts_name", + "title": "Name", + "position": 54, + "value": "Pending", + "hidden": true, + "editable": true + }, + { + "datatype": "STRING", + "name": "stts_namePrevious", + "title": "stts_namePrevious", + "position": 55, + "value": "Pending", + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_timepointEnrollment", + "title": "Timepoint enrollment", + "position": 56, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "TimepointEnrollment", + "displayValue": null, + "displayField": "tpnr_uniqueIdentifier", + "foreignDisplayColumn": "tpnr_uniqueIdentifier" + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_request", + "title": "Request", + "position": 57, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Request", + "displayValue": null + }, + { + "datatype": "BOOLEAN", + "name": "rslt_manuallyCreated", + "title": "rslt_manuallyCreated", + "position": 58, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "tsgr_seqNo", + "title": "Seq no", + "position": 59, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "INTEGER", + "name": "rslt_pk", + "title": "rslt_pk", + "position": 60, + "value": 2330, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "rslt_isMainTest", + "title": "Is main test", + "position": 61, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "DATE", + "name": "xprs_observationStartDate", + "title": "Start Observation", + "position": 62, + "value": 1724092554772, + "hidden": true, + "editable": true, + "dateFormat": "MM/dd/yyyy HH:mm:ss", + "subType": "datetime", + "timeZone": "America/Los_Angeles" + }, + { + "datatype": "STRING", + "name": "grps_groupName", + "title": "Name", + "position": 63, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_previousStatus", + "title": "Previous status", + "position": 64, + "value": 12, + "hidden": true, + "editable": true, + "foreignTable": "Status", + "displayValue": "Pending", + "displayField": "stts_namePrevious", + "foreignDisplayColumn": "stts_name" + }, + { + "datatype": "INTEGER", + "name": "tsgr_fk_mainTest", + "title": "Main test", + "position": 65, + "value": null, + "hidden": true, + "editable": true + }, + { + "datatype": "BOOLEAN", + "name": "test_readOnly", + "title": "Read only", + "position": 66, + "value": false, + "hidden": true, + "editable": true + }, + { + "datatype": "FOREIGN_KEY", + "name": "rslt_fk_order", + "title": "Order", + "position": 67, + "value": null, + "hidden": true, + "editable": true, + "foreignTable": "Order", + "displayValue": null, + "displayField": "ordr_barCode", + "foreignDisplayColumn": "ordr_barCode" + } + ], + "canUpdate": true, + "canDelete": true, + "links": [ + { + "rel": "self", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result/2330" + }, + { + "rel": "rslt_fk_content", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Content/3135" + }, + { + "rel": "rslt_fk_test", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Test/69" + }, + { + "rel": "rslt_cf_fk_mouseSession", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result/2329" + }, + { + "rel": "rslt_fk_status", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Status/12" + }, + { + "rel": "rslt_fk_experimentRunStep", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ExperimentRunStep/64457" + }, + { + "rel": "rslt_fk_previousStatus", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Status/12" + }, + { + "rel": "-rggr_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultAggregation?rggr_fk_result=2330" + }, + { + "rel": "-rggr_fk_aggregation", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultAggregation?rggr_fk_aggregation=2330" + }, + { + "rel": "-rqtm_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/ResultQcTemplate?rqtm_fk_result=2330" + }, + { + "rel": "-rlvl_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/RuleEvaluation?rlvl_fk_result=2330" + }, + { + "rel": "-rslt_cf_fk_burr", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_burr=2330" + }, + { + "rel": "-rslt_cf_fk_ephysTrajectory", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_ephysTrajectory=2330" + }, + { + "rel": "-rslt_cf_fk_mouseSession", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/Result?rslt_cf_fk_mouseSession=2330" + }, + { + "rel": "-qrrv_fk_result", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/QcResultRuleEvaluation?qrrv_fk_result=2330" + }, + { + "rel": "attachments", + "href": "https://aind-test.us.slims.agilent.com/slimsrest/rest/attachment/Result/2330" + } + ] +} + ] diff --git a/tests/test_ecephys_session.py b/tests/test_ecephys_session.py new file mode 100644 index 0000000..2177cd3 --- /dev/null +++ b/tests/test_ecephys_session.py @@ -0,0 +1,95 @@ +"""Tests methods in ecephys session module""" + +import json +import os +import unittest +from pathlib import Path +from unittest.mock import MagicMock, patch + +from slims.internal import Record + +from aind_slims_api.core import SlimsClient +from aind_slims_api.models.ecephys_session import ( + SlimsStreamsResult, + SlimsMouseSessionResult, + SlimsStimulusEpochsResult, +) + +RESOURCES_DIR = Path(os.path.dirname(os.path.realpath(__file__))) / "resources" + +class TestEcephysSessionResults(unittest.TestCase): + """Tests top level methods in mouse module""" + + example_client: SlimsClient + example_fetch_mouse_response: list[Record] + + @classmethod + def setUpClass(cls): + """Load json files of expected responses from slims""" + example_client = SlimsClient( + url="http://fake_url", username="user", password="pass" + ) + cls.example_client = example_client + with open(RESOURCES_DIR / "example_fetch_ecephys_session_result.json", "r") as f: + response = [ + Record(json_entity=r, slims_api=example_client.db.slims_api) + for r in json.load(f) + ] + cls.example_fetch_ecephys_session_result = response + + with open(RESOURCES_DIR / "example_fetch_ecephys_streams_result.json", "r") as f: + response = [ + Record(json_entity=r, slims_api=example_client.db.slims_api) + for r in json.load(f) + ] + cls.example_fetch_ecephys_streams_result = response + + with open(RESOURCES_DIR / "example_fetch_ecephys_stimulus_epochs_result.json", "r") as f: + response = [ + Record(json_entity=r, slims_api=example_client.db.slims_api) + for r in json.load(f) + ] + cls.example_fetch_ecephys_stimulus_epochs_result = response + + @patch("slims.slims.Slims.fetch") + def test_fetch_ecephys_mouse_session_success(self, mock_fetch: MagicMock): + """Test fetch_mouse_session when successful""" + mock_fetch.return_value = self.example_fetch_ecephys_session_result + session = self.example_client.fetch_model( + SlimsMouseSessionResult, mouse_pk=3135 + ) + self.assertEqual( + self.example_fetch_ecephys_session_result[0].json_entity, session.json_entity + ) + self.assertEqual(session.test_label, "Mouse Session") + + @patch("slims.slims.Slims.fetch") + def test_fetch_ecephys_streams_success(self, mock_fetch: MagicMock): + """Test fetch streams when successful""" + mock_fetch.return_value = self.example_fetch_ecephys_streams_result + streams = self.example_client.fetch_model( + SlimsStreamsResult, mouse_session_pk=2329 + ) + self.assertEqual( + self.example_fetch_ecephys_streams_result[0].json_entity, streams.json_entity + ) + self.assertEqual(streams.test_label, "Streams") + self.assertEqual(streams.camera_names, ['Face camera']) + + @patch("slims.slims.Slims.fetch") + def test_fetch_ecephys_stim_epochs_success(self, mock_fetch: MagicMock): + """Test fetch stim epochs when successful""" + mock_fetch.return_value = self.example_fetch_ecephys_stimulus_epochs_result + stim_epochs = self.example_client.fetch_model( + SlimsStimulusEpochsResult, mouse_session_pk=2329 + ) + self.assertEqual( + self.example_fetch_ecephys_stimulus_epochs_result[0].json_entity, stim_epochs.json_entity + ) + self.assertEqual(stim_epochs.test_label, "Stimulus Epochs") + self.assertEqual(stim_epochs.laser_name, "Coherent Red Laser") + + + +if __name__ == "__main__": + unittest.main()