Introduction
This is the documentation page for the Hamrohealth School System API.
Warning
Documentation is currently on progress and may subject to change.
Get Recent Events/api/general-info/get-recent-events
The /api/general-info/get-recent-events
API retrieves a list of recent events.
This API allows optional filtering based on school_id
, class_id
, and form_id
.
The response includes details such as the respondent's name, event name, date of creation, class, school name, and additional metadata.
Endpoint Details
- Endpoint:
/api/general-info/get-recent-events
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure that the token is valid and has the necessary permissions to access the endpoint.
Query Parameters
The following query parameters can be used to filter the results:
Parameter | Type | Required | Description |
---|---|---|---|
school_id |
Integer | No | Filter events by school ID. |
class_id |
Integer | No | Filter events by class ID. |
form_id |
Integer | No | Filter events by form ID. |
Example Request
Here’s how to call the API:
{ "school_id": 1, "class_id": 10, "form_id": 8 }
Response
The API responds with a JSON object containing a success flag and an array of event details. Below is the response structure:
[ { "respondent_name": "John Doe", "event_name": "Clinic Visit", "created_at": "2021-01-01 00:00:00", "class": "10", "school_name": "Rarahill Memorial School", "form_id": 1, "order_no": 1, "form_data": [ { "question": "Patient Note", "answer": "complain of pain in foot, nothing seen like bluish or any sign of injury", "sub_question": [] }, { "question": "Medicine given?", "answer": "Yes", "sub_question": { "question": "What are the medicines?", "answer": "Paracetamol, Aspirin", "sub_question": [] } } ] } ]
Current Clinic Visits/api/general-info/get-current-clinic-visits
The /api/general-info/get-current-clinic-visits
API retrieves a list of ongoing clinic visits.
This API allows optional filtering based on school_id
.
The response includes details such as the respondent's name, in-time, class, school name, and additional metadata.
Endpoint Details
- Endpoint:
/api/general-info/get-current-clinic-visits
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure that the token is valid and has the necessary permissions to access the endpoint.
Query Parameters
The following query parameters can be used to filter the results:
Parameter | Type | Required | Description |
---|---|---|---|
school_id |
Integer | No | Filter clinic visits by school ID. |
Example Request
Here’s how to call the API:
{ "school_id": 1 }
Response
The API responds with a JSON object containing a success flag and an array of clinic visit details. Below is the response structure:
[ { "respondent_id": 1, "respondent_name": "Saurab Kunwar", "in_time": "2021-01-01 00:00:00", "class": "10", "school_name": "Gems", "form_id": 1, "order_no": 1 "form_data": [ { "question": "Patient Note", "answer": "complain of pain in foot, nothing seen like bluish or any sign of injury", "sub_question": [] }, { "question": "Medicine given?", "answer": "Yes", "sub_question": { "question": "What are the medicines?", "answer": "Paracetamol, Aspirin", "sub_question": [] } } ] } ]
Medicine Log/api/medicine/get-medicine-log
The /api/medicine/get-medicine-log
API retrieves details of a respondent's medicine log.
The response includes information about the respondent, the prescribed medicine, dosage details, and the logs of medicine intake.
Endpoint Details
- Endpoint:
/api/medicine/get-medicine-log
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure that the token is valid and has the necessary permissions to access the endpoint.
Query Parameters
The following query parameters can be used to filter the results:
Parameter | Type | Required | Description |
---|---|---|---|
respondent_id |
Integer | No | Filter medicine logs by the respondent's ID. |
Example Request
Here’s how to call the API:
{ "respondent_id": 1 }
Response
The API responds with a JSON object containing details of the respondent and their medicine log. Below is the response structure:
{ "respondent_id": 1, "respondent_name": "John Doe", "class": "10", "medicine_name": "Paracetamol", "dose": "5 mg", "frequency": "BD", "start_date": "2022-01-01", "end_date": "2022-01-31", "inital_time": "08:00", "meal_flag": "1", "logs": [ { "date_time": "2022-01-01 08:00", "done": "1" }, { "date_time": "2022-01-02 08:00", "done": "0" } ] }
Hospital Visit/api/general-info/get-hospital-visits
The /api/general-info/get-hospital-visits
API retrieves details of hospital visits made by respondents.
The response includes the respondent's name, visit date and time, class, reason for the visit, and detailed form data associated with the visit.
Endpoint Details
- Endpoint:
/api/general-info/get-hospital-visits
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure that the token is valid and has the necessary permissions to access the endpoint.
Query Parameters
The following query parameters can be used to filter the results:
Parameter | Type | Required | Description |
---|---|---|---|
respondent_id |
Integer | No | Filter hospital visits by the respondent's ID. |
class_id |
Integer | No | Filter hospital visits by class ID. |
school_id |
Integer | No | Filter hospital visits by school ID. |
Example Request
Here’s how to call the API:
{ "respondent_id": 1, "class_id": 10, "school_id": 1001 }
Response
The API responds with a JSON object containing hospital visit details. Below is the response structure:
[ { "respondent_name": "John Doe", "event_date_and_time": "2020-01-01 10:30:01", "class": "10", "reason": "Injured Leg", "form_name": "Clinic Visit", "form_data": [ { "question": "Patient Note", "answer": "complain of pain in foot, nothing seen like bluish or any sign of injury", "sub_question": [] }, { "question": "Medicine given?", "answer": "Yes", "sub_question": { "question": "What are the medicines?", "answer": "Paracetamol, Aspirin", "sub_question": [] } } ] } ]
Parent Messages/api/message/get-messages
The /api/message/get-messages
API retrieves a list of messages sent by parents.
It provides details such as the parent's name, contact information, the message content, whether a reply was provided, and the reply content.
Endpoint Details
- Endpoint:
/api/message/get-messages
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure that the token is valid and has the necessary permissions to access the endpoint.
Query Parameters
The following query parameters can be used to filter the results:
Parameter | Type | Required | Description |
---|---|---|---|
respondent_id |
Integer | No | Filter messages by the respondent's ID associated with the parent. |
school_id |
Integer | No | Filter messages by the school ID. |
Example Request
Here’s how to call the API:
{ "respondent_id": 1, "school_id": 1001 }
Response
The API responds with a JSON array of parent message details. Below is the response structure:
[ { "respondent_name": "John Doe", "created_at": "2023-01-01 12:00:00", "parent_name": "Harry Doe", "parent_email": "harry@gmail.com", "parent_phone": "9811111111", "message": "Hello, This is test message", "replied": 1, "reply": "This is a test reply" }, { "respondent_name": "John Doe", "created_at": "2023-01-01 12:00:00", "parent_name": "Harry Doe", "parent_email": "harry@gmail.com", "parent_phone": "9811111111", "message": "Hello, This is test message", "replied": 0, "reply": "" } ]
Respondent Profile Information/api/respondent/get-profile-information
The /api/respondent/get-profile-information
API retrieves detailed profile information for a specified respondent.
It includes basic details such as name, gender, blood group, school name, class, religion, and parent contact information.
Endpoint Details
- Endpoint:
/api/respondent/get-profile-information
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure that the token is valid and has the necessary permissions to access the endpoint.
Query Parameters
The following query parameters are required to retrieve the profile information:
Parameter | Type | Required | Description |
---|---|---|---|
respondent_id |
Integer | Yes | Unique identifier for the respondent whose profile information is to be retrieved. |
Example Request
Here’s how to call the API:
{ "respondent_id": 1 }
Response
The API responds with a JSON object containing the respondent's profile details. Below is the response structure:
{ "name": "John Doe", "gender": "male", "blood_group": "A+", "school_name": "Gems", "class": "10", "religion": "hindu", "parents": [ { "name": "Harry Doe", "phone": "9811111111" }, { "name": "Janet Doe", "phone": "98222222" } ] }
Get Chart Meta Data/api/get-chart-data
The /api/get-chart-data
API provides data for generating charts based on predefined forms and metrics.
It supports various chart types (e.g., bar, pie) and includes metadata for each chart such as title, data type, and time frame options.
Endpoint Details
- Endpoint:
/api/get-chart-data
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure that the token is valid and has the necessary permissions to access the endpoint.
Query Parameters
This API does not require any specific query parameters but relies on user authentication for access.
Example Request
Here’s how to call the API:
GET /api/get-chart-data
Response
The API responds with a JSON object containing a list of chart configurations. Below is the response structure:
{ "success": true, "data": [ { "id": 3, "title": "Clinic Visit", "type": "bar", "view_type": "r", "data_type": "T" }, ] }
Response Details
Each object in the data
array represents a chart configuration. Below are the field descriptions:
Field | Type | Description |
---|---|---|
id |
Integer | Unique identifier for the chart. |
title |
String | The title of the chart. |
type |
String | The type of chart (e.g., bar, pie). |
view_type |
String | The type of view the chart supports (e.g., r - for individual respondent d - for dashboard ). |
data_type |
String | The data type used for the chart (T for time-series, C for category). |
Get Chart Data Single/api/get-chart-data-single
The /api/get-chart-data-single
API retrieves chart data based on the specified configuration and filters.
It supports timeline-based (e.g., daily, monthly) or category-based (e.g., pie chart) visualizations.
Endpoint Details
- Endpoint:
/api/get-chart-data-single
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure the token has the necessary permissions to access this endpoint.
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
chart_id |
Integer | Yes | ID of the chart to retrieve data for. |
start_date |
String | No | Start date for the data range (YYYY-MM-DD ). Defaults to the current week if not provided. |
end_date |
String | No | End date for the data range (YYYY-MM-DD ). Defaults to the current week if not provided. |
respondent_id |
Integer | No | Filters the data to a specific respondent's ID. |
range |
String | No |
Groups data by the specified range:
|
Example Request
Here’s an example of how to call the API:
GET /api/get-chart-data-single?chart_id=1&start_date=2024-01-01&end_date=2024-01-31&range=M
Response
The API responds with a JSON object containing chart data. Below is the response structure:
{ "success": true, "data": [ { "label": "Jan-24", "frequency": 15, "extraData": ["Category A (10)", "Category B (5)"], "startDate": "2024-01-01", "endDate": "2024-01-31" }, { "label": "Feb-24", "frequency": 20, "extraData": ["Category C (15)", "Category D (5)"], "startDate": "2024-02-01", "endDate": "2024-02-28" } ] }
Response Details
Below are the field descriptions for the response:
Field | Type | Description |
---|---|---|
label |
String | The label for the data point (e.g., "Jan-24"). |
frequency |
Integer | The frequency of the event or category. |
extraData |
Array | Additional information about the data point (e.g., subcategories with counts). |
startDate |
String | The start date of the range for the data point. |
endDate |
String | The end date of the range for the data point. |
Get Form Data/api/general-info/get-form-data
The /api/general-info/get-form-data
API retrieves the form data based on the specified filters.
It returns details about the form including the respondent’s information, the form data, and associated answers.
The questions are dynamic, meaning they can vary between different forms. Additionally, each question may have sub-questions,
and sub-questions can be as deep as necessary.
Endpoint Details
- Endpoint:
/api/general-info/get-form-data
- Method:
GET
- Authentication: Required
This API requires an authentication token to be included in the request headers. The token must be provided as follows:
Authorization: Bearer {your-auth-token}
Ensure the token has the necessary permissions to access this endpoint.
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
school_id |
Integer | No | Filters the form data to a specific school. |
class_id |
Integer | No | Filters the form data by class ID. |
form_id |
Integer | No | Filters the form data by the specific form ID. |
order_no |
Integer | No | Filters the form data by the order number. |
start_date |
String | No | Start date for the form data range (YYYY-MM-DD ). |
end_date |
String | No | End date for the form data range (YYYY-MM-DD ). |
Example Request
Here’s an example of how to call the API:
GET /api/general-info/get-form-data?school_id=1&start_date=2024-01-01&end_date=2024-01-31
Response
The API responds with a JSON object containing the form data. Below is the response structure:
[ { "respondent_name": "John Doe", "school_name": "Gems", "class": 10, "form_name": "Clinic Visit", "created_at": "2010-01-01 12:00:00", "order_no": 1, "form_id": 8, "form_data": [ { "question": "Patient Note", "answer": "Complaints of pain in the foot, nothing seen like bluish or any sign of injury", "sub_question": [] }, { "question": "Medicine given?", "answer": "Yes", "sub_question": [ { "question": "What are the medicines?", "answer": "Paracetamol, Aspirin", "sub_question": [] } ] } ] } ]
Response Details
Below are the field descriptions for the response:
Field | Type | Description |
---|---|---|
respondent_name |
String | The name of the respondent. |
school_name |
String | The name of the school. |
class |
Integer | The class or grade of the respondent. |
form_name |
String | The name of the form that was filled out (e.g., "Clinic Visit"). |
created_at |
String | The timestamp when the form was created. |
order_no |
Integer | The order number for the form. |
form_id |
Integer | The ID of the form. |
form_data |
Array | An array of questions and answers, with optional sub-questions. |