Excipients: Difference between revisions

From DISI
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
Excipient Deployment:
[[Excipient Server Restart:]]


1. Go to the dev version of Excipients and set the version number set in the __init__.py file
  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 10.20.0.31:8093 excipients:app --workers 5 --timeout 1000


2. Create the distribution file
[[Excipient Installment:]]
  python setup.py sdist


3.  
  1. Go to the dev version of Excipients and set the version number set in the __init__.py file
   ssh <super_user>@gimel
  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
  8.
    gunicorn --access-logfile excipients.ucsf.bkslab.org.acc --max-requests 1000 --bind 10.20.0.31:8093 excipients:app --workers 5 --timeout 1000)


4.
----
  sudo -i


5.
[[HowTos for the new version of Excipients]]
  su - www


4. activate the production server ->
1. Create a copy of existing production database
  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/
2. In the flask code, change the database url to the newly created db


7. Run ->
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)
  pip install dist/CERSI-Excipients-X.Y.Z.tar.gz
    python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db upgrade
    python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db migrate


8. find the excipients screen ->  
4. Load the openfda regulatory_status data (populates 'Status' table in db, last updated April/2017):
  screen -ls
    ->  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


9. switch to excipients screen ->  
6. Load the dye relation data. (creates the relation for excipients to functions which are dye):
  screen -dR excip
    -> 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


10. CTRL-C to kill
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


11. <UP> <ENTER> to rerun
8. Load the openfda drug label. (populate brand and substance tables and their relations to existing excipients):
  (this will start the gunicorn server:  
      -> https://open.fda.gov/downloads/ (6 json files to download)
    gunicorn --access-logfile excipients.ucsf.bkslab.org.acc --max-requests 1000 --bind 10.20.0.31:8093 excipients:app --workers 5 --timeout 1000)
      -> 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.

Latest revision as of 18:47, 24 July 2017

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 10.20.0.31:8093 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
 8.
    gunicorn --access-logfile excipients.ucsf.bkslab.org.acc --max-requests 1000 --bind 10.20.0.31:8093 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.