Tutorial - uiowaSEP2024/002_ImagePro GitHub Wiki
Our application caters to three distinct types of users, each with their own set of functionalities:
Provider users are affiliated with a medical imaging tool provider, such as BrainMask. Their capabilities include:
-
View Analytics: Access comprehensive analytics tailored to their tool.
-
Generate CSV Reports: Create detailed reports based on the collected data.
-
View Linked Studies: Explore all studies associated with their product.
Hospital users are linked to healthcare institutions. Their functionalities include:
- View Linked Studies: Explore all studies associated with their hospital.
Admin users typically serve as developers and possess elevated privileges. Their functionalities include:
-
Generate API Keys: Create and manage API keys associated with providers.
-
View All Studies: Gain visibility into studies conducted across all hospitals and providers.
Regardless of user type, the study page offers versatile search capabilities, enabling users to search by study name, hospital, or provider. Clicking on a study number gives access to detailed study information.
This is a preview of the studies page for an admin user.
An individual study page will display as follows with icons denoting the status of each step:
Quickstart
Job-Monitoring-App site developer documentation is navigable through Docusaurus 2
Docusaurus README: Docusaurus_readme
For more information on the original job-monitoring-app, see the wiki linked at the top.
- Clone the repository at [https://github.com/uiowaSEP2024/002_ImagePro)
-
cdinto the job-monitoring-app/frontend directory - Run
npm installto install all the necessary dependencies - Run
npm run devto start the application in dev mode - Open the http://localhost:3000 url in your browser
-
Create a new terminal and
cdinto job-monitoring-app/backend directory -
Make sure you have Python installed (preferably v3.10), which you can download from here
-
Before starting the application, make sure to create a virtual environment for the project:
python -m venv .venv
-
Next, activate the virtual environment. NB: You will have to do this step every time you start/open a fresh terminal
source .venv/bin/activateIf you are working in PyCharm, steps 2 and 3 should be performed automatically for you. Note the above may be .venv or venv depending on PyCharm
-
Once the virtual environment is started, make sure to install all requirements required for the project:
pip install -r requirements.txt
-
Create a file called .env.local, and then copy and paste the contents from .env.example file into it, replacing with your own values as appropriate. Basic set up only requires you to change POSTGRES_PASSWORD to 'admin1234' in the .env.local file.
-
Next, we start a local database using Docker with the following script in a terminal:
bash run-db.sh
If you get errors in this step, make sure you have installed docker first with
docker -vin your terminal. If not, you can download Docker here. If error 'Docker Daemon not running' is raised, then start the docker desktop application and try again. -
Open up a second terminal and cd into job-monitoring-app/backend. Run steps 8+ in this second terminal. Apply migrations to the database to set it up using the command:
APP_ENV=development alembic upgrade head
[Optional] To seed the db run this command in the terminal:
python tasks.py db:dev:seed
[Optional] To view your db in the terminal run:
psql -U postgres
You can then run postgres specific commands or query the db using SQL commands. For more database specific shortcut commands (i.e. dropping, creating, upgrading, seeding) look at the file tasks.py
-
Finally, to start the application, run the following script:
bash run-dev.sh
-
You can manually run the app by running
uvicorn app.main:app --reloadin your terminal to run the Fast API service. In the case of an error, you may need to runAPP_ENV=development uvicorn app.main:app --reload -
To see users, run
uvicorn app.main:app --reloadin your terminal to run the Fast API service, navigate to http://localhost:8000, and add '/user'
-
For running the app, from the backend directory, do
bash run-dev.sh -
For running tests, from the backend directory, do
bash run-tests.sh
-
Start the job-monitoring-app locally by following the steps above
-
Navigate to http://localhost:3000
-
If you have not created an account before, click Sign Up at the top of the page and follow the steps to create an account, ensuring that you create an account as a Provider. Otherwise, click Log In at the top of the page and log in to your account
-
Click on the 'Generate API Keys' tab at the top of the screen. Fill in the 'note' field and press 'Create Key'
-
Copy the API key given and save it in a secure location
-
Open up job-monitoring-app/trackerapi/demo/mockscript.py
-
On line 17, paste your API key that you have generated as a string into the TRACKER_API_KEY variable. Line 17 should look like this: TRACKER_API_KEY = "paste_your_key_here". After doing this, save the file.
-
Open a new terminal in your project. cd into job-monitoring-app/trackerapi.
-
Run the following command in the terminal
python -m demo.mockscript
-
To view your job on the app, navigate back to http://localhost:3000, click on the Dashboard tab at the top, and click on 'View past and currently active jobs' under the jobs section on your dashboard page.