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 current steps to sample details #167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion LIMS2DB/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Researcher,
ReagentType,
)
from genologics_sql.queries import get_children_processes, get_processes_in_history
from genologics_sql.queries import get_children_processes, get_processes_in_history, get_currentsteps_protocol_for_sample, get_protocolstep_details
from LIMS2DB.diff import diff_objects
from requests import get as rget
from sqlalchemy import text
Expand Down Expand Up @@ -878,6 +878,17 @@ def get_samples(self):

self.get_initial_qc(sample)
self.get_library_preps(sample)
self.get_current_step_sample(sample)

def get_current_step_sample(self, sample):
""" Get the current steps a sample is in"""
sample_in_steps = get_currentsteps_protocol_for_sample(self.session, sample.sampleid)
if sample_in_steps:
current_steps = {}
for step in sample_in_steps:
step_details = get_protocolstep_details(self.session, step[0])[0]
current_steps[step_details[0]] = {"protocol_name": step_details[1], "is_qc_protocol": step_details[2]}
self.obj["samples"][sample.name]["current_step"] = current_steps

def get_initial_qc(self, sample):
self.obj["samples"][sample.name]["initial_qc"] = {}
Expand Down