This repository has been archived by the owner on Sep 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Update Barcode Scanner #632
Open
teravest
wants to merge
17
commits into
qiime:master
Choose a base branch
from
teravest:issue626barcodeseparate
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
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2bd9cd8
separatating barcode edits
teravest 7d4f3fa
fixed indent
teravest a32ffb2
updates to barcode_util
teravest b6f3b05
working version before refactoring barcode_utils
teravest 8e7716f
partial refactor of barcode scanner
teravest 8341715
Update barcode scanner to edit barcode fields
teravest 97363ae
clean up qiime_data_access.py
teravest d7a3683
adding barcode status
teravest f3316e2
updated biomass and made headers for general vs project
teravest 285d769
added project group and display by project group
teravest 0152739
fixed separation of barcode vs project info
teravest 539f896
remove try except in favor of if statment
teravest 4bb433e
in the middle of addressing comments
teravest 2f85224
changes based on review comments.
teravest 58f2fa6
Merge branch 'master' of https://github.com/qiime/qiime_web_app into …
teravest 5d3d31d
cleanup bugs and edit barcode
teravest c3472f3
fixed form name conflict
teravest 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
create or replace procedure get_barcode_details | ||
( | ||
barcode_ in varchar2 | ||
, results_ out types.ref_cursor | ||
) as | ||
begin | ||
open results_ for | ||
select create_date_time, status, scan_date, sample_postmark_date, biomass_remaining, sequencing_status, obsolete | ||
from barcode | ||
where barcode = barcode_; | ||
end get_barcode_details; | ||
|
||
|
||
/* | ||
variable user_data_ REFCURSOR; | ||
execute get_barcode_details('000001029', :user_data_); | ||
print user_data_; | ||
*/ |
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,16 @@ | ||
create or replace procedure get_barcode_statuses( | ||
statuses_ out types.ref_cursor | ||
)as | ||
begin | ||
open statuses_ for | ||
select status from barcode_status; | ||
|
||
end get_barcode_statuses; | ||
|
||
|
||
|
||
/* | ||
variable results REFCURSOR; | ||
execute get_barcode_statuses(:results); | ||
print results; | ||
*/ |
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,16 @@ | ||
create or replace procedure get_project_group | ||
( | ||
project_name in varchar2 , | ||
group_name_ out types.ref_cursor | ||
) as | ||
begin | ||
open group_name_ for | ||
select g.group_name from project_groups g inner join project p on g.group_id = p.group_id | ||
where p.project = project_name; | ||
end get_project_group; | ||
|
||
|
||
/*variable x REFCURSOR; | ||
execute get_project_group('Handout Kits', :x); | ||
print x; | ||
*/ |
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,14 @@ | ||
create or replace procedure get_sequencing_statuses( | ||
seq_statuses_ out types.ref_cursor | ||
)as | ||
|
||
begin | ||
open seq_statuses_ for | ||
select sequencing_status from BARCODE_SEQUENCING_STATUS; | ||
|
||
end get_sequencing_statuses; | ||
|
||
/*variable sequencing_statuses_ REFCURSOR; | ||
execute get_sequencing_statuses(:sequencing_statuses_); | ||
print sequencing_statuses_; | ||
*/ |
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 |
---|---|---|
|
@@ -2963,11 +2963,14 @@ def updateSeqOtuCounts(self, sequence_prep_id, num_sequences, num_otus, otu_perc | |
print 'Exception caught: %s.\nThe error is: %s' % (type(e), e) | ||
return False | ||
|
||
def updateBarcodeStatus(self, status, postmark, scan_date, barcode): | ||
def updateBarcodeStatus(self, status, postmark, scan_date, barcode, | ||
biomass_remaining, sequencing_status, obsolete): | ||
""" Updates a barcode's status | ||
""" | ||
con = self.getMetadataDatabaseConnection() | ||
con.cursor().callproc('update_barcode_status', [status, postmark, scan_date, barcode]) | ||
con.cursor().callproc('update_barcode_status', [status, postmark, | ||
scan_date, barcode, biomass_remaining, | ||
sequencing_status, obsolete]) | ||
|
||
def getBarcodeProjType(self, barcode): | ||
""" Get the project type of the barcode. | ||
|
@@ -2999,4 +3002,57 @@ def getProjectNames(self): | |
con.cursor().callproc('get_project_names', [result]) | ||
projnames = [row[0] for row in result] | ||
return projnames | ||
|
||
def getSequencingStatuses(self): | ||
"""Returns a list of sequencings statuses | ||
""" | ||
con = self.getMetadataDatabaseConnection() | ||
result = con.cursor() | ||
con.cursor().callproc('get_sequencing_statuses', [result]) | ||
seq_statuses = [row[0] for row in result] | ||
return seq_statuses | ||
|
||
def getBarcodeStatuses(self): | ||
"""Returns a list of barcode statuses | ||
""" | ||
con = self.getMetadataDatabaseConnection() | ||
result = con.cursor() | ||
con.cursor().callproc('get_barcode_statuses', [result]) | ||
bar_statuses = [row[0] for row in result] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
return bar_statuses | ||
|
||
def getProjectGroup(self, project_name): | ||
"""Returns a project group name | ||
|
||
project_name is the name of the project from the table project | ||
""" | ||
con = self.getMetadataDatabaseConnection() | ||
result = con.cursor() | ||
con.cursor().callproc('get_project_group', [project_name,result]) | ||
group = result.fetchone() | ||
if group: | ||
return group[0] | ||
else: | ||
return None | ||
|
||
def getBarcodeDetails(self, barcode): | ||
"""returns a dictionary of barcode deatails | ||
""" | ||
con = self.getMetadataDatabaseConnection() | ||
results = con.cursor() | ||
con.cursor().callproc('get_barcode_details',[barcode, results]) | ||
row = results.fetchone() | ||
if row is not None: | ||
barcode_details = { | ||
'create_date' : row[0], | ||
'status' : row[1], | ||
'scan_date' : row[2], | ||
'sample_postmark_date' : row[3], | ||
'biomass_remaining' : row[4], | ||
'sequencing_status' : row[5], | ||
'obsolete' : row[6] | ||
} | ||
else: | ||
#no results mean barcode doesn't exist | ||
barcode_details = {} | ||
return barcode_details |
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.
Can this fail with an
IndexError
and should this be caught?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.
I don't think so. Even if no rows are returned
seq_statuses
will end up as an empty list. And unless the procedure returns a row with zero fields (I don't think this is possible),row[0]
will always exist. This might be the kind of place you'd use an assert, I guess, because these tests would be for things that should not be possibleThere 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.
Gotcha, thanks for the explanation.