Skip to content

Latest commit

Β 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Medora Backend - Serverless API

Vercel Deployment Node.js TypeScript Firebase OpenAI

πŸ“‹ Overview

Medora Backend is a serverless API built for the Medora medical assistant app. It provides intelligent chat responses personalized with user medical data from Firebase Firestore, powered by OpenAI's GPT models.

Key Features

  • πŸš€ Serverless Architecture - Deployed on Vercel for automatic scaling
  • πŸ” Secure Authentication - Firebase integration for user data
  • πŸ’¬ AI-Powered Chat - OpenAI GPT models with medical context
  • πŸ“Š Personalized Responses - Uses patient medical records from Firestore
  • πŸ”„ CORS Enabled - Ready for cross-origin requests from Expo apps
  • ⚑ Fast Responses - Optimized with gpt-4o-mini for quick replies

Project Structure:

medora-backend/
β”œβ”€β”€ api/                                           
β”‚   β”œβ”€β”€ chat.ts              # working api route access firebase-admin db(main route)
β”‚   β”œβ”€β”€ chat-simple.ts      # Simplified version for testing
β”‚   β”œβ”€β”€ test-simple.ts      # Basic connectivity test
β”‚
β”œβ”€β”€ lib/                         
β”‚   β”œβ”€β”€ config.ts               # Firebase Admin initialization
β”‚   └── user-data.ts              # User data fetching utilities
β”‚
β”œβ”€β”€ .env.example                  # Environment variables template
β”œβ”€β”€ package.json                  # Dependencies and scripts
β”œβ”€β”€ tsconfig.json                 # TypeScript configuration
β”œβ”€β”€ vercel.json                   # Vercel deployment config
└── README.md                     # Project documentation

πŸ“‘ API Endpoints

1. Main Endpoints

1.1 POST /api/chat-working

Request Body:

{
  "userId": "firebase-user-id",
  "messages": [
    { "role": "user", "content": "What is my blood type?" }
  ],
  "model": "gpt-4o-mini"  // optional, defaults to gpt-4o-mini
}

Response:

{
  "text": "Based on your medical records, your blood type is O+."
}

2.Test Endpoints

2.2 POST /api/chat

Basic connectivity test. Request body:

{
  "userId": "use_id",
  "messages": [
    {
      "role": "user",
      "content": "Hello, tell me about my medical data"
    }
  ]
}

Response:

Hello Subhro! Here's a summary of your medical data:

### πŸ“‹ Medical Information:
- **Blood Type:** B+
- **Height:** 166 cm
- **Weight:** 90 kg
- **Allergies:** Peanuts
- **Current Medications:** None listed
- **Chronic Conditions:** None listed
- **Past Surgeries:** Nose surgery (scheduled for 2025)

### πŸ“… Insurance Details:
- **Provider:** Bajaj
- **Policy Number:** 2134
- **Type:** Employer
- **Coverage Valid Until:** December 12,
2004 (please check for an update)

### πŸ“‡ Identification:
- **National ID Number:** 123243
- **Expiry Date:** February 11,
2023 (please ensure renewal if necessary)

### πŸ“‘ Documents:
- Birth certificate, medical history, insurance card (front), Aadhaar card

If you need more detailed information or documents, let me know, and I can provide a PDF. 

**Disclaimer:** This information is provided for your personal reference. For medical advice, please consult a healthcare professional.

About

πŸ›œ Medora Backend is a serverless API built for the Medora medical assistant app. It provides intelligent chat responses personalized with user medical data from Firebase Firestore, powered by OpenAI's GPT models.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages