Browse Source

data source 2 is actually incomplete

master
junikimm717 1 year ago
parent
commit
9ae3c349de
  1. BIN
      csv/2.csv
  2. 33
      data2.py
  3. 5
      enter_data.py
  4. BIN
      xlsx/Example2.xlsx

BIN
csv/2.csv (Stored with Git LFS)

size 38956

33
data2.py

@ -1,33 +0,0 @@
#!/usr/bin/env python3
from pandas import read_csv
from pprint import pprint
df = read_csv("./csv/2.csv")
pprint(list(enumerate(df.columns)))
cols = [
('chemical_db_id', 1),
('library', 2),
('name', 4),
('formula', 6),
('mass', 7),
('pubchem_cid', 10),
('pubmed_refcount', 8),
('standard_class', 11),
('inchikey', 13),
('inchikey14', 14),
('final_mz', 17),
('final_rt', 18),
('final_adduct', 19),
('adduct', 20),
('detected_adducts', 22),
('adduct_calc_mz', 23),
('msms_detected', 26),
('msms_purity', 28)
]
data = [{x[0]: row[x[1]] for x in cols} for row in df.to_dict('tight')['data']]
for x in data:
if x['msms_detected'] == 'No':
del x['msms_detected']

5
enter_data.py

@ -2,7 +2,6 @@
import requests
import sys
import data2
import data1
baseurl = "http://127.0.0.1:5000"
@ -13,8 +12,8 @@ with session.post(baseurl + "/admin/login", {'username': 'admin', 'password': 'a
print("Auth Failed")
sys.exit(1)
for x in data1.data + data2.data:
print(f"POSTing for {x}...")
for x in data1.data:
print(f"POSTing {baseurl + '/chemical/create'} for {x}...")
req = session.post(baseurl + "/chemical/create", x)
if req.status_code != 200:
print(f"Request Failed for {x}")

BIN
xlsx/Example2.xlsx (Stored with Git LFS)

size 29000
Loading…
Cancel
Save