-
Notifications
You must be signed in to change notification settings - Fork 19
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
Cheek Samples #597
Open
cassidysymons
wants to merge
7
commits into
master
Choose a base branch
from
csymons_cheek_samples
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Cheek Samples #597
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a5a2ebb
Adjustments for cheek samples
cassidysymons 3a6e9b3
Lint
cassidysymons 5d43fd9
Unit tests
cassidysymons c3470eb
Refactor barcode_meta storage
cassidysymons 3f1ef6f
Lint
cassidysymons f515204
Feedback from code review
cassidysymons 6a31b02
barcode_meta default value
cassidysymons 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 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
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,23 @@ | ||
-- Beginning with cheek samples, we're collecting metadata that are explicitly | ||
-- linked to sample collection (unlike surveys, which are implicitly linked | ||
-- to samples via sources), but not globally collected, and therefore don't | ||
-- belong in the ag.ag_kit_barcodes table. A new table will store these | ||
-- fields and could eventually be extended to a much more robust framework. | ||
|
||
-- First, we need to set up an ENUM type to enforce values for the type of | ||
-- product used to last wash their face | ||
CREATE TYPE SAMPLE_SITE_LAST_WASHED_PRODUCT_TYPE AS ENUM ('Soap (includes bar and liquid soap)', 'Foaming face wash', 'Face cleanser', 'Just water', 'Other (e.g. shampoo, body wash, all-in-one or all-over wash)', 'Not sure'); | ||
|
||
-- Then, create the table to store the data | ||
-- Note: the date and time are stored separately because we're not enforcing | ||
-- either as a required field. As such, using a timestamp type would not be | ||
-- appropriate since it forces us into a both or neither paradigm. | ||
CREATE TABLE ag.ag_kit_barcodes_cheek ( | ||
ag_kit_barcode_id UUID NOT NULL PRIMARY KEY, | ||
sample_site_last_washed_date DATE, | ||
sample_site_last_washed_time TIME, | ||
sample_site_last_washed_product SAMPLE_SITE_LAST_WASHED_PRODUCT_TYPE, | ||
|
||
-- Foreign key relationship on ag_kit_barcode_id | ||
CONSTRAINT fk_ag_kit_barcode_id FOREIGN KEY (ag_kit_barcode_id) REFERENCES ag.ag_kit_barcodes (ag_kit_barcode_id) | ||
); |
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this allowed to be null? Under what circumstances would that be the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, all three of the questions are (highly) encouraged but strictly optional. As such, we allow them to be nullable in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok ... now I'm wondering what the meaningful difference is between (a) a completed cheek sample with no record in the
ag_kit_barcodes_cheek
table and (b) a completed cheek sample with a record in theag_kit_barcodes_cheek
table for which all fields except the foreign key back to theag_kit_barcodes
table are NULL. Do these two cases have two distinct meanings? What is signified by a completely empty (except for FK) record in the cheek table?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a metadata perspective, they do have a distinct meaning. NULL values would be reported as "not provided" while a cheek sample with no values for the questions (including NULL) would be reported as "not collected."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, that's fascinating--I don't think I really understand what these differences mean in this context, but good to know!