You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 12, 2024. It is now read-only.
Set up relationships between healthcare professionals, companies (hospitals, clinics) and patients. Each healthcare professional must be able to be linked to one or more companies, as well as to specific patients.
Tasks & Specs
Model relationships in the database:
Many-to-many relationship between Professional and Company (a professional can be associated with several companies).
Many-to-many relationship between Professional and Patient (a professional can follow several patients and vice versa).
Add methods to models to manage these relationships.
Update CRUD endpoints to allow association with companies and patients:
Enable companies to be selected and managed when creating/updating a professional.
Enable patients to be assigned or removed for a specific professional.
Test associations to ensure that data is correctly linked and retrievable.
Endpoints API for Managing Associations
Associate a Professional with a Company
Endpoint: POST /professionals/{professional_id}/companies
Body:
{
"company_ids": ["1", "2", "3"]
}
Feature:
Associates a professional with the companies listed in company_ids
Be sure to check that company IDs exist before associating them
Associate a Professional with a Patient:
Endpoint: POST /professionals/{professional_id}/patients
Body:
{
"patient_ids": ["2", "3"]
}
Feature:
Associates a professional with patients listed in patient_ids
Be sure to check that patient IDs exist before associating them
Retrieve Companies from a Professional:
Endpoint: GET /professionals/{professional_id}/companies
Functionality:
Returns the list of companies associated with this professional (paginated)
Retrieve Patients from a Professional
Endpoint: GET /professionals/{professional_id}/patients
Functionality:
Returns the list of patients associated with this professional.
Delete an Association between a Professional and a Company
Set up relationships between healthcare professionals, companies (hospitals, clinics) and patients. Each healthcare professional must be able to be linked to one or more companies, as well as to specific patients.
Tasks & Specs
ProfessionalandCompany(a professional can be associated with several companies).ProfessionalandPatient(a professional can follow several patients and vice versa).Endpoints API for Managing Associations
POST /professionals/{professional_id}/companies{ "company_ids": ["1", "2", "3"] }company_idsPOST /professionals/{professional_id}/patients{ "patient_ids": ["2", "3"] }patient_idsGET /professionals/{professional_id}/companiesGET /professionals/{professional_id}/patientsDELETE /professionals/{professional_id}/companies/{company_id}DELETE /professionals/{professional_id}/patients/{patient_id}Data validation
company_idsandpatient_idsIDs sent actually exist in the corresponding tables.Unit and Integration Testing
Deliverables
API endpoints created to manage associations.