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

Add Waterlog Mouse class with common operations #33

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

patricklatimer
Copy link
Collaborator

Collects common operations into a class that can be used instead of juggling different records. Probably a useful pattern in other cases as well.

restriction: SlimsWaterRestrictionEvent
all_restrictions: list[SlimsWaterRestrictionEvent]

def __init__(self, barcode: str, user: SlimsUser, slims_client=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe user can be a union of string username or SlimsUser?

self._fetch_data()
self._fetch_pks()

def _fetch_data(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can implement these as properties and lazily fetch them. I can anticipate this class being used to get more than just water-related information; behavior sessions, surgical procedures, etc. Maybe it's not good to do all these fetches on instance init.

):
"""Creates and adds a new waterlog weight/water record to SLIMS, and
updates self.waterlog_results accordingly"""
if total_water is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is total water ever going to not be water_supplement_delivered + water_earned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants