Example #1
0
def sipOutputPage(request):
    import sip_model

    chemical_name = request.POST.get('chemical_name')
   # select_receptor = request.POST.get('select_receptor')
   # bw_bird = request.POST.get('body_weight_of_bird')
   # bw_mamm = request.POST.get('body_weight_of_mammal')
    sol = request.POST.get('solubility')
    ld50_a = request.POST.get('ld50_a')
    ld50_m = request.POST.get('ld50_m')
    aw_bird = request.POST.get('aw_bird')
    # tw_bird = request.POST.get('body_weight_of_the_tested_bird')
    aw_mamm = request.POST.get('aw_mamm')
    # tw_mamm = request.POST.get('body_weight_of_the_tested_mammal')
    mineau = request.POST.get('mineau_scaling_factor')
    noael = request.POST.get('NOAEL')
    noaec_d = request.POST.get('NOAEC_d')
    noaec_q = request.POST.get('NOAEC_q')
    noaec_o = request.POST.get('NOAEC_o')
    # noaec_o2 = request.POST.get('NOAEC_o2')
    Species_of_the_bird_NOAEC_CHOICES = request.POST.get('NOAEC_species')
    bw_quail = request.POST.get('bw_quail')
    bw_duck = request.POST.get('bw_duck')
    bwb_other = request.POST.get('bwb_other')
    bw_rat = request.POST.get('bw_rat')
    bwm_other = request.POST.get('bwm_other')
    b_species = request.POST.get('b_species')
    m_species = request.POST.get('m_species')

    sip_obj = sip_model.sip(True,True,'single',chemical_name, b_species, m_species, bw_quail, bw_duck, bwb_other, bw_rat, bwm_other, sol, ld50_a, ld50_m, aw_bird, mineau, aw_mamm, noaec_d, noaec_q, noaec_o, Species_of_the_bird_NOAEC_CHOICES, noael)

    return sip_obj
 def runSIPModel(self, config_properties, results_dict):
     if not results_dict:
         results_dict = {}
     # this is where properties are searched, converted as needed, and any available methods are called
     logger.info(config_properties)
     chemical_name = None
     if "chemical_name" in config_properties:
         chemical_name = config_properties["chemical_name"]
     sol = None
     if "solubility" in config_properties:
         sol = config_properties["solubility"]
     ld50_a = None
     if "avian_ld50_water" in config_properties:
         ld50_a = config_properties["avian_ld50_water"]
     noaec = None
     if "avian_NOAEC" in config_properties:
         noaec = config_properties["avian_NOAEC"]
     aw_bird = None
     if "body_weight_of_the_assessed_bird" in config_properties:
         aw_bird = config_properties["body_weight_of_the_assessed_bird"]
     bw_quail = None
     if "bw_quail" in config_properties:
         bw_quail = config_properties["bw_quail"]
     bw_duck = None
     if "bw_duck" in config_properties:
         bw_duck = config_properties["bw_duck"]
     bwb_other = None
     if "bwb_other" in config_properties:
         bwb_other = config_properties["bwb_other"]
     mineau = None
     if "mineau" in config_properties:
         mineau = config_properties["mineau"]
     ld50_m = None
     if "ld50_m" in config_properties:
         ld50_m = config_properties["ld50_m"]
     noael = None
     if "noael" in config_properties:
         noael = config_properties["noael"]
     aw_mamm = None
     if "aw_mamm" in config_properties:
         aw_mamm = config_properties["aw_mamm"]
     bw_rat = None
     if "bw_rat" in config_properties:
         bw_rat = config_properties["bw_rat"]
     bwm_other = None
     if "bwm_other" in config_properties:
         bw_rat = config_properties["bwm_other"]
     m_species = None
     if "m_species" in config_properties:
         m_species = config_properties["m_species"]
     b_species = None
     if "b_species" in config_properties:
         b_species = config_properties["id_Species_of_the_tested_bird"]
     noaec_d = None
     if "noaec_d" in config_properties:
         noaec_d = config_properties["noaec_d"]
     noaec_q = None
     if "noaec_q" in config_properties:
         noaec_q = config_properties["noaec_q"]
     noaec_o = None
     if "noaec_o" in config_properties:
         noaec_o = config_properties["noaec_o"]
     sip_obj = sip_model.sip(
         True,
         True,
         True,
         chemical_name,
         b_species,
         m_species,
         bw_quail,
         bw_duck,
         bwb_other,
         bw_rat,
         bwm_other,
         sol,
         ld50_a,
         ld50_m,
         aw_bird,
         mineau,
         aw_mamm,
         noaec_d,
         noaec_q,
         noaec_o,
         Species_of_the_bird_NOAEC_CHOICES,
         noael,
     )
     results_dict["sip"] = vars(sip_obj)
     return results_dict
Example #3
0
        testFailureMessage = "Test of function name: %s expected: %s != calculated: %s" % ("chronconm",self.sip_obj.chronconm_out,fun)
        self.assertEqual(fun,self.chronconm_out,testFailureMessage)

def suite(TestCaseName, **kwargs):
    suite = unittest.TestSuite()
    set_globals(**kwargs)
    suite.addTest(unittest.makeSuite(TestCaseName))
    stream = StringIO()
    runner = unittest.TextTestRunner(stream=stream, verbosity=2)
    result = runner.run(suite)
    stream.seek(0)
    test_out=stream.read()
    return test_out


sip_obj = sip_model.sip(True,True,'qaqc',chemical_name[0], b_species[0], m_species[0], bw_quail[0], bw_duck[0], bwb_other[0], bw_rat[0], bwm_other[0], sol[0], avian_ld50[0], mammalian_ld50[0], aw_bird[0], mineau[0], aw_mamm[0], noaec_d[0], noaec_q[0], noaec_o[0], Species_of_the_bird_NOAEC_CHOICES[0], noael[0])
sip_obj.set_unit_testing_variables()

sip_obj.chemical_name_expected = chemical_name[0]
sip_obj.dose_bird_out_expected = dose_bird_out[0]
sip_obj.dose_mamm_out_expected = dose_mamm_out[0]
sip_obj.at_bird_out_expected = at_bird_out[0]
sip_obj.at_mamm_out_expected = at_mamm_out[0]
sip_obj.det_out_expected = det_out[0]
sip_obj.act_out_expected = act_out[0]
sip_obj.acute_bird_out_expected = acute_bird_out[0]
sip_obj.acuconb_out_expected = acuconb_out[0]
sip_obj.acute_mamm_out_expected = acute_mamm_out[0]
sip_obj.acuconm_out_expected = acuconm_out[0]
sip_obj.chron_bird_out_expected = chron_bird_out[0]
sip_obj.chronconb_out_expected = chronconb_out[0]
def html_table(row_inp_all):
    while True:
        row_inp_temp_all = row_inp_all.get()
        if row_inp_temp_all is None:
            break
        else:
            row_inp = row_inp_temp_all[0]
            iter = row_inp_temp_all[1]

            logger.info("iteration: " + str(iter))
            chemical_name.append(str(row_inp[0]))
            b_species.append(float(row_inp[1]))
            m_species.append(float(row_inp[2]))
            bw_quail.append(float(row_inp[3]))
            bw_duck.append(float(row_inp[4]))
            bwb_other.append(float(row_inp[5])) 
            bw_rat.append(float(row_inp[6]))
            bwm_other.append(float(row_inp[7]))
            sol.append(float(row_inp[8]))
            avian_ld50.append(float(row_inp[9])) 
            mammalian_ld50.append(float(row_inp[10]))
            aw_bird.append(float(row_inp[11]))
            mineau.append(float(row_inp[12]))
            aw_mamm.append(float(row_inp[13]))
            noaec_d.append(float(row_inp[14]))
            noaec_q.append(float(row_inp[15]))
            noaec_o.append(float(row_inp[16]))
            noael.append(float(row_inp[17]))
            Species_of_the_bird_NOAEC_CHOICES.append(str(row_inp[18]))
            if Species_of_the_bird_NOAEC_CHOICES[iter] == '1':
                noaec.append(float(row_inp[14]))
            elif Species_of_the_bird_NOAEC_CHOICES[iter] == '2':
                noaec.append(float(row_inp[15]))
            elif Species_of_the_bird_NOAEC_CHOICES[iter] == '3':
                noaec.append(float(row_inp[16]))

            logger.info(chemical_name)
            logger.info(b_species)
            logger.info(m_species)
            logger.info(bw_quail)
            logger.info(bw_duck)
            logger.info(bwb_other)
            logger.info(bw_rat)
            logger.info(bwm_other)
            logger.info(sol)
            logger.info(avian_ld50)
            logger.info(mammalian_ld50)
            logger.info(aw_bird)
            logger.info(mineau)
            logger.info(aw_mamm)
            logger.info(noaec_d)
            logger.info(noaec_q)
            logger.info(noaec_o)
            logger.info(noael)
            logger.info(Species_of_the_bird_NOAEC_CHOICES)

            sip_obj = sip_model.sip(True,True,'batch',chemical_name[iter], b_species[iter], m_species[iter], bw_quail[iter],
                            bw_duck[iter], bwb_other[iter], bw_rat[iter], bwm_other[iter], sol[iter], avian_ld50[iter],
                            mammalian_ld50[iter], aw_bird[iter], mineau[iter], aw_mamm[iter], noaec_d[iter], noaec_q[iter], noaec_o[iter], Species_of_the_bird_NOAEC_CHOICES[iter], noael[iter])

            dose_bird_out.append(sip_obj.dose_bird_out)
            dose_mamm_out.append(sip_obj.dose_mamm_out)
            at_bird_out.append(sip_obj.at_bird_out)
            at_mamm_out.append(sip_obj.at_mamm_out)
            det_out.append(sip_obj.det_out)
            act_out.append(sip_obj.act_out)
            acute_bird_out.append(sip_obj.acute_bird_out)
            acuconb_out.append(sip_obj.acuconb_out)
            acute_mamm_out.append(sip_obj.acute_mamm_out)
            acuconm_out.append(sip_obj.acuconm_out)
            chron_bird_out.append(sip_obj.chron_bird_out)
            chronconb_out.append(sip_obj.chronconb_out)
            chron_mamm_out.append(sip_obj.chron_mamm_out)
            chronconm_out.append(sip_obj.chronconm_out)

            jid_all.append(sip_obj.jid)
            sip_all.append(sip_obj)    
            if iter == 0:
                jid_batch.append(sip_obj.jid)

            batch_header = """
                <div class="out_">
                    <br><H3>Batch Calculation of Iteration %s:</H3>
                </div>
                """%(iter + 1)

            out_html_temp = batch_header + sip_tables.table_all(sip_obj)
            out_html_all[iter]=out_html_temp