Excipient server restart: Difference between revisions
Jump to navigation
Jump to search
Enkhjargal (talk | contribs) No edit summary |
m (asdf) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 26: | Line 26: | ||
---- | ---- | ||
[[HowTos for the | [[HowTos for the new version of Excipients]] | ||
1. Create a copy of existing production database | 1. Create a copy of existing production database | ||
2. In the flask code, change the database url to the newly created db | 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) | 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 upgrade | ||
python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db migrate | python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py manage-db migrate | ||
4. Load the openfda regulatory_status data ( | |||
4. Load the openfda regulatory_status data (populates 'Status' table in db, last updated April/2017): | |||
-> create a file named regulatory_status.csv | -> create a file named regulatory_status.csv | ||
touch regulatory_status.csv | touch regulatory_status.csv | ||
-> copy over the regulatory_status definitions from | -> 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 | 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 ( | |||
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 | 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: | |||
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) | -> 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 | -> 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 | |||
7. Load the fda general additives data.(creates all other function and status relations to excipients): | |||
-> create a file named FDA_additives | -> create a file named FDA_additives | ||
touch FDA_additives | touch FDA_additives | ||
Line 49: | Line 55: | ||
-> parse the file to load it to db table | -> 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 | 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: | |||
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) | -> https://open.fda.gov/downloads/ (6 json files to download) | ||
-> parse each of them: | -> 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 | python /home/enkhjargal/PycharmProjects/Excipients/manage-excipients.py parse_fda_label_data /home/enkhjargal/PycharmProjects/Excipients/data/drug-label-0005-of-0006.json | ||
9. | |||
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
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
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.