Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

152 create admin dashboard #166

Merged
merged 32 commits into from
Apr 9, 2024
Merged

152 create admin dashboard #166

merged 32 commits into from
Apr 9, 2024

Conversation

powersaudrey25
Copy link
Contributor

@powersaudrey25 powersaudrey25 commented Apr 5, 2024

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

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

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

The hospital and provider id were not referencing the provider and hospital but instead the user of a provider and hospital. This was problematic when trying to pull the actual name of the hospital or provider to show in the studies tables.
Also fetches the name of the provider associated with the study
Also fixed spacing and indentation
I don't think we properly set these tables up. We an actual model (class) for the join tables to user them
…dded

Hospitals and Providers now have studies. A hospital user can see all studies for their hospital and a provider user can see all studies for their provider. Study configurations are now mapped to a provider and not a user
…study provider/study

Also our truncate fixture was not actually truncating tables before each test, it now is.
@powersaudrey25 powersaudrey25 linked an issue Apr 5, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Apr 5, 2024

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 💤 0 ❌ 0 🔥 3.89s ⏱️
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

@powersaudrey25 powersaudrey25 marked this pull request as ready for review April 5, 2024 16:22
Copy link

sonarqubecloud bot commented Apr 8, 2024

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

Copy link
Contributor

@zmorris248 zmorris248 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks tubular

@zmorris248 zmorris248 merged commit 04741fd into main Apr 9, 2024
7 checks passed
@zmorris248 zmorris248 deleted the 152-create-admin-dashboard branch April 9, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Admin Dashboard
3 participants