-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pydantic model for slims records (#12)
* feat: add pydantic model for slims records * fix: f-string typo * feat: add unit model * feat: include json_entity in models * feat: return dict if validation fails * test: update unit tests * test: clear existing env vars in config test * style: clean up core/user test * test: add unitspec/mouse validation tests * fix: return json_entity if validation fails * style: change relative imports to absolute
- Loading branch information
1 parent
4f6cc2f
commit 655ab26
Showing
9 changed files
with
448 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Contains a model for a unit""" | ||
|
||
import logging | ||
from typing import Optional | ||
|
||
from pydantic import Field | ||
|
||
from aind_slims_api.core import SlimsBaseModel | ||
|
||
logger = logging.getLogger() | ||
|
||
|
||
class SlimsUnit(SlimsBaseModel): | ||
"""Model for unit information in SLIMS""" | ||
|
||
name: str = Field(..., alias="unit_name") | ||
abbreviation: Optional[str] = Field("", alias="unit_abbreviation") | ||
pk: int = Field(..., alias="unit_pk") | ||
|
||
_slims_table: str = "Unit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.