Revision as of 18:47, 24 July 2017 by Enkhjargal (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Excipient Server Restart:

 1. ssh gimel
 2. become www
 3. activate the production server ->
    cd /nfs/soft/www/apps/excipients/envs/production/
    source bin/activate
 4. gunicorn --access-logfile excipients.ucsf.bkslab.org.acc --max-requests 1000 --bind excipients:app --workers 5 --timeout 1000

Excipient Installment:

 1. Go to the dev version of Excipients and set the version number set in the __init__.py file
 2. Create the distribution file
    python setup.py sdist
 3. ssh gimel
 4. su - www
 5. activate the production server ->
    cd /nfs/soft/www/apps/excipients/envs/production/
    source bin/activate
 6. copy over the created dist folder in /nfs/soft/www/apps/excipients/envs/production/ 
 7. Run -> 
    pip install dist/CERSI-Excipients-X.Y.Z.tar.gz
    gunicorn --access-logfile excipients.ucsf.bkslab.org.acc --max-requests 1000 --bind excipients:app --workers 5 --timeout 1000)

HowTos for the new version of Excipients

1. Create a copy of existing production database
2. In the flask code, change the database url to the newly created db 
3. Run db update + db migrate to create new tables and new columns for existing tables. (automatically done by flask db-migrate, mapping the model objects to postgres db) 
   python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db upgrade
   python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db migrate
4. Load the openfda regulatory_status data (populates 'Status' table in db, last updated April/2017): 
   ->  create a file named regulatory_status.csv
       touch regulatory_status.csv
   -> copy over the regulatory_status definitions from 
   python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py parse_status_definition /home/enkhjargal/PycharmProjects/Excipients/data/regulatory_status.csv

5. Load the openfda excipients function data (populates 'Function' table in db, last updated April/2017):
   python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py parse_function_definition /home/enkhjargal/PycharmProjects/Excipients/data/function_definition.csv
6. Load the dye relation data. (creates the relation for excipients to functions which are dye):
   -> https://www.fda.gov/ForIndustry/ColorAdditives/ColorAdditiveInventories/ucm106626.htm)
   -> python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py load_color_additives_relationship /home/enkhjargal/PycharmProjects/Excipients/data/FDA_color_additives_all
7. Load the fda general additives data.(creates all other function and status relations to excipients):  
   -> create a file named FDA_additives
      touch FDA_additives
   -> copy over the additive list from this page (https://www.fda.gov/Food/IngredientsPackagingLabeling/FoodAdditivesIngredients/ucm091048.htm)
   -> parse the file to load it to db table
      python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py load_function_and_status_relationship /home/enkhjargal/PycharmProjects/Excipients/data/FDA_additives
8. Load the openfda drug label. (populate brand and substance tables and their relations to existing excipients):
     -> https://open.fda.gov/downloads/ (6 json files to download)
     -> parse each of them:
        python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py parse_fda_label_data /home/enkhjargal/PycharmProjects/Excipients/data/drug-label-0005-of-0006.json

9. Pull Zincids for populated Substance data. (populate the zincid and smiles column in substance table)
     -> python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py parse_fda_label_data
DB should be now fully populated.