コード例 #1
0
ファイル: dust_output.py プロジェクト: hongtao510/u_tool
    def post(self):
        form = cgi.FieldStorage() 
        chemical_name = form.getvalue('chemical_name')
        label_epa_reg_no = form.getvalue('label_epa_reg_no')
        ar_lb = form.getvalue('application_rate')
        frac_pest_surface = form.getvalue('frac_pest_assumed_at_surface')
        dislodge_fol_res = form.getvalue('dislodgeable_foliar_residue')
        bird_acute_oral_study = form.getvalue('bird_acute_oral_study')
        bird_study_add_comm = form.getvalue('bird_study_add_comm')
        low_bird_acute_ld50 = form.getvalue('low_bird_acute_oral_ld50')
        test_bird_bw = form.getvalue('tested_bird_body_weight')
        mamm_acute_derm_study = form.getvalue('mamm_acute_derm_study')
        mamm_study_add_comm = form.getvalue('mamm_study_add_comm')
        #aviandermaltype = form.getvalue('aviandermaltype')
        mam_acute_derm_ld50 = form.getvalue('mamm_acute_derm_ld50')
        mam_acute_oral_ld50 = form.getvalue('mam_acute_oral_ld50')
        test_mam_bw = form.getvalue('tested_mamm_body_weight')
        mineau_scaling_factor = float(form.getvalue('mineau_scaling_factor'))
        dust_obj = dust_model.dust(True, False, 'single',chemical_name, label_epa_reg_no, ar_lb, frac_pest_surface, dislodge_fol_res, bird_acute_oral_study, bird_study_add_comm,
              low_bird_acute_ld50, test_bird_bw, mineau_scaling_factor, mamm_acute_derm_study, mamm_study_add_comm, mam_acute_derm_ld50, mam_acute_oral_ld50, test_mam_bw, None)
        #print vars(dust_obj)

        # client = pymongo.MongoClient()
        # # print client

        # db = client.test_database
        # posts = db.posts
        # user_names={"user":"******"}
        # dust_save = dict(dust_obj.__dict__,**user_names)
        # posts.insert(dust_save)
        # print db
        # print posts
        # print posts.find_one({"user":"******"})

        # for post in posts.find({"user":"******"}):
        #     print post
            
        templatepath = os.path.dirname(__file__) + '/../templates/'
        ChkCookie = self.request.cookies.get("ubercookie")
        html = uber_lib.SkinChk(ChkCookie, "DUST Output")
        html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'dust','page':'output'})
        html = html + template.render (templatepath + '03ubertext_links_left.html', {})                                
        html = html + template.render(templatepath + '04uberoutput_start.html', {
                'model':'dust', 
                'model_attributes':'DUST Output'})
        html = html + dust_tables.timestamp(dust_obj)
        html = html + dust_tables.table_all(dust_obj)[0]
        html = html + template.render(templatepath + 'export.html', {})
        html = html + template.render(templatepath + '04uberoutput_end.html', {})
        html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
        rest_funcs.save_dic(html, dust_obj.__dict__, "dust", "single")
        self.response.out.write(html)
コード例 #2
0
    def post(self):
        form = cgi.FieldStorage() 
        chemical_name = form.getvalue('chemical_name')
        label_epa_reg_no = form.getvalue('label_epa_reg_no')
        ar_lb = form.getvalue('application_rate')
        frac_pest_surface = form.getvalue('frac_pest_assumed_at_surface')
        dislodge_fol_res = form.getvalue('dislodgeable_foliar_residue')
        bird_acute_oral_study = form.getvalue('bird_acute_oral_study')
        bird_study_add_comm = form.getvalue('bird_study_add_comm')
        low_bird_acute_ld50 = form.getvalue('low_bird_acute_oral_ld50')
        test_bird_bw = form.getvalue('tested_bird_body_weight')
        mamm_acute_derm_study = form.getvalue('mamm_acute_derm_study')
        mamm_study_add_comm = form.getvalue('mamm_study_add_comm')
        mam_acute_derm_ld50 = form.getvalue('mamm_acute_derm_ld50')
        test_mam_bw = form.getvalue('tested_mamm_body_weight')
        mineau = form.getvalue('mineau')
        dust_obj = dust_model.dust(chemical_name, label_epa_reg_no, ar_lb, frac_pest_surface, dislodge_fol_res, bird_acute_oral_study, bird_study_add_comm,
              low_bird_acute_ld50, test_bird_bw, mineau, mamm_acute_derm_study, mamm_study_add_comm, mam_acute_derm_ld50, test_mam_bw)
        
        # client = pymongo.MongoClient()
        # # print client

        # db = client.test_database
        # posts = db.posts
        # user_names={"user":"******"}
        # dust_save = dict(dust_obj.__dict__,**user_names)
        # posts.insert(dust_save)
        # print db
        # print posts
        # print posts.find_one({"user":"******"})

        # for post in posts.find({"user":"******"}):
        #     print post
            
        templatepath = os.path.dirname(__file__) + '/../templates/'
        html = template.render(templatepath + '01uberheader.html', {'title':'Ubertool'})
        html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'dust','page':'output'})
        html = html + template.render (templatepath + '03ubertext_links_left.html', {})                                
        html = html + template.render(templatepath + '04uberoutput_start.html', {
                'model':'dust', 
                'model_attributes':'DUST Output'})   



        html = html + dust_tables.table_all(dust_obj)[0]

        html = html + template.render(templatepath + 'export.html', {})
        html = html + template.render(templatepath + '04uberoutput_end.html', {})
        html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
        self.response.out.write(html)
コード例 #3
0
ファイル: dust_batchoutput.py プロジェクト: hongtao510/u_tool
def html_table(row, iter):
    chemical_name.append(str(row[0]))
    label_epa_reg_no.append(str(row[1]))
    ar_lb.append(float(row[2]))
    frac_pest_surface.append(float(row[3]))
    dislodge_fol_res.append(float(row[4]))
    bird_acute_oral_study.append(str(row[5]))
    bird_study_add_comm.append(str(row[6]))
    low_bird_acute_ld50.append(float(row[7]))
    test_bird_bw.append(float(row[8]))
    mineau_scaling_factor.append(float(row[9]))
    mamm_acute_derm_study.append(str(row[10]))
    mamm_study_add_comm.append(str(row[11]))
    mam_acute_derm_ld50.append(float(row[12]))
    mam_acute_oral_ld50.append(float(row[13]))
    test_mam_bw.append(float(row[14]))

    Input_header = """<div class="out_">
                        <br><H3>Batch Calculation of Iteration %s</H3>
                    </div>""" % (
        iter
    )

    dust_obj_temp = dust_model.dust(
        True,
        True,
        "qaqc",
        chemical_name[iter - 1],
        label_epa_reg_no[iter - 1],
        ar_lb[iter - 1],
        frac_pest_surface[iter - 1],
        dislodge_fol_res[iter - 1],
        bird_acute_oral_study[iter - 1],
        bird_study_add_comm[iter - 1],
        low_bird_acute_ld50[iter - 1],
        test_bird_bw[iter - 1],
        mineau_scaling_factor[iter - 1],
        mamm_acute_derm_study[iter - 1],
        mamm_study_add_comm[iter - 1],
        mam_acute_derm_ld50[iter - 1],
        mam_acute_oral_ld50[iter - 1],
        test_mam_bw[iter - 1],
    )

    ar_mg_out.append(dust_obj_temp.ar_mg)
    bird_reptile_dermal_ld50_out.append(dust_obj_temp.bird_reptile_dermal_ld50)
    gran_bird_ex_derm_dose_out.append(dust_obj_temp.gran_bird_ex_derm_dose)
    gran_repamp_ex_derm_dose_out.append(dust_obj_temp.gran_repamp_ex_derm_dose)
    gran_mam_ex_derm_dose_out.append(dust_obj_temp.gran_mam_ex_derm_dose)
    fol_bird_ex_derm_dose_out.append(dust_obj_temp.fol_bird_ex_derm_dose)
    fol_repamp_ex_derm_dose_out.append(dust_obj_temp.fol_repamp_ex_derm_dose)
    fol_mam_ex_derm_dose_out.append(dust_obj_temp.fol_mam_ex_derm_dose)
    bgs_bird_ex_derm_dose_out.append(dust_obj_temp.bgs_bird_ex_derm_dose)
    bgs_repamp_ex_derm_dose_out.append(dust_obj_temp.bgs_repamp_ex_derm_dose)
    bgs_mam_ex_derm_dose_out.append(dust_obj_temp.bgs_mam_ex_derm_dose)
    amp_derm_ld50_out.append(dust_obj_temp.amp_derm_ld50)
    birdrep_derm_ld50_out.append(dust_obj_temp.birdrep_derm_ld50)
    mam_derm_ld50_out.append(dust_obj_temp.mam_derm_ld50)
    ratio_gran_bird_out.append(dust_obj_temp.ratio_gran_bird)
    LOC_gran_bird_out.append(dust_obj_temp.LOC_gran_bird)
    ratio_gran_rep_out.append(dust_obj_temp.ratio_gran_rep)
    LOC_gran_rep_out.append(dust_obj_temp.LOC_gran_rep)
    ratio_gran_amp_out.append(dust_obj_temp.ratio_gran_amp)
    LOC_gran_amp_out.append(dust_obj_temp.LOC_gran_amp)
    ratio_gran_mam_out.append(dust_obj_temp.ratio_gran_mam)
    LOC_gran_mam_out.append(dust_obj_temp.LOC_gran_mam)
    ratio_fol_bird_out.append(dust_obj_temp.ratio_fol_bird)
    LOC_fol_bird_out.append(dust_obj_temp.LOC_fol_bird)
    ratio_fol_rep_out.append(dust_obj_temp.ratio_fol_rep)
    LOC_fol_rep_out.append(dust_obj_temp.LOC_fol_rep)
    ratio_fol_amp_out.append(dust_obj_temp.ratio_fol_amp)
    LOC_fol_amp_out.append(dust_obj_temp.LOC_fol_amp)
    ratio_fol_mam_out.append(dust_obj_temp.ratio_fol_mam)
    LOC_fol_mam_out.append(dust_obj_temp.LOC_fol_mam)
    ratio_bgs_bird_out.append(dust_obj_temp.ratio_bgs_bird)
    LOC_bgs_bird_out.append(dust_obj_temp.LOC_bgs_bird)
    ratio_bgs_rep_out.append(dust_obj_temp.ratio_bgs_rep)
    LOC_bgs_rep_out.append(dust_obj_temp.LOC_bgs_rep)
    ratio_bgs_amp_out.append(dust_obj_temp.ratio_bgs_amp)
    LOC_bgs_amp_out.append(dust_obj_temp.LOC_bgs_amp)
    ratio_bgs_mam_out.append(dust_obj_temp.ratio_bgs_mam)
    LOC_bgs_mam_out.append(dust_obj_temp.LOC_bgs_mam)

    jid_all.append(dust_obj_temp.jid)
    dust_obj_all.append(dust_obj_temp)
    if iter == 1:
        jid_batch.append(dust_obj_temp.jid)

    table_all_out = dust_tables.table_all(dust_obj_temp)
    # html = html + dust_tables.table_all(dust_obj)[0]

    html_table_temp = Input_header + table_all_out[0] + "<br>"
    return html_table_temp
コード例 #4
0
def html_table(row_inp,iter):
    chemical_name_temp=row_inp[0]
    chemical_name.append(chemical_name_temp)
    label_epa_reg_no_temp=row_inp[1]
    label_epa_reg_no.append(label_epa_reg_no_temp)  
    ar_lb_temp=float(row_inp[3])
    ar_lb.append(ar_lb_temp)
    frac_pest_surface_temp=float(row_inp[4])
    frac_pest_surface.append(frac_pest_surface_temp)
    dislodge_fol_res_temp=float(row_inp[5])
    dislodge_fol_res.append(dislodge_fol_res_temp)
    bird_acute_oral_study_temp=row_inp[6]
    bird_acute_oral_study.append(bird_acute_oral_study_temp)
    bird_study_add_comm_temp=row_inp[7]
    bird_study_add_comm.append(bird_study_add_comm_temp)
    low_bird_acute_ld50_temp=float(row_inp[8])   
    low_bird_acute_ld50.append(low_bird_acute_ld50_temp)
    test_bird_bw_temp=float(row_inp[9])   
    test_bird_bw.append(test_bird_bw_temp)
    mineau_temp=float(row_inp[10])   
    mineau.append(mineau_temp)
    mamm_acute_derm_study_temp=row_inp[11]
    mamm_acute_derm_study.append(mamm_acute_derm_study_temp)
    mamm_study_add_comm_temp=row_inp[12]
    mamm_study_add_comm.append(mamm_study_add_comm_temp)
    mam_acute_derm_ld50_temp=float(row_inp[13])   
    mam_acute_derm_ld50.append(mam_acute_derm_ld50_temp)
    test_mam_bw_temp=float(row_inp[14])   
    test_mam_bw.append(test_mam_bw_temp)

    Input_header="""<table border="1">
                        <tr><H3>Batch Calculation of Iteration %s</H3></tr><br>
                    </table>"""%(iter)

    dust_obj_temp = dust_model.dust(chemical_name_temp, label_epa_reg_no_temp, ar_lb_temp, frac_pest_surface_temp, dislodge_fol_res_temp, 
                               bird_acute_oral_study_temp, bird_study_add_comm_temp, low_bird_acute_ld50_temp, test_bird_bw_temp, 
                               mineau_temp, mamm_acute_derm_study_temp, mamm_study_add_comm_temp, mam_acute_derm_ld50_temp, test_mam_bw_temp)


    table_all_out = dust_tables.table_all(dust_obj_temp)
        # html = html + dust_tables.table_all(dust_obj)[0]

    html_table_temp = Input_header + table_all_out[0]

######table 3#######
    granbirdderm_out_temp=table_all_out[1]['granbirdderm']
    granbirdderm_out.append(granbirdderm_out_temp)
    granherpderm_out_temp=table_all_out[1]['granherpderm']
    granherpderm_out.append(granherpderm_out_temp)
    granmammderm_out_temp=table_all_out[1]['granmammderm']
    granmammderm_out.append(granmammderm_out_temp)

######table 4#######
    folbirdderm_out_temp=table_all_out[2]['folbirdderm']
    folbirdderm_out.append(folbirdderm_out_temp)
    folherpderm_out_temp=table_all_out[2]['folherpderm']
    folherpderm_out.append(folherpderm_out_temp)
    folmammderm_out_temp=table_all_out[2]['folmammderm']
    folmammderm_out.append(folmammderm_out_temp)

######table 5#######
    barebirdderm_out_temp=table_all_out[3]['barebirdderm']
    barebirdderm_out.append(barebirdderm_out_temp)
    bareherpderm_out_temp=table_all_out[3]['bareherpderm']
    bareherpderm_out.append(bareherpderm_out_temp)
    baremammderm_out_temp=table_all_out[3]['baremammderm']
    baremammderm_out.append(baremammderm_out_temp)

######table 6#######
    granbirdrisk_out_temp=table_all_out[4]['granbirdrisk']
    granbirdrisk_out.append(granbirdrisk_out_temp)
    granreprisk_out_temp=table_all_out[4]['granreprisk']
    granreprisk_out.append(granreprisk_out_temp)
    granamphibrisk_out_temp=table_all_out[4]['granamphibrisk']
    granamphibrisk_out.append(granamphibrisk_out_temp)
    granmammrisk_out_temp=table_all_out[4]['granmammrisk']
    granmammrisk_out.append(granmammrisk_out_temp)

######table 7#######
    folbirdrisk_out_temp=table_all_out[5]['folbirdrisk']
    folbirdrisk_out.append(folbirdrisk_out_temp)
    folreprisk_out_temp=table_all_out[5]['folreprisk']
    folreprisk_out.append(folreprisk_out_temp)
    folamphibrisk_out_temp=table_all_out[5]['folamphibrisk']
    folamphibrisk_out.append(folamphibrisk_out_temp)
    folmammrisk_out_temp=table_all_out[5]['folmammrisk']
    folmammrisk_out.append(folmammrisk_out_temp)

######table 8#######
    barebirdrisk_out_temp=table_all_out[6]['barebirdrisk']
    barebirdrisk_out.append(barebirdrisk_out_temp)
    barereprisk_out_temp=table_all_out[6]['barereprisk']
    barereprisk_out.append(barereprisk_out_temp)
    bareamphibrisk_out_temp=table_all_out[6]['bareamphibrisk']
    bareamphibrisk_out.append(bareamphibrisk_out_temp)
    baremammrisk_out_temp=table_all_out[6]['baremammrisk']
    baremammrisk_out.append(baremammrisk_out_temp)

    return html_table_temp