The locutus_utilities
repository includes scripts and tools that facilitate the development and maintenance of Locutus. These utilities may include automation tools, and other resources that support the application's lifecycle.
- Google Cloud SDK: Installed and authenticated to use Google Cloud services.
- Firestore enabled in your Google Cloud project.
- Install setuptools
- If running the 'update_ontology_api' option, You'll need a UMLS api key. If you don't already have one, log in and request an API key from UMLS. When you have this you can create a environment variable with the code below.
export UMLS_API_KEY=your_actual_umls_api_key
-
Create and activate a virtual environment (recommended):
[Click here] for more on virtual environments.# Step 1: cd into the directory to store the venv # Step 2: run this code. It will create the virtual env named utils_venv in the current directory. python3 -m venv utils_venv # Step 3: run this code. It will activate the utils_venv environment source utils_venv/bin/activate # On Windows: venv\Scripts\activate # You are ready for installations! # If you want to deactivate the venv run: deactivate
-
Install the package and dependencies:
pip install git+https://github.com/NIH-NCPI/locutus_utilities.git
-
Run a command/action
utils_run -p <project_id> -o <option> -a <action>
-
-p, --project
- Description: GCP Project to edit.
- Required: Yes
-
-o, --option
- Description: Choose the operation to perform.
- Choices:
update_ontology_api
: Updates the ontology API in Firestore.update_seed_data
: Updates seed data in Firestore.delete_project_data
: Deletes all data from the Firestore database.reset_database
: Deletes all data, then reseeds the Firestore database.
- Required: Yes
-
-a, --action
- Description: Specify the action to take. Only used when running
update_ontology_api
, orreset_database
- Choices:
upload_from_csv
: Upload data from an existing CSV file to Firestore.update_csv
: Fetch data from APIs and update the CSV file only.fetch_and_upload
: Fetch data from APIs and upload it to Firestore.
- Default:
upload_from_csv
- Required: No
- Description: Specify the action to take. Only used when running
-
-u, --which_ontologies
- Description: Choose to include all ontologies or only a selection. Only used when running
update_ontology_api
, orreset_database
- Choices:
curated_ontologies_only
: Use the selected default ontologies.all_ontologies
: Use all ontologies.
- Default:
all_ontologies
- Description: Choose to include all ontologies or only a selection. Only used when running
If working on a new feature it is possible to install a package version within
the remote or local branch
```
# remote
pip install git+https://github.com/NIH-NCPI/locutus_utilities.git@{branch_name}
# If using the command above, you may need to force a reinstallation to ensure the latest version.
pip install --force-reinstall --no-cache-dir git+https://github.com/NIH-NCPI/locutus_utilities.git
# local - if working on the package the installation will automatically update
pip install -e .
```