Tutorial - uiowaSEP2024/002_ImagePro GitHub Wiki

User Functionality

Our application caters to three distinct types of users, each with their own set of functionalities:

Provider User

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.

    Analytics
  • Generate CSV Reports: Create detailed reports based on the collected data.

    Reporting
  • View Linked Studies: Explore all studies associated with their product.

Hospital User

Hospital users are linked to healthcare institutions. Their functionalities include:

  • View Linked Studies: Explore all studies associated with their hospital.

Admin User

Admin users typically serve as developers and possess elevated privileges. Their functionalities include:

  • Generate API Keys: Create and manage API keys associated with providers.

    API keys
  • View All Studies: Gain visibility into studies conducted across all hospitals and providers.

Study Page (For All Users)

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.

Study Page Preview

An individual study page will display as follows with icons denoting the status of each step:

Ind Study Page Preview

Developer

Quickstart

Job-Monitoring-App Documentation

Original Job-Monitoring-App Wiki

wiki

Backend README

backend_readme

Frontend README

frontend_readme

API README

trackerapi_readme

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.

Running Job-Monitoring-App locally

  1. Clone the repository at [https://github.com/uiowaSEP2024/002_ImagePro)
  2. cd into the job-monitoring-app/frontend directory
  3. Run npm install to install all the necessary dependencies
  4. Run npm run dev to start the application in dev mode
  5. Open the http://localhost:3000 url in your browser

Running App Backend Locally

  1. Create a new terminal and cd into job-monitoring-app/backend directory

  2. Make sure you have Python installed (preferably v3.10), which you can download from here

  3. Before starting the application, make sure to create a virtual environment for the project:

    python -m venv .venv 
  4. Next, activate the virtual environment. NB: You will have to do this step every time you start/open a fresh terminal

    source .venv/bin/activate

    If 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

  5. Once the virtual environment is started, make sure to install all requirements required for the project:

    pip install -r requirements.txt
  6. 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.

  7. 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 -v in 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.

  8. 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

  9. Finally, to start the application, run the following script:

    bash run-dev.sh
  10. You can manually run the app by running uvicorn app.main:app --reload in your terminal to run the Fast API service. In the case of an error, you may need to run APP_ENV=development uvicorn app.main:app --reload

  11. To see users, run uvicorn app.main:app --reload in your terminal to run the Fast API service, navigate to http://localhost:8000, and add '/user'

Bash Scripts

  1. For running the app, from the backend directory, do bash run-dev.sh

  2. For running tests, from the backend directory, do bash run-tests.sh

Running mockscript.py in job-monitoring-app to create an example job

  1. Start the job-monitoring-app locally by following the steps above

  2. Navigate to http://localhost:3000

  3. 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

  4. Click on the 'Generate API Keys' tab at the top of the screen. Fill in the 'note' field and press 'Create Key'

  5. Copy the API key given and save it in a secure location

  6. Open up job-monitoring-app/trackerapi/demo/mockscript.py

  7. 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.

  8. Open a new terminal in your project. cd into job-monitoring-app/trackerapi.

  9. Run the following command in the terminal

    python -m demo.mockscript
  10. 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.

⚠️ **GitHub.com Fallback** ⚠️