# Patients
The Patients API is designed to manage patient profiles, including creation, retrieval, updating, and deletion. Each patient profile can be linked to a Profile and associated with hospitals and doctors using their unique_id values. The API supports nested Profile creation or association and allows adding hospitals and doctors by their unique IDs. Note that the ProfileSerializer requires a unique_id for association or creation; you cannot just provide email and names.
# Get Patient List
Retrieve a list of all patients.
- URL:
patients/patients/ - Method:
GET - Response Example:
[ { "unique_id": "pat123", "patient_profile": { "unique_id": "prof123", "email": "user@example.com", "first_name": "John", "last_name": "Doe" }, "patient_email_address": "patient@example.com", "patient_mobile_number": "+123456789", "patient_title": "Mr.", "patient_first_name": "John", "patient_initials": "J", "patient_last_name": "Doe", "patient_date_of_birth": "1980-01-01", "patient_gender": "Male", "patient_race": "Caucasian", "patient_physical_address": "123 Street Name", "patient_address_line_1": "Apt 101", "patient_town": "Sample Town", "patient_region": "Sample Region", "patient_province": "Sample Province", "patient_country": "Sample Country", "patient_postal_code": "12345", "patient_latitude": "12.345678", "patient_longitude": "-12.345678", "patient_access_medical_care": "Public", "patient_hospital": [ { "unique_id": "hos123", "hospital_name": "General Hospital" } ], "patient_doctor": [ { "unique_id": "doc123", "doctor_first_name": "Dr. Smith" } ], "date_created": "2023-01-01T12:00:00Z", "last_updated": "2023-01-01T12:00:00Z" } ]
# Create a Patient
Create a new patient profile. A new Profile will be created or an existing one associated if profile details are provided. Use hospital_ids and doctor_ids to associate the patient with existing hospitals and doctors by their unique_id.
- URL:
patients/patients/ - Method:
POST - Request Example:
{ "patient_profile": { "unique_id": "prof123", "email": "user@example.com", "first_name": "John", "last_name": "Doe" }, "patient_email_address": "patient@example.com", "patient_mobile_number": "+123456789", "patient_title": "Mr.", "patient_first_name": "John", "patient_initials": "J", "patient_last_name": "Doe", "patient_date_of_birth": "1980-01-01", "patient_gender": "Male", "patient_race": "Caucasian", "patient_physical_address": "123 Street Name", "patient_address_line_1": "Apt 101", "patient_town": "Sample Town", "patient_region": "Sample Region", "patient_province": "Sample Province", "patient_country": "Sample Country", "patient_postal_code": "12345", "patient_latitude": "12.345678", "patient_longitude": "-12.345678", "patient_access_medical_care": "Public", "hospital_ids": ["hos123", "hos456"], "doctor_ids": ["doc123"] } - Response Example:
{ "unique_id": "pat123", "patient_profile": { "unique_id": "prof123", "email": "user@example.com", "first_name": "John", "last_name": "Doe" }, "patient_email_address": "patient@example.com", "patient_mobile_number": "+123456789", "patient_title": "Mr.", "patient_first_name": "John", "patient_initials": "J", "patient_last_name": "Doe", "patient_date_of_birth": "1980-01-01", "patient_gender": "Male", "patient_race": "Caucasian", "patient_physical_address": "123 Street Name", "patient_address_line_1": "Apt 101", "patient_town": "Sample Town", "patient_region": "Sample Region", "patient_province": "Sample Province", "patient_country": "Sample Country", "patient_postal_code": "12345", "patient_latitude": "12.345678", "patient_longitude": "-12.345678", "patient_access_medical_care": "Public", "patient_hospital": [ { "unique_id": "hos123", "hospital_name": "General Hospital" } ], "patient_doctor": [ { "unique_id": "doc123", "doctor_first_name": "Dr. Smith" } ], "date_created": "2023-01-01T12:00:00Z", "last_updated": "2023-01-01T12:00:00Z" }
# Get a Patient
Retrieve details of a specific patient by their unique ID.
- URL:
patients/patients/<str:unique_id>/ - Method:
GET - Response Example:
{ "unique_id": "pat123", "patient_profile": { "unique_id": "prof123", "email": "user@example.com", "first_name": "John", "last_name": "Doe" }, "patient_email_address": "patient@example.com", "patient_mobile_number": "+123456789", "patient_title": "Mr.", "patient_first_name": "John", "patient_initials": "J", "patient_last_name": "Doe", "patient_date_of_birth": "1980-01-01", "patient_gender": "Male", "patient_race": "Caucasian", "patient_physical_address": "123 Street Name", "patient_address_line_1": "Apt 101", "patient_town": "Sample Town", "patient_region": "Sample Region", "patient_province": "Sample Province", "patient_country": "Sample Country", "patient_postal_code": "12345", "patient_latitude": "12.345678", "patient_longitude": "-12.345678", "patient_access_medical_care": "Public", "patient_hospital": [ { "unique_id": "hos123", "hospital_name": "General Hospital" } ], "patient_doctor": [ { "unique_id": "doc123", "doctor_first_name": "Dr. Smith" } ], "date_created": "2023-01-01T12:00:00Z", "last_updated": "2023-01-01T12:00:00Z" }
# Update a Patient
Update an existing patient by unique ID. This allows modifying the associated profile details, hospitals, and doctors.
- URL:
patients/patients/<str:unique_id>/ - Method:
PUT - Request Example:
{ "patient_mobile_number": "+987654321", "patient_race": "African", "patient_province": "New Province", "hospital_ids": ["hos789"], "doctor_ids": ["doc456"] } - Response Example:
{ "unique_id": "pat123", "patient_profile": { "unique_id": "prof123", "email": "user@example.com", "first_name": "John", "last_name": "Doe" }, "patient_email_address": "patient@example.com", "patient_mobile_number": "+987654321", "patient_title": "Mr.", "patient_first_name": "John", "patient_initials": "J", "patient_last_name": "Doe", "patient_date_of_birth": "1980-01-01", "patient_gender": "Male", "patient_race": "African", "patient_physical_address": "123 Street Name", "patient_address_line_1": "Apt 101", "patient_town": "Sample Town", "patient_region": "Sample Region", "patient_province": "New Province", "patient_country": "Sample Country", "patient_postal_code": "12345", "patient_latitude": "12.345678", "patient_longitude": "-12.345678", "patient_access_medical_care": "Public", "patient_hospital": [ { "unique_id": "hos789", "hospital_name": "New Hospital" } ], "patient_doctor": [ { "unique_id": "doc456", "doctor_first_name": "Dr. Adams" } ], "date_created": "2023-01-01T12:00:00Z", "last_updated": "2023-01-01T12:00:00Z" }
# Delete a Patient
Delete a patient by their unique ID.
- URL:
patients/patients/<str:unique_id>/ - Method:
DELETE - Response:
204 No Content
← Profile Conversations →