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

Fixed bug requiring additional IDs for BehaviorDataLimsApi #1374

Merged
merged 2 commits into from
Feb 24, 2020
Merged
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion allensdk/internal/api/behavior_data_lims_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def _get_ids(self) -> Dict[str, Optional[Union[int, List[int]]]]:
WHERE ophys_session_id = {ids_dict["ophys_session_id"]};
"""
oed = self.lims_db.fetchall(oed_query)
if len(oed) == 0:
oed = None

container_query = f"""
SELECT DISTINCT
Expand All @@ -102,7 +104,10 @@ def _get_ids(self) -> Dict[str, Optional[Union[int, List[int]]]]:
WHERE
ophys_experiment_id IN ({",".join(set(map(str, oed)))});
"""
container_id = self.lims_db.fetchone(container_query, strict=True)
try:
container_id = self.lims_db.fetchone(container_query, strict=True)
except OneResultExpectedError:
container_id = None

ids_dict.update({"ophys_experiment_ids": oed,
"ophys_container_id": container_id})
Expand Down