<commit_before>import couchdb

from  genologics_sql.tables import *
from  genologics_sql.utils import *
from  genologics_sql.queries import get_last_modified_processes

import LIMS2DB.objectsDB.process_categories as pc_cg

from sqlalchemy import text

def create_lims_data_obj(session, pro):
    obj={}
    obj['step_id']=pro.luid

    if pc_cg.SEQUENCING.get(str(pro.typeid), '') == 'AUTOMATED - NovaSeq Run (NovaSeq 6000 v2.0)':
        #NovaSeq flowcell have the individual stats as output artifact
        query = "select art.* from artifact art \
                 inner join outputmapping omap on omap.outputartifactid=art.artifactid \
                 inner join processiotracker piot on piot.trackerid=omap.trackerid \
                 where art.name LIKE 'Lane%' and piot.processid = {pid}::integer;".format(pid=pro.processid)
    else:
        #which container is used in this step ?
        query = "select distinct ct.* from container ct\
                 inner join containerplacement cp on cp.containerid=ct.containerid \
                 inner join processiotracker piot on piot.inputartifactid=cp.processartifactid \
                 where piot.processid = {pid}::integer;".format(pid=pro.processid)
    
    cont=session.query(Container).from_statement(text(query)).first()
    obj['container_id']=cont.luid
    obj['container_name']=cont.name


    #Which artifacts are updated in this step ?
    query= "select distinct art.* from artifact art\
            inner join processiotracker piot on piot.inputartifactid=art.artifactid \
            where piot.processid = {pid}::integer;".format(pid=pro.processid)

    obj['run_summary']={}
    arts=session.query(Artifact).from_statement(text(query)).all()
    for art in arts:
        if pc_cg.SEQUENCING.get(str(pro.typeid), '') == 'AUTOMATED - NovaSeq Run (NovaSeq 6000 v2.0)':
            lane = art.name.replace("Lane ", "")
        else:
            lane=art.containerplacement.api_string.split(":")[0]<commit_msg>Move the check to right place<commit_after>import couchdb

from  genologics_sql.tables import *
from  genologics_sql.utils import *
from  genologics_sql.queries import get_last_modified_processes

import LIMS2DB.objectsDB.process_categories as pc_cg

from sqlalchemy import text

def create_lims_data_obj(session, pro):
    obj={}
    obj['step_id']=pro.luid

    #which container is used in this step ?
    query = "select distinct ct.* from container ct\
             inner join containerplacement cp on cp.containerid=ct.containerid \
             inner join processiotracker piot on piot.inputartifactid=cp.processartifactid \
             where piot.processid = {pid}::integer;".format(pid=pro.processid)
    
    cont=session.query(Container).from_statement(text(query)).first()
    obj['container_id']=cont.luid
    obj['container_name']=cont.name

    if pc_cg.SEQUENCING.get(str(pro.typeid), '') == 'AUTOMATED - NovaSeq Run (NovaSeq 6000 v2.0)':
        #NovaSeq flowcell have the individual stats as output artifact
        query = "select art.* from artifact art \
                 inner join outputmapping omap on omap.outputartifactid=art.artifactid \
                 inner join processiotracker piot on piot.trackerid=omap.trackerid \
                 where art.name LIKE 'Lane%' and piot.processid = {pid}::integer;".format(pid=pro.processid)
    else:
        #Which artifacts are updated in this step ?
        query = "select distinct art.* from artifact art\
                 inner join processiotracker piot on piot.inputartifactid=art.artifactid \
                 where piot.processid = {pid}::integer;".format(pid=pro.processid)

    obj['run_summary']={}
    arts=session.query(Artifact).from_statement(text(query)).all()
    for art in arts:
        if pc_cg.SEQUENCING.get(str(pro.typeid), '') == 'AUTOMATED - NovaSeq Run (NovaSeq 6000 v2.0)':
            lane = art.name.replace("Lane ", "")
        else:
            lane=art.containerplacement.api_string.split(":")[0]
{'fraction_non_alphanumeric': 0.10597689603214465, 'fraction_numerical': 0.007031642390758413, 'mean_word_length': 3.0809426229508197, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1841265', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1200, 'n_words': 286}