General Patients API
General endpoints for patient management and information.
List Patients
Get a list of patients.
Endpoint: GET /v1/patients
Authentication: Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page |
search | string | No | Search term |
Example Request
GET /v1/patients?page=1&page_size=25 HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereCreate Patient
Endpoint: POST /v1/patients
Authentication: Required
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
patient | object | Yes | Patient data object |
patient.first_name | string | Yes | Patient’s first name |
patient.last_name | string | Yes | Patient’s last name |
patient.date_of_birth | string | Yes | Date of birth (YYYY-MM-DD) |
patient.gender | string | No | Patient’s gender |
patient.phone | string | No | Patient’s phone number |
patient.email | string | No | Patient’s email address |
patient.address | object | No | Patient’s address |
Example Request
POST /v1/patients HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_here
{
"patient": {
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "2010-05-15",
"gender": "male",
"phone": "+1-555-123-4567",
"email": "[email protected]",
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip_code": "12345"
}
}
}Update Patient
Endpoint: PUT /v1/patients/{id}
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Patient ID |
Request Body Parameters
Same as Create Patient endpoint, but all fields are optional.
Get Patient Details
Endpoint: GET /v1/patients/{id}
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Patient ID |
Patient Gauges
List Patient Gauges
Get measurement gauges for a patient.
Endpoint: GET /v1/patients/{patient_id}/gauges
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
patient_id | integer | Yes | Patient ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
gauge_type | string | No | Filter by gauge type |
start_date | string | No | Start date filter (YYYY-MM-DD) |
end_date | string | No | End date filter (YYYY-MM-DD) |
Example Request
GET /v1/patients/1049/gauges?gauge_type=mood&start_date=2023-10-01 HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereResponse Format
Patient Response
{
"id": 1049,
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "2010-05-15",
"age": 13,
"gender": "male",
"phone": "+1-555-123-4567",
"email": "[email protected]",
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip_code": "12345"
},
"active": true,
"created_at": "2023-10-20T10:00:00.000Z",
"updated_at": "2023-10-20T15:30:00.000Z"
}Patient Gauge Response
{
"id": 456,
"patient_id": 1049,
"gauge_type": "mood",
"value": 7,
"scale_min": 1,
"scale_max": 10,
"recorded_at": "2023-10-27T14:30:00.000Z",
"notes": "Feeling better today",
"created_at": "2023-10-27T14:30:00.000Z"
}Gauge Types
Common gauge types include:
mood- Mood rating scaleanxiety- Anxiety level scaleenergy- Energy level scalesleep_quality- Sleep quality ratingpain- Pain level scalemedication_adherence- Medication compliancesocial_interaction- Social interaction level
Error Responses
422 Unprocessable Entity
{
"errors": {
"first_name": ["can't be blank"],
"last_name": ["can't be blank"],
"date_of_birth": ["can't be blank", "must be a valid date"]
}
}404 Not Found
{
"errors": "Patient not found"
}403 Forbidden
{
"errors": "You are not authorized to access this patient"
}Notes
- Patient creation requires basic demographic information
- Age is automatically calculated from date of birth
- Gauges provide a way to track patient progress over time
- Address information is optional but helpful for billing and communication
- Patient access is controlled based on user permissions and relationships
- All patient data is handled with appropriate privacy protections