-
Notifications
You must be signed in to change notification settings - Fork 4
BDMS-118: Create analysis method table #150
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dab661a
feat: create `AnalysisMethod` table and add to `__init__.py` file
ksmuczynski 6496a8e
feat: Add `AnalysisMethod` relationship and foreign key to `Observati…
ksmuczynski ee87395
refactor: rename columns to make clear fields are related to analysis…
ksmuczynski 6ad7ad7
feat: add valid `analysis_method_type` values to the `lexicon.json` file
ksmuczynski 5a77ac5
refactor: set `analysis_method_type` and `source_organization` fields…
ksmuczynski 27fcfc4
refactor: import `lexicon_term` from db.base
ksmuczynski ed4d5a4
refactor: import mixins
ksmuczynski 6669ea9
refactor: fix typo in `lexicon.py` file
ksmuczynski 7233e49
refactor: add TODO comment on `analysis_method_name` field
ksmuczynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,46 @@ | ||
| """ | ||
| This table is a citable library of abstract analytical methods and | ||
| standardized field procedures. | ||
| """ | ||
|
|
||
| from typing import List, TYPE_CHECKING | ||
|
|
||
| from sqlalchemy.orm import relationship, Mapped, mapped_column | ||
|
|
||
| from db.base import Base, AutoBaseMixin, ReleaseMixin, lexicon_term | ||
|
|
||
| if TYPE_CHECKING: | ||
| from db.observation import Observation | ||
|
|
||
|
|
||
| class AnalysisMethod(Base, AutoBaseMixin, ReleaseMixin): | ||
| """ | ||
| Represents a single, citable analytical method or standard procedure. | ||
| This is a lookup table. | ||
| """ | ||
|
|
||
| # --- Columns --- | ||
| analysis_method_code: Mapped[str] = mapped_column( | ||
| nullable=True, | ||
| unique=True, | ||
| comment="The official code or identifier for the method (e.g., 'EPA 300.0').", | ||
| ) | ||
| # TODO: get AMP feedback on if this should be restricted (i.e. lexicon term) | ||
| analysis_method_name: Mapped[str] = mapped_column( | ||
| nullable=False, | ||
| comment="The common, human-readable name of the method (e.g., Ion Chromatography for Anions).", | ||
| ) | ||
| analysis_method_type: Mapped[str] = lexicon_term( | ||
| nullable=True, | ||
| comment="A controlled vocabulary field to categorize the method (e.g., 'Laboratory', 'Field Procedure', 'Calculation').", | ||
| ) | ||
| source_organization: Mapped[str] = lexicon_term( | ||
| nullable=True, | ||
| comment="The organization that published the method (e.g., 'US EPA', 'USGS').", | ||
| ) | ||
|
|
||
| # --- Relationships --- | ||
| # One-To-Many: An AnalysisMethod can be used for many Observations. | ||
| observations: Mapped[List["Observation"]] = relationship( | ||
| "Observation", back_populates="analysis_method" | ||
| ) | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.