Authentication-Related
        Only Admins are capable of creating new admins.
        
        
            
        
        
            
        
        
API Routes
/chemical/all- returns all chemicals in the database as JSON/chemical/search- returns JSON for search queries. This endpoint takes GET parameters as follows:- mz_min: Minimum M/Z Ratio
 - mz_max: Maximum M/Z Ratio
 - rt_min: Minimum Retention Time
 - rt_max: Maximum Retention Time
 
/chemical/<chemical id>/{view,update,delete}- CRUD endpoints for chemicals.
Programmatically adding Chemicals
            You need admin credentials to access the /chemical/create endpoint, so using an HTTP library
            like python's requests library is highly recommended for keeping track of session cookies.
        
import requests
session = requests.session()
baseurl = "chemicaldb.teidkim.me"
session.post(baseurl + "/admin/login", {"username": (username), "password": (password)})
fields = {
    "chemical_db_id": <db id from another database>,
    "library": (library, is a string),
    "person_name": (name of person who uploaded, string)
    # name, formula, and mass are required fields!
    "metabolite_name": (name of the chemical, is a string),
    "formula": (molecular formula, is a string),
    "mass": (monoisotopic mass, is a float),
    "pubchem_cid": <string>,
    "pubmed_refcount": <integer>
    "standard_class": <string>
    "inchikey": <string>,
    "inchikey14": <string>,
    # final_mz and final_rt are required fields!
    "final_mz": (m/z ratio after experiment, is a float),
    "final_rt": (retention time after experiment, is a float),
    "final_adduct": <string>,
    "final_adduct": <string>,
    "detected_adducts": <string>,
    "adduct_calc_mz": <string>,
    "msms_detected": <string if yes, do not include this field otherwise>
    "msms_purity": <float>
    "date": "YYYY-MM-DD"
}
session.post(baseurl + "/chemical/create", fields)
        
    Programmatically Searching For Matching Compounds
import requests
baseurl = "chemicaldb.teidkim.me"
# initialize parameters
def generate_parameters(mz, mz_range_ppm, rt, rt_range):
    return dict(
      mz_min=(mz - mz_range_ppm/10**6),
      mz_max=(mz + mz_range_ppm/10**6),
      rt_min=(rt - rt_range),
      rt_max=(rt + rt_range)
    )
mz = < theoretical mz ratio >
mz_range_ppm = <threshold the mz value should be in ppm units>
rt = < theoretical retention time >
rt_range = < seconds in which the rt needs to be in >
# make a request to the endpoint.
response = requests.get(baseurl + "/chemical/search", params=generate_parameters(mz, mz_range_ppm, rt, rt_range))
# make sure to include some error handling code.
results = response.json()
# results is a json containing a list of chemicals with the same schema as above.
# There are up to 10 search results per query, so you should write some code to
# determine which result is best.