Closed powersaudrey25 closed 4 months ago
Lines | Statements | Branches | Functions |
---|---|---|---|
73.25% (515/703) | 56.8% (96/169) | 66.05% (144/218) |
Tests | Skipped | Failures | Errors | Time |
---|---|---|---|---|
37 | 0 :zzz: | 0 :x: | 0 :fire: | 3.89s :stopwatch: |
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---|---|---|---|---|---|
All files | 73.25 | 56.8 | 66.05 | 72.04 | |
fixtures | 100 | 100 | 100 | 100 | |
hospitalFixture.tsx | 100 | 100 | 100 | 100 | |
kidneyStudyFixture.tsx | 100 | 100 | 100 | 100 | |
providerFixture.tsx | 100 | 100 | 100 | 100 | |
src/components | 90.99 | 44.44 | 89.65 | 91.17 | |
ErrorMessageBox.tsx | 100 | 100 | 100 | 100 | |
EventTimeline.tsx | 71.42 | 0 | 0 | 75 | 79–83 |
Metadata.tsx | 85.71 | 0 | 80 | 84.61 | 74–75 |
Navbar.tsx | 90.47 | 50 | 100 | 90 | 150, 163 |
StackedChart.tsx | 100 | 66.66 | 100 | 100 | 72–85 |
withAuthenticated.tsx | 100 | 100 | 100 | 100 | |
src/contexts | 90 | 100 | 58.33 | 89.28 | |
authContext.tsx | 90 | 100 | 58.33 | 89.28 | 72, 90, 104 |
src/data | 30.93 | 15.38 | 33.87 | 20 | |
index.ts | 30.93 | 15.38 | 33.87 | 20 | 17–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/hooks | 100 | 100 | 100 | 100 | |
useAuthContext.ts | 100 | 100 | 100 | 100 | |
src/pages | 81.72 | 67.27 | 80.39 | 82.01 | |
analytics.tsx | 96.15 | 100 | 88.88 | 96 | 90 |
dashboard.tsx | 100 | 100 | 100 | 100 | |
index.tsx | 100 | 100 | 100 | 100 | |
login.tsx | 83.87 | 88.88 | 85.71 | 83.33 | 52–57, 109 |
profile.tsx | 77.5 | 61.53 | 80 | 80.55 | 59–61, 83–86 |
signup.tsx | 71.62 | 55.55 | 66.66 | 71.23 | 89–91, 98–100, 116–140, 224–231, 270–287 |
src/pages/apikeys | 73.21 | 54.54 | 64.28 | 71.69 | |
index.tsx | 73.21 | 54.54 | 64.28 | 71.69 | 74–77, 89, 94–99, 104–108, 195 |
src/pages/studies | 79.56 | 57.14 | 74.35 | 81.74 | |
[id].tsx | 69.01 | 37.5 | 57.89 | 71.87 | 85, 94–108, 112–114, 125–126, 130, 134, 143, 219 |
index.tsx | 90.9 | 71.87 | 90 | 91.93 | 49, 64, 141, 150, 157 |
Issues
11 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
3.8% Duplication on New Code
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
If you are an admin you can now view all studies:
If you are a provider user you can now view all studies associated with your provider:
If you are a hospital user you can now view all studies associated with your hospital:
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.
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.
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.