def enter_water(): db = SLDDB(DB_FILE) for T, dens in WATER_DENSITY: print(f'Water at {T}°C with density {dens}') db.add_material(f'Water', 'H2O', description=f"Water at {T}°C", reference=WATER_DENSITY_REF, ref_website=WATER_DENSITY_LINK, density=dens, temperature=T0 + T, physical_state='liquid', data_origin='textbook')
def enter_amino(): db = SLDDB(DB_FILE) for name, formula, fu_volume in AMINO_DATA: print(f'{name}: {formula} {fu_volume}') db.add_material(name, formula, description=f"Amino acid in protein", reference=f'{AMINO_DENS_REF}|{AMINO_HEX_REF}', ref_website=AMINO_REF_LINK, doi=AMINO_REF_DOI, FU_volume=fu_volume, tags=['biology', 'small organic'], physical_state='solution', data_origin='textbook')
def main(): db = SLDDB(DB_FILE) for item in data: print(item) if len(item) > 3: db.add_material(item[0], item[0], description=item[3], reference="Christy Kinane", density=item[1], mu=item[2]) else: db.add_material(item[0], item[0], reference="Christy Kinane", density=item[1], mu=item[2])
def input_material(args): db = SLDDB(DB_FILE) def get_input_args(field): return fill_input(field, args) if args['name'] == '' or args['formula'] == '': flash("You have to supply a name and Formula!") return render_template('input.html', fields=input_fields, get_input=get_input_args, get_unit=get_unit) useargs = dict(args.items()) name = args['name'] formula = args['formula'] del (useargs['material']) del (useargs['name']) del (useargs['formula']) for key, value in list(useargs.items()): if key == 'created_by' and value != '': # encrypt the users email information value = encryptor.enrypt(value) useargs[key] = value if db_lookup[key][1].html_list: useargs[key] = request.form.getlist(key) if value == '': del (useargs[key]) try: db.add_material(name, formula, **useargs) except Exception as e: flash("Error when trying to insert data:\n" + repr(e)) return render_template('input.html', fields=input_fields, get_input=get_input_args, get_unit=get_unit) return search_db(useargs)
def enter_rnadna(): db = SLDDB(DB_FILE) for name, formula, fu_volume in RNA_ABRV: print(f'{name}: {formula} {fu_volume}') db.add_material(name, formula, description=f"Nucleotides in RNA", reference=AMINO_DENS_REF, ref_website=AMINO_REF_LINK, FU_volume=fu_volume, tags=['biology', 'small organic'], physical_state='solution', data_origin='textbook') for name, formula, fu_volume in DNA_ABRV: print(f'{name}: {formula} {fu_volume}') db.add_material(name, formula, description=f"Nucleotides in DNA", reference=AMINO_DENS_REF, ref_website=AMINO_REF_LINK, FU_volume=fu_volume, tags=['biology', 'small organic'], physical_state='solution', data_origin='textbook')