https://github.com/soumyadip007/scalable-services-project-patient-service
The Patient API allows you to manage patient records in a medical system. It provides endpoints for creating, reading, updating, and deleting patient information.
https://github.com/soumyadip007/scalable-services-project-patient-service
api docker express k8s nodejs
Last synced: 8 months ago
JSON representation
The Patient API allows you to manage patient records in a medical system. It provides endpoints for creating, reading, updating, and deleting patient information.
- Host: GitHub
- URL: https://github.com/soumyadip007/scalable-services-project-patient-service
- Owner: soumyadip007
- License: apache-2.0
- Created: 2024-03-30T15:31:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-30T16:15:16.000Z (over 1 year ago)
- Last Synced: 2025-01-06T00:13:05.294Z (9 months ago)
- Topics: api, docker, express, k8s, nodejs
- Language: JavaScript
- Homepage:
- Size: 146 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Patient API Documentation
## Introduction
The Patient API allows you to manage patient records in a medical system. It provides endpoints for creating, reading, updating, and deleting patient information.
## Base URL
The base URL for accessing the Patient API is `http://localhost:3000/project/v1/patient`. Replace `http://localhost:3000` with the appropriate URL of your API server.
## Endpoints
### Create a Patient
- **URL:** `/project/v1/patient`
- **Method:** `POST`
- **Description:** Create a new patient record.
- **Request Body:**
```json
{
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "1980-05-20",
"gender": "Male",
"contactNumber": "1234567890",
"address": "123 Main St, City, Country",
"email": "john@example.com",
"bloodType": "A+",
"allergies": ["Peanuts", "Penicillin"],
"emergencyContact": {
"name": "Jane Doe",
"relationship": "Spouse",
"phoneNumber": "0987654321"
}
}
```
- **Response:** Returns the created patient record.### Get All Patients
- **URL:** `/project/v1/patient`
- **Method:** `GET`
- **Description:** Get a list of all patient records.### Get a Patient by ID
- **URL:** `/project/v1/patient/:id`
- **Method:** `GET`
- **Description:** Get a specific patient record by its ID.
- **Path Parameter:**
- `:id` - The unique identifier of the patient.### Update a Patient
- **URL:** `/project/v1/patient/:id`
- **Method:** `PUT`
- **Description:** Update an existing patient record.
- **Path Parameter:**
- `:id` - The unique identifier of the patient.
- **Request Body:** JSON object containing fields to be updated.
- **Response:** Returns the updated patient record.### Delete a Patient
- **URL:** `/project/v1/patient/:id`
- **Method:** `DELETE`
- **Description:** Delete a specific patient record by its ID.
- **Path Parameter:**
- `:id` - The unique identifier of the patient.
- **Response:** Returns a success message upon successful deletion.## cURL Examples
Below are some cURL examples demonstrating how to interact with the Patient API:
1. **Create a Patient:**
```bash
curl -X POST \
http://localhost:3000/project/v1/patient \
-H 'Content-Type: application/json' \
-d '{
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "1980-05-20",
"gender": "Male",
"contactNumber": "1234567890",
"address": "123 Main St, City, Country",
"email": "john@example.com",
"bloodType": "A+",
"allergies": ["Peanuts", "Penicillin"],
"emergencyContact": {
"name": "Jane Doe",
"relationship": "Spouse",
"phoneNumber": "0987654321"
}
}'
```2. **Get All Patients:**
```bash
curl -X GET http://localhost:3000/project/v1/patient
```3. **Get a Patient by ID:**
```bash
curl -X GET http://localhost:3000/project/v1/patient/:id
```
Replace `:id` with the ID of the patient you want to retrieve.4. **Update a Patient:**
```bash
curl -X PUT \
http://localhost:3000/project/v1/patient/:id \
-H 'Content-Type: application/json' \
-d '{
"firstName": "UpdatedName"
}'
```
Replace `:id` with the ID of the patient you want to update.5. **Delete a Patient:**
```bash
curl -X DELETE http://localhost:3000/project/v1/patient/:id
```
Replace `:id` with the ID of the patient you want to delete.## Error Handling
If an error occurs while processing a request, the API will return an appropriate HTTP status code along with a JSON response containing an error message.