Welcome to the Neuracare Backend Repository. This backend powers the Neuracare platform, a personalized healthcare solution, using a blend of modern technologies and practices.
- Technology Stack
- Getting Started
- Database Schema
- Authentication
- API Documentation
- Deployment
- Local Development
- Testing
- Contributing
- Troubleshooting
- Contact and Support
- Server: Bun
- WebSockets: For real-time communication.
- Database: MongoDB Atlas.
- Authentication: Auth0.
- Hosting: Google Cloud with Kubernetes.
- CDN: Cloudflare.
- Bun installed on your machine.
- Access to MongoDB Atlas.
- An Auth0 account.
- Clone the repository:
git clone https://github.com/Neuracare/Backend.git
. - Install dependencies:
bun install
.
- Patients: Stores patient data including health metrics and personal information.
- Caregivers: Contains caregiver details and their associated patients.
- The
Patients
collection referencesCaregivers
through a relational field to mimic SQL foreign keys.
- The backend authenticates using tokens generated by Auth0 in the frontend.
- All requests must include a valid session token and email for authentication.
GET /
:- Returns a simple "Hello World" message.
- Response:
{"message": "Hello World"}
-
GET /patient
:- Retrieves patient data based on the provided ID.
- Parameters:
id
(patient ID) - Response: Patient data or
Not found
if the patient does not exist.
-
GET /patient/info
:- Fetches specific information about a patient.
- Parameters:
id
(patient ID),query
(specific data query) - Response: Requested patient information or error message.
-
POST /patient/update
:- Updates patient data.
- Parameters:
id
(patient ID),update
(data to update) - Response: Success or error message.
-
POST /patient/add
:- Adds a new patient.
- Parameters:
newPatient
(patient data) - Response: Success or error message.
-
GET /patient/todo
:- Processes a transcript to update a patient's to-do list and summary points.
- Parameters:
id
(patient ID),transcript
(audio transcript) - Response: Success or error message.
-
GET /caregiver
:- Retrieves caregiver data based on the provided ID.
- Parameters:
id
(caregiver ID) - Response: Caregiver data or
Not found
.
-
POST /caregiver/update
:- Updates caregiver data.
- Parameters:
id
(caregiver ID),update
(data to update) - Response: Success or error message.
-
POST /caregiver/add
:- Adds a new caregiver.
- Parameters:
newCaregiver
(caregiver data) - Response: Success or error message.
-
GET /web/getPatients
:- Retrieves all patients associated with a caregiver.
- Parameters:
id
(caregiver ID) - Response: List of patients or error message.
-
GET /web/getPatient
:- Fetches detailed information for a specific patient.
- Parameters:
id
(patient ID) - Response: Patient details or error message.
POST /ios/update
:- Updates various health metrics of a patient from the iOS app.
- Parameters:
id
(patient ID),respiratoryRate
,location
,heartRate
,bloodOxygen
- Response: Success or error message.
-
GET /blockchain/account
:- Retrieves account information based on the provided account ID.
- Parameters:
id
(account ID) - Response: Account data or
Not found
if the account does not exist.
-
POST /blockchain/transaction
:- Creates a new transaction on the Hedera network.
- Parameters:
from
(sender account ID),to
(recipient account ID),amount
(transaction amount) - Response: Transaction ID or error message.
-
GET /blockchain/transaction
:- Retrieves transaction information based on the provided transaction ID.
- Parameters:
id
(transaction ID) - Response: Transaction data or
Not found
if the transaction does not exist.
-
GET /blockchain/balance
:- Retrieves the balance of a specific account.
- Parameters:
id
(account ID) - Response: Account balance or error message.
- The blockchain endpoints are powered by the Hedera network.
- These endpoints are seperate from the existing API endpoints. This was to ensure the security and safety of Users
- With Hedera, we were able to eliminate the need for "password" based login for patients.
- All endpoints return a
404 Not found
status with an appropriate message if the requested resource is not available or the request is invalid.
This section provides a comprehensive guide for developers to understand and interact with the backend API. Each endpoint is clearly described with its HTTP method, required parameters, and expected responses.
- Connection: Instructions on establishing a WebSocket connection for real-time data/notifications.
- Deployed the main methods on a server in California
- Deploy the concurrent solution on Google Cloud using Kubernetes for scalability and reliability.
- Set up Cloudflare CDN for optimized content delivery.
- Ensure Bun and MongoDB are correctly set up.
- Run
bun run start
to start the server locally.
- Use Jest for unit and integration tests.
- Run
bun test
to execute the test suite.
- Fork the repository and create a feature branch.
- Follow standard coding conventions.
- Submit a pull request with detailed descriptions of changes.
- Common Issue 1: Solution or steps to resolve.
- Common Issue 2: Tips or FAQs.
For any queries or support, please contact [email protected] or raise an issue in the repository.
Feel free to modify and expand each section with specific details relevant to the Neuracare backend. This sample provides a comprehensive guide for developers and contributors.