Skip to content

6aRy10/Frida

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frida - Patient Follow-Up System

A modular patient follow-up system for doctors and nurses to manage post-surgery patient follow-up calls.

Tech Stack

Backend

  • Framework: ASP.NET Core (.NET 10) Web API
  • Database: SQLite with Entity Framework Core
  • Authentication: JWT-based auth with ASP.NET Identity
  • Orchestration: .NET Aspire

Frontend

  • Framework: React 19 with TypeScript
  • Build Tool: Vite 7
  • Routing: React Router v7
  • Styling: CSS Modules

Project Structure

├── src/
│   ├── AppHost/           # .NET Aspire orchestration
│   ├── backend/           # ASP.NET Core Web API
│   ├── frontend/          # React + Vite frontend
│   └── ServiceDefaults/   # Shared Aspire service defaults
└── docs/                  # Step-by-step implementation guides

Prerequisites

Getting Started

Option 1: Run with .NET Aspire (Recommended)

This runs both backend and frontend together with automatic configuration:

cd src/AppHost
dotnet run

The Aspire dashboard will show you the URLs for both services.

Option 2: Run Separately

Backend

cd src/backend
dotnet run

The API will be available at https://localhost:7022 (or the port shown in console).

Frontend

cd src/frontend
npm install
npm run dev

The frontend will be available at http://localhost:5173.

Configuration

Backend Configuration (appsettings.json)

{
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=patient_followup.db"
  },
  "Jwt": {
    "Key": "YourSuperSecretKeyThatIsAtLeast32CharactersLong!",
    "Issuer": "PatientFollowup.Api",
    "Audience": "PatientFollowup.Client",
    "ExpiryInMinutes": 60
  },
  "N8n": {
    "BaseUrl": "http://localhost:5678",
    "StartFollowupPath": "/webhook/start-patient-followup",
    "WebhookSecret": "your-n8n-webhook-secret"
  },
  "Backend": {
    "BaseUrl": "https://localhost:7022"
  }
}

Frontend Configuration

The frontend reads the API URL from the VITE_API_URL environment variable. When running with Aspire, this is automatically configured. When running separately, create a .env file:

VITE_API_URL=https://localhost:7022

Default Users

The system seeds the following users in development mode:

Email Password Role
doctor@friya.com Password123! Doctor
nurse@friya.com Password123! Nurse

n8n Integration

The system integrates with n8n for automated follow-up calls:

Scheduler Service

  • Runs every 1 minute
  • Finds pending follow-ups where ScheduledAt <= now
  • Sends POST request to n8n with patient information

Webhook Endpoints (for n8n callbacks)

POST /api/webhooks/followups/{followUpCallId}/result

{
  "status": "Completed" | "Failed" | "NeedsEscalation",
  "outcomeSummary": "string",
  "needsEscalation": boolean
}

Header: X-N8N-SECRET: your-n8n-webhook-secret

POST /api/webhooks/followups/{followUpCallId}/escalation-note

{
  "nurseEmail": "optional",
  "note": "string"
}

Header: X-N8N-SECRET: your-n8n-webhook-secret

Testing Webhooks with curl

# Simulate a completed call
curl -X POST https://localhost:7022/api/webhooks/followups/{followUpCallId}/result \
  -H "Content-Type: application/json" \
  -H "X-N8N-SECRET: your-n8n-webhook-secret" \
  -d '{"status": "Completed", "outcomeSummary": "Patient is doing well", "needsEscalation": false}'

# Simulate an escalation
curl -X POST https://localhost:7022/api/webhooks/followups/{followUpCallId}/result \
  -H "Content-Type: application/json" \
  -H "X-N8N-SECRET: your-n8n-webhook-secret" \
  -d '{"status": "NeedsEscalation", "outcomeSummary": "Patient reported side effects", "needsEscalation": true}'

API Endpoints

Authentication

  • POST /api/auth/login - Login with email/password
  • POST /api/auth/register - Register new user (dev only)
  • GET /api/users/me - Get current user info

Patients

  • GET /api/patients - List patients (paginated, searchable)
  • GET /api/patients/{id} - Get patient details
  • POST /api/patients - Create patient
  • PUT /api/patients/{id} - Update patient
  • DELETE /api/patients/{id} - Delete patient

Follow-ups

  • GET /api/patients/{patientId}/followups - List patient's follow-ups
  • POST /api/patients/{patientId}/followups - Schedule follow-up
  • GET /api/followups/{id} - Get follow-up details
  • PUT /api/followups/{id} - Update follow-up status
  • GET /api/followups?status=NeedsEscalation - List escalations
  • GET /api/followups/{id}/escalation-notes - Get escalation notes
  • POST /api/followups/{id}/escalation-notes - Add escalation note

Dashboard

  • GET /api/dashboard/summary - Get dashboard metrics

Features

  • Patient Management: Add, edit, and manage patient records
  • Follow-up Scheduling: Schedule and track follow-up calls
  • Automated Calls: Integration with n8n for automated patient calls
  • Escalation Workflow: Nurses can view and resolve escalated cases
  • Dashboard: Overview of patients, upcoming calls, and escalations
  • Role-based Access: Different views for Doctors and Nurses

Development

Database Migrations

cd src/backend
dotnet ef migrations add <MigrationName>
dotnet ef database update

Running Tests

# Backend
cd src/backend
dotnet test

# Frontend
cd src/frontend
npm test

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors