uiowaSEP2024 / 002_ImagePro

Image processing backend
1 stars 0 forks source link

152 create admin dashboard #166

Closed powersaudrey25 closed 4 months ago

powersaudrey25 commented 4 months ago

Overview

This PR updates the Studies page. It is now dynamic based on your user role.

This PR also refactors the relationships between studies and users. Old implementation: A study is connected to a hospital USER through hospital_id and a provider USER through api_key A study configuration is connected to a provider USER through api_key New implmentation: A study is connected to a HOSPITAL through hospital_id and a PROVIDER A study configuration is connected to a PROVIDER

To make the PROVIDER connections we grab the provider user and get the provider through the join table.

These relationship changes align more closely with the goal of our system. That is, hospitals send studies which are processed by our providers. Not the users themselves.

This is a fairly large PR but most of the changes are in the test suite.

Implementation

  1. If you are an admin you can now view all studies:

    Screenshot 2024-04-05 at 10 30 49 AM
  2. If you are a provider user you can now view all studies associated with your provider:

    Screenshot 2024-04-05 at 10 31 18 AM
  3. If you are a hospital user you can now view all studies associated with your hospital:

    Screenshot 2024-04-05 at 10 31 05 AM
  4. You can now search by Hospital Name and Provider Name in the studies table. Previously we showed the ids of the hospital user and provider user in these columns and were unable to search.

  5. The backend test suite now ACTUALLY clears the database before every test run. This slightly increases the time for the suite to run but removes any dependencies.

  6. New migrations were created to update the foreign key relationships between hospital/provider and studies

Testing

This feature was tested by spinning up the docker compose (backend, db, frontend). I logged in as each user and saw the corresponding studies. The entire backend test suite was updated to reflect the new relationship changes

Problems Faced

Notes

The scope for this issue was to update the studies page AND api key page but I will make a new issue for the api key page.

github-actions[bot] commented 4 months ago

Jest Coverage

Summary

Lines Statements Branches Functions
Coverage: 72%
73.25% (515/703) 56.8% (96/169) 66.05% (144/218)

Junit Summary

Tests Skipped Failures Errors Time
37 0 :zzz: 0 :x: 0 :fire: 3.89s :stopwatch:
Coverage Report (72%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files73.2556.866.0572.04 
fixtures100100100100 
   hospitalFixture.tsx100100100100 
   kidneyStudyFixture.tsx100100100100 
   providerFixture.tsx100100100100 
src/components90.9944.4489.6591.17 
   ErrorMessageBox.tsx100100100100 
   EventTimeline.tsx71.42007579–83
   Metadata.tsx85.7108084.6174–75
   Navbar.tsx90.475010090150, 163
   StackedChart.tsx10066.6610010072–85
   withAuthenticated.tsx100100100100 
src/contexts9010058.3389.28 
   authContext.tsx9010058.3389.2872, 90, 104
src/data30.9315.3833.8720 
   index.ts30.9315.3833.872017–27, 38–48, 59–69, 80–90, 98–108, 118–128, 140–149, 161–171, 181–190, 200–205, 217–240, 251–259, 269–274, 287–326, 335–345, 355–365, 370–380, 385–395, 411–412
src/hooks100100100100 
   useAuthContext.ts100100100100 
src/pages81.7267.2780.3982.01 
   analytics.tsx96.1510088.889690
   dashboard.tsx100100100100 
   index.tsx100100100100 
   login.tsx83.8788.8885.7183.3352–57, 109
   profile.tsx77.561.538080.5559–61, 83–86
   signup.tsx71.6255.5566.6671.2389–91, 98–100, 116–140, 224–231, 270–287
src/pages/apikeys73.2154.5464.2871.69 
   index.tsx73.2154.5464.2871.6974–77, 89, 94–99, 104–108, 195
src/pages/studies79.5657.1474.3581.74 
   [id].tsx69.0137.557.8971.8785, 94–108, 112–114, 125–126, 130, 134, 143, 219
   index.tsx90.971.879091.9349, 64, 141, 150, 157
sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
11 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
3.8% Duplication on New Code

See analysis details on SonarCloud