From 0735b1db7432ed3d3e4cc98e0de177d7d2a55ce7 Mon Sep 17 00:00:00 2001 From: Juni Kim Date: Sat, 11 Mar 2023 18:59:16 -0500 Subject: [PATCH] extended documentation on validate.py --- validate.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/validate.py b/validate.py index ea713c0..d7fe253 100755 --- a/validate.py +++ b/validate.py @@ -1,20 +1,31 @@ import csv from datetime import date +""" +Required fields when inserting into the database. +""" + _required_fields = [ + # the "str" type means that this field can be any valid string. ("name", "str"), ("formula", "str"), + # any field labeled a "float" needs to have a value in decimal notation. ("mass", "float"), ("final_mz", "float"), ("final_rt", "float"), ] + +""" +Optional fields and corresponding types when batch inserting into the database. +""" + _optional_fields = [ ("chemical_db_id", "str"), ("library", "str"), - ("pubchem_cid", "int"), + ("pubchem_cid", "int"), # Only integers are permitted. ("pubmed_refcount", "int"), ("standard_class", "str"), ("inchikey", "str"), @@ -24,10 +35,14 @@ _optional_fields = [ ("adduct", "str"), ("detected_adducts", "str"), ("adduct_calc_mz", "str"), - ("msms_detected", "yesno"), + ("msms_detected", "yesno"), # Value can either be "Yes" or "No" ("msms_purity", "float"), ] +""" +All fields (excluding those that are commented) are mandatory to include. +""" + _query_fields = [ ("rt_min", "float"), ("rt_max", "float"),