Excipient server restart: Difference between revisions

From DISI
Jump to navigation Jump to search
No edit summary
m (asdf)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Excipient Deployment:
[[Excipient Server Restart:]]


1. activate the production server ->
  1. ssh gimel
  cd /nfs/soft/www/apps/excipients/envs/production/
  2. become www
  source bin/activate
  3. activate the production server ->
2. Go to the dev version of Excipients and the version number set in the __init__.py file
    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


3. Run ->
[[Excipient Installment:]]
  python setup.py sdist


4. copy over the created dist folder in /nfs/soft/www/apps/excipients/envs/production/  
  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)


5. Run ->
----
  pip install dist/CERSI-Excipients-X.Y.Z.tar.gz


6. ssh to n-1-110 n-1-from gimel ->
[[HowTos for the new version of Excipients]]
  ssh superuser@n-1-110


7. get root ->
1. Create a copy of existing production database
  sudo -i


8. find the excipients screen ->
2. In the flask code, change the database url to the newly created db
  screen -ls


9. switch to excipients screen ->
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)
  screen -dR excipient
    python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db upgrade
    python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db migrate


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


11. <UP> <ENTER> to rerun
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.
 
 
[[Category:Excipients]]

Latest revision as of 21:48, 17 May 2024

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.