Skip to content

Latest commit

 

History

History
316 lines (240 loc) · 6.24 KB

File metadata and controls

316 lines (240 loc) · 6.24 KB

🚀 MedSecure Full-Stack Quick Start

Get the complete MedSecure application (Backend + Frontend + Database) running in 5 minutes.

✅ Requirements

  • Python 3.12+
  • Node.js 16+
  • Docker (for MongoDB)
  • Git

🎯 Step-by-Step Setup

Step 1: Backend Setup (Terminal 1)

# Navigate to project
cd c:\Users\DELL\Medsecure

# Install Python dependencies
pip install -r requirements.txt

# Start MongoDB (runs in background)
docker-compose up -d mongo

# Start FastAPI server
uvicorn app.main:app --reload --port 8000

✓ Backend running at: http://localhost:8000 ✓ API docs at: http://localhost:8000/docs

Step 2: Frontend Setup (Terminal 2)

# Navigate to frontend
cd c:\Users\DELL\Medsecure\frontend

# Install dependencies (first time only - takes ~1 min)
npm install

# Copy environment config
cp .env.local.example .env.local

# Start development server
npm run dev

✓ Frontend running at: http://localhost:3000

Step 3: Test the Application (Terminal 3)

# Optional: Run backend tests
cd c:\Users\DELL\Medsecure
pytest -v tests/

🌐 Access the Application

Component URL Purpose
Frontend http://localhost:3000 Upload UI
API Docs http://localhost:8000/docs Interactive API
Database mongodb://localhost:27017 MongoDB

💡 Try It Out

1. Open Frontend

Visit http://localhost:3000 in your browser

2. Create a Test Document

Create test_document.txt:

Patient: John Doe
DOB: 01/15/1975
SSN: 123-45-6789
Email: john.doe@example.com
Phone: (555) 123-4567

Chief Complaint: Diabetes management

History of Present Illness:
Patient is a 45-year-old male with a history of Type 2 Diabetes Mellitus.
He has been on Metformin 500mg BID for the past 3 years.
Last HbA1c was 7.2% three months ago.

Physical Examination:
Blood Pressure: 135/85 mmHg
Heart Rate: 72 bpm
Weight: 180 lbs

Assessment:
Well-controlled Type 2 Diabetes. Continue current medications.

Plan:
- Follow-up in 3 months
- Recheck HbA1c
- Continue Metformin 500mg BID

3. Upload and Process

  1. Click "Select Text File" on the frontend
  2. Choose test_document.txt
  3. Click "Summarize"
  4. Wait for processing (1-3 seconds)
  5. View results:
    • ✓ Masked document (PII removed)
    • ✓ Generated summary
    • ✓ Extracted medical entities
    • ✓ Verification status

📊 Expected Output

Masked Document:
Patient: [NAME]
DOB: [DOB]
SSN: [SSN]
Email: [EMAIL]
Phone: [PHONE]
...

Generated Summary:
Patient with Type 2 Diabetes on Metformin management...

Extracted Entities:
- diabetes
- Metformin
- Type 2 Diabetes Mellitus

Verification: ✓ Passed

🛑 Stop Services

Stop All (Ctrl+C in each terminal)

# Terminal 1: Backend
Ctrl+C

# Terminal 2: Frontend
Ctrl+C

# Stop MongoDB
docker-compose down

🔧 Common Issues

Issue: "Cannot connect to backend"

Solution:

# Ensure backend is running
curl http://localhost:8000/docs

# Check .env.local in frontend
cat frontend/.env.local

Issue: "MongoDB connection error"

Solution:

# Start MongoDB
docker-compose up -d mongo

# Verify connection
mongosh

Issue: "npm: command not found"

Solution:

# Install Node.js from https://nodejs.org/
# Then verify:
node --version
npm --version

Issue: "Port 3000 already in use"

Solution:

cd frontend
npm run dev -- -p 3001

Issue: "Port 8000 already in use"

Solution:

uvicorn app.main:app --reload --port 8001

📚 Next Steps

After Testing Works:

  1. Read PORTFOLIO_SETUP.md for full overview
  2. Follow EXECUTION_PIPELINE.md for development phases
  3. Start Phase 1: Enhanced PII Masking
  4. Implement phases incrementally

Architecture:

Browser → Next.js (3000) → FastAPI (8000) → MongoDB (27017)

💾 Project Structure

MedSecure/
├── app/                    # Backend (FastAPI)
│   ├── main.py
│   ├── api/routes.py      # API endpoints
│   ├── services/          # Pipeline services
│   └── core/              # Security & config
├── frontend/              # Frontend (Next.js)
│   ├── pages/
│   │   └── index.js       # Main upload page
│   ├── components/        # React components
│   ├── lib/api.js         # API client
│   └── package.json
├── docker-compose.yml     # MongoDB setup
├── requirements.txt       # Python deps
└── README.md

📝 Key Files

File Purpose
README.md Full project overview
FULL_STACK.md Architecture & deployment
frontend/README.md Frontend-only setup
EXECUTION_PIPELINE.md Development roadmap

🎯 Commands Reference

Backend

# Start API
uvicorn app.main:app --reload

# Run tests
pytest -v tests/

# Security scan
bandit -r app

Frontend

# Development
npm run dev

# Production build
npm run build
npm start

# Linting
npm run lint

Database

# Start MongoDB
docker-compose up -d mongo

# Connect to MongoDB
mongosh

# Stop MongoDB
docker-compose down

✨ What's Running

Service URL Status
Next.js Frontend http://localhost:3000 🟢 Running
FastAPI Backend http://localhost:8000 🟢 Running
API Docs http://localhost:8000/docs 🟢 Interactive
MongoDB mongodb://localhost:27017 🟢 Running

🎓 System Components

Frontend (Next.js)

  • File upload interface
  • Results display
  • PII masking preview
  • Medical entities visualization
  • Verification status

Backend (FastAPI)

  • RBAC security layer
  • PII masking engine
  • Medical NER service
  • LLM summarizer (placeholder)
  • Hallucination verification
  • MongoDB storage layer

Database (MongoDB)

  • Document storage
  • Summary caching
  • User access logs

🚀 You're Ready!

All three components are running and ready to process medical documents.

Test it now at: http://localhost:3000


Questions? Check FULL_STACK.md or PORTFOLIO_SETUP.md

Ready to build? See EXECUTION_PIPELINE.md