-
Notifications
You must be signed in to change notification settings - Fork 0
Final Project Submission: Sterile Processing Tracker (SPT) #1
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
Open
bbeare22
wants to merge
74
commits into
main
Choose a base branch
from
stage-1-frontend-and-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
85a4632
feat: scaffold Vite React app
bbeare22 b4e2380
feat(ui): AppShell layout, tokens, router, base pages
bbeare22 2cba900
feat(ui): Card and KPI components + dashboard layout
bbeare22 49dfa66
feat(recalls): express proxy + live OpenFDA recalls table
bbeare22 271d295
Updated title
bbeare22 53b0540
Fixed gitignore
bbeare22 26159c7
chore: add root .gitignore and clean node_modules
bbeare22 fbe60f6
Update to project
bbeare22 07ef1ab
feat(maintenance): form shell with mL↔oz converter and validation
bbeare22 0fe1e50
feat(machines): list with filters, MachineCard, and detail route
bbeare22 d01678b
feat(ui): color-code overdue list and add days-since chip on MachineCard
bbeare22 1e4bc7f
feat(ui): add glowing status dot to MachineCard
bbeare22 46bd8e9
feat(ui): reuse status dots across Dashboard and MachineCard
bbeare22 66e8adc
feat(recalls): add brand filter, loading skeleton, and empty state
bbeare22 cfbdb4d
feat(machines): read from /api/machines and support _id in UI
bbeare22 fe9a80e
feat(maintenance): backend routes + connect form to API and auto-upda…
bbeare22 4520b61
feat(dashboard): fetch live machines and add Log maintenance shortcut…
bbeare22 9e7bec0
feat(dashboard): add Recent Maintenance card alongside Overdue Descal…
bbeare22 f8db7bd
Add employeeId and sterilizationNumber to user model, register page, …
bbeare22 80ee894
Small styling update on Login/Register/Logout
bbeare22 154350e
feat(ui): toast notifications, loading skeletons, and unified card he…
bbeare22 3ea7b5d
feat(history): add CSV export with toast notifications to maintenance…
bbeare22 6b3dc37
Added 404 not found page and also updated the about page
bbeare22 ca24f09
Polish UI: fix MachineForm & Maintenance form overflow, button styles
bbeare22 5777a72
Added cycle integration and a few updates
bbeare22 8930f71
Add sterilizer cycles integration, cycle history page, and UI polish
bbeare22 eb074e0
feat: add sterilizer cycles logging, sterilizer-specific maintenance …
bbeare22 e38b054
chore: add env examples
bbeare22 c52135f
updated readme
bbeare22 ea64e19
Small fix/ polish
bbeare22 739f45f
Add screenshots and update README
bbeare22 0b420a7
screenshot fix
bbeare22 47b381d
small fix
bbeare22 8813b35
Add screenshots and fix README paths
bbeare22 fc2e4e2
final check before submit
bbeare22 4a965be
Refactor date handling: shared helpers + aligned forms
bbeare22 896cd96
Refactor: use apiFetch everywhere; date helpers; small cleanups
bbeare22 352a419
Refactor: centralize API via apiFetch + auth utils; date helpers
bbeare22 e548bd4
Add ErrorBoundary and wrap app to avoid hard crashes
bbeare22 927d633
UI: add accessible Modal and use it for Add/Edit Machine
bbeare22 b5f8598
refactor: move inline styles to separate CSS files across components …
bbeare22 bafe630
Preparing for deploy
bbeare22 9383579
Updated ReadME
bbeare22 fe3d8ea
feat: add RBAC for maintenance/cycles + supervisor-only machine manag…
bbeare22 1d4d935
feat: update spores, cycles, maintenance logging
bbeare22 685e630
Added PM page
bbeare22 1da2d7b
Add month-based CSV exports, fix dashboard KPIs with start/end filter…
bbeare22 6e1c2fb
Added Decon page
bbeare22 cd142c9
Updated decon Page
bbeare22 616a4f0
Added control BI testing
bbeare22 8acf059
Updated maintenance, added washer daily rack test/ washer weekly main…
bbeare22 3d68de7
Added transport page for logging transport trips and fuel use
bbeare22 1fbec28
Updated transport page to show monthly trip stats
bbeare22 609868e
Added audit section
bbeare22 0014984
Added server side audit function
bbeare22 006d57e
Add PDF exports and daily compliance reminders job
bbeare22 9566036
Clean reset
bbeare22 e6c1199
Add tablet friendly pass
bbeare22 718453a
Small fixes and polishing
bbeare22 0251c39
Small index.js fix
bbeare22 c7a3fb8
Add branded logo, favicon, and manifest for SPT + report enhancements
bbeare22 b332870
Fix: correct maintenance initials mapping in reports (PDF & CSV)
bbeare22 71b271b
Stop tracking env files; keep only sanitized .env.example
bbeare22 b400d28
Stop tracking env files; keep only sanitized .env.example
bbeare22 29e8705
add sanitized server .env.example
bbeare22 7a5b506
wrap routes with ErrorBoundary
bbeare22 499de22
small push
bbeare22 3eb7c51
client: remove unused boilerplate and dead files
bbeare22 ca4d57d
chore: add lightweight logger; quiet common console noise
bbeare22 9a5532e
chore: add root scripts and Prettier config; enable format-on-save
bbeare22 d7e53a7
chore: add ESLint (flat), lint scripts, and optional pre-commit hooks
bbeare22 d70b974
Update README.md
bbeare22 e77acc4
Update for demo mode
bbeare22 9ae0242
Add MIT License
bbeare22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| node_modules | ||
| dist | ||
| build | ||
| coverage | ||
| apps/**/dist | ||
| apps/**/build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # --- Node --- | ||
| node_modules/ | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
|
|
||
| # --- Build outputs --- | ||
| dist/ | ||
| build/ | ||
| .out/ | ||
| .next/ | ||
| .vercel/ | ||
|
|
||
| # --- Env files (don’t commit secrets) --- | ||
| *.env | ||
| **/.env | ||
| /apps/**/.env | ||
| /apps/**/.env.local | ||
| /apps/**/.env.*.local | ||
|
|
||
| # --- Logs --- | ||
| *.log | ||
| logs/ | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # --- Editor/OS --- | ||
| .DS_Store | ||
| Thumbs.db | ||
| .idea/ | ||
| .vscode/* | ||
| !.vscode/settings.json | ||
|
|
||
| # --- Coverage/testing --- | ||
| coverage/ | ||
| *.lcov | ||
|
|
||
| # --- Misc --- | ||
| *.cache | ||
| *.tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| node_modules | ||
| dist | ||
| build | ||
| coverage | ||
| *.log | ||
| apps/**/dist | ||
| apps/**/build | ||
| apps/**/.vite |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "printWidth": 100, | ||
| "singleQuote": true, | ||
| "trailingComma": "es5", | ||
| "semi": true, | ||
| "arrowParens": "always" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "editor.formatOnSave": true, | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode", | ||
| "files.insertFinalNewline": true, | ||
| "files.trimTrailingWhitespace": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Brett Beare | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,284 @@ | ||
| # Sterile Processing Tracker | ||
| # 🧼 Sterile Processing Tracker (SPT) | ||
|
|
||
| > **Reviewer Note:** | ||
| > This project is fully deployed and ready for live testing. | ||
|
|
||
| **Frontend (React/Vite):** | ||
| 🔗 https://spt-front.onrender.com | ||
|
|
||
| **Backend (Express/MongoDB API):** | ||
| 🔗 https://spt-api-w5vi.onrender.com | ||
|
|
||
| When logged out, only the **Dashboard** is visible. | ||
| To access **Machines**, **Maintenance**, **Cycles**, and **Detail** views, please register or log in. | ||
|
|
||
| --- | ||
|
|
||
| ## 🧭 Overview | ||
|
|
||
| A modern full-stack web app for tracking sterile processing equipment, maintenance, and sterilizer cycles (loads). | ||
| Built with **React (Vite)**, **Express**, **MongoDB**, and **JWT authentication**. | ||
|
|
||
| --- | ||
|
|
||
| ## 🌐 Live Demo | ||
|
|
||
| | Service | URL | | ||
| | -------------------------------- | ---------------------------------------------------------------------- | | ||
| | 🖥️ Frontend (React/Vite) | [https://spt-front.onrender.com](https://spt-front.onrender.com) | | ||
| | ⚙️ Backend (Express/MongoDB API) | [https://spt-api-w5vi.onrender.com](https://spt-api-w5vi.onrender.com) | | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Features | ||
|
|
||
| ### Machines | ||
|
|
||
| - Add / edit / delete washers, sterilizers, ultrasonics (auth required) | ||
| - Machine detail: recent maintenance & cycles (auth required) | ||
|
|
||
| ### Maintenance | ||
|
|
||
| - Washer / Ultrasonic descale with daily & time-based tracking (auth required) | ||
| - Sterilizers: **Daily Inspection** and **Quarterly Cleaning** (auth required) | ||
| - Maintenance history view & export | ||
|
|
||
| ### Sterilizer Cycles | ||
|
|
||
| - Log sterilizer loads, test types, and results (auth required) | ||
| - Track cycles by date, load type, and operator | ||
|
|
||
| ### Dashboard | ||
|
|
||
| - KPIs for today’s sterilizer cycles & recent maintenance | ||
| - Real-time load tracking overview (public) | ||
|
|
||
| ### Authentication | ||
|
|
||
| - Register / Login / Logout with JWT | ||
| - Protected routes for all critical data | ||
| - Session persistence via `localStorage` token | ||
|
|
||
| ### UI/UX | ||
|
|
||
| - Toast notifications | ||
| - Reusable card layouts | ||
| - Loading skeletons | ||
| - Consistent CSS-based dashboard layout | ||
|
|
||
| --- | ||
|
|
||
| ## 🧱 Monorepo Layout | ||
|
|
||
| ``` | ||
| apps/ | ||
| ├─ server/ → Express API + MongoDB | ||
| └─ client/ → React client (Vite) | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🧩 Run Locally | ||
|
|
||
| ### 1. Install Dependencies (from root) | ||
|
|
||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| ### 2. Copy `.env.example` → `.env` and update values | ||
|
|
||
| Example for local development: | ||
|
|
||
| ```bash | ||
| # apps/server/.env | ||
| PORT=3001 | ||
| CLIENT_URL=http://localhost:5173 | ||
| MONGO_URL=mongodb://localhost:27017/spt | ||
| JWT_SECRET=your-secret-key | ||
| JWT_EXPIRES_IN=7d | ||
| ``` | ||
|
|
||
| ```bash | ||
| # apps/client/.env | ||
| VITE_API_URL=http://localhost:3001 | ||
| ``` | ||
|
|
||
| ### 3. (Optional) Seed Demo Data | ||
|
|
||
| ```bash | ||
| node apps/server/scripts/seed.js | ||
| ``` | ||
|
|
||
| ### 4. Start Both Servers (two terminals) | ||
|
|
||
| ```bash | ||
| # Terminal 1: Express API | ||
| npm run dev:server # Runs on http://localhost:3001 | ||
|
|
||
| # Terminal 2: React client | ||
| npm run dev:web # Runs on http://localhost:5173 | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🏗️ Build for Production | ||
|
|
||
| ```bash | ||
| # Build web client | ||
| npm run build:web | ||
|
|
||
| # Start Express API (after build) | ||
| npm run start:server | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🧰 Useful Scripts | ||
|
|
||
| | Command | Description | | ||
| | -------------- | ------------------------------- | | ||
| | `dev:server` | Run Express API with nodemon | | ||
| | `dev:web` | Start Vite dev server | | ||
| | `build:web` | Build production-ready client | | ||
| | `start:server` | Run API in production mode | | ||
| | `seed` | Populate MongoDB with demo data | | ||
|
|
||
| --- | ||
|
|
||
| ## 🔑 API Overview | ||
|
|
||
| ### **Auth** | ||
|
|
||
| | Method | Endpoint | Description | | ||
| | ------ | -------------------- | -------------------------------------------------------------------------- | | ||
| | `POST` | `/api/auth/register` | Create new user _(email, password, name, employeeId, sterilizationNumber)_ | | ||
| | `POST` | `/api/auth/login` | Authenticate existing user | | ||
| | `GET` | `/api/auth/me` | Fetch logged-in user profile (JWT required) | | ||
|
|
||
| ### **Machines** | ||
|
|
||
| | Method | Endpoint | Description | | ||
| | -------- | ------------------- | ------------------------- | | ||
| | `GET` | `/api/machines` | Get all machines | | ||
| | `GET` | `/api/machines/:id` | Get machine by ID | | ||
| | `POST` | `/api/machines` | Create new machine (auth) | | ||
| | `PUT` | `/api/machines/:id` | Update machine (auth) | | ||
| | `DELETE` | `/api/machines/:id` | Delete machine (auth) | | ||
|
|
||
| ### **Maintenance** | ||
|
|
||
| | Method | Endpoint | Description | | ||
| | ------ | ----------------------------------- | ------------------------- | | ||
| | `GET` | `/api/maintenance?machineId=&date=` | Fetch maintenance records | | ||
| | `POST` | `/api/maintenance` | Log maintenance activity | | ||
| | `GET` | `/api/maintenance/history` | Fetch maintenance history | | ||
|
|
||
| ### **Cycles** | ||
|
|
||
| | Method | Endpoint | Description | | ||
| | -------- | ----------------- | -------------------- | | ||
| | `GET` | `/api/cycles` | List cycles | | ||
| | `POST` | `/api/cycles` | Log sterilizer cycle | | ||
| | `GET` | `/api/cycles/:id` | Get cycle detail | | ||
| | `DELETE` | `/api/cycles/:id` | Delete a cycle | | ||
|
|
||
| > **Auth required:** All write operations. | ||
| > **Header:** `Authorization: Bearer <token>` | ||
|
|
||
| --- | ||
|
|
||
| ## 🧿 Security & Validation | ||
|
|
||
| - Server-side validation with **Zod + Mongoose schemas** | ||
| - Endpoints protected by **JWT** | ||
| - CORS restricted to `CLIENT_URL` | ||
| - **Helmet** middleware enabled for HTTP security headers | ||
| - Sensitive config via `.env` (never committed) | ||
|
|
||
| --- | ||
|
|
||
| ## 🗃️ Database Indexes | ||
|
|
||
| | Collection | Index | | ||
| | --------------- | ----------------------------------- | | ||
| | **Maintenance** | `{ machineId: 1, performedAt: -1 }` | | ||
| | **Cycles** | `{ machineId: 1, startedAt: -1 }` | | ||
|
|
||
| Indexes ensure efficient lookups by machine and date. | ||
|
|
||
| --- | ||
|
|
||
| ## 🧠 Usage Guide | ||
|
|
||
| 1. **Login with demo user** _(or register a new account)_ | ||
|
|
||
| - Use seeded demo data or create your own. | ||
| - When logged out, only the Dashboard is visible. | ||
|
|
||
| 2. **Access Restricted Views** | ||
|
|
||
| - Machines, Maintenance, Cycles, and Detail pages require login. | ||
|
|
||
| 3. **Dashboard KPIs** | ||
|
|
||
| - Today’s sterilizer cycles and recent maintenance appear in real-time. | ||
|
|
||
| 4. **Machine Detail View** | ||
|
|
||
| - Log or view maintenance and sterilizer cycles by machine. | ||
|
|
||
| 5. **Cycle & Maintenance History** | ||
|
|
||
| - Export reports via CSV from "View All…" pages. | ||
|
|
||
| 6. **Reports & Recall Tracking** | ||
| - Track historical loads and maintenance schedules with filters. | ||
|
|
||
| --- | ||
|
|
||
| ### ❤️ Made with care | ||
|
|
||
| Created to streamline and modernize sterile processing operations — from washer to sterilizer — with data-driven visibility. | ||
|
|
||
| --- | ||
|
|
||
| ### Dashboard | ||
|
|
||
|  | ||
|
|
||
| ### Machines | ||
|
|
||
|  | ||
|
|
||
| ### Machine Detail — Washer | ||
|
|
||
|  | ||
|
|
||
| ### Machine Detail — Sterilizer | ||
|
|
||
|  | ||
|
|
||
| ### Log Maintenance Form | ||
|
|
||
|  | ||
|
|
||
| ### Log Cycle Form | ||
|
|
||
|  | ||
|
|
||
| ### Maintenance History (with CSV export) | ||
|
|
||
|  | ||
|
|
||
| ### Cycles History (with CSV export) | ||
|
|
||
|  | ||
|
|
||
| ### Login | ||
|
|
||
|  | ||
|
|
||
| ### Register | ||
|
|
||
|  | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| VITE_API_URL=http://localhost:3001 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readme