Web, python, and command-line interfaces for managing a chemical inventory. COMMANDS The web interface (chem_web.py) is a web-daemon using web.py and it's build in htmlserver. Standard command for starting the daemon $ chem_web.py -a 192.168.1.2:55555 Standard command for stopping the daemon $ chem_web.py --stop From the command line, you can validate CAS#s (and possibly other fields) with $ python chem_db.py -f current/inventory.db -V DATABASE FORMAT text_db.py provides the python interface to this format. The basic idea was to produce and use files which were M$-Excel-compatible, since future users might not want to maintain this interface. A brief example inventory.db file is included in the examples directory. Tab-delimited ('\t') fields Endline-delimited ('\n') records The first line is the header (starts with a pound sign '#'). The header should be a tab-delimited list of short field names. If the second line also begins with a pound sign, it contains a tab-delimiteded list of long field names. Blank lines are ignored. The fields H, F, R, and S are the NFPA Health, Fire, Reactivity, and Special Hazards (NFPA diamond). Blue: Health Hazard 0 Hazard no greater than ordinary material 1 May cause irritation; minimal residual injury 2 Intense or prolonged exposure may cause incapacitation; Residual injury may occur if not treated 3 Exposure could cause serious injury even if treated 4 Exposure may cause death Red: Fire Hazard 0 Will not burn 1 Must be preheated for ignition; flashpoint above 200°F (93°C) 2 Must be moderately heated for ignition, flashpoint above 100°F (38°C) 3 Ignition may occur under most ambient conditions, Flashpoint below 100°F (38°C) 4 Extremely flammable and will readily disperse through air under standard conditions, flashpoint below 73°F (23°C) Reactivity hazards: 0 Stable 1 May become unstable at elevated temperatures and pressures. May be mildly water reactive 2 Unstable; may undergo violent decomposition, but will not detonate. May form explosive mixtures with water 3 Detonates with strong ignition source 4 Readily detonates Special Hazards have the following codes: OX strong oxidizer -W- water reactive SA simple ascphyxiants (The only gases for which this symbol is permitted are nitrogen, helium, neon, argon, krypton, and xenon..) Non-official Special Hazard codes: ACID acid ALK base COR corrosive BIO Biohazard POI Poison CRY Cyrogenic CONTENTS README this file text_db.py python interface to the above db format chem_db.py chem-inventory specific functionality such as * CAS # validation, * a Material Saftey Data Sheet (MSDS) manager, * document-generation drivers, and * a simple command line interface. current store the current database file. backup store previous (timestamped) database files. You may want to clean this out occasionally. MSDS store Material Saftey Data Sheets by database index number docs latex (and metapost) sources for document generation. chem_web.py daemonized web bindings to chem_web.py ssl Secure Socket Layer (SSL) key and certificate generation tests. GENERATED FILES AND DIRECTORIES templates quasi-HTML templates for pages generated chem_web.py chem_web.pid store the Process ID (PID) for a daemonized chem_web.py process chem_web.log log chem_web activity (maintained between runs, so remove periodically) TODO Security: I can create my own self-signed certificate. Protects against eavesdropping, but not man-in-the-middle attacks. Solution for now: hide from external world, trust everyone inside, backup before any change. Print columns in a particular order from the database with $ awk -F ' ' '{print $1, "\t", $9, "\t", , "\t", $2}' current/inventory.db | less