Organisation — Documentation Outline¶
1. Overview¶
- What an Organisation is
- Real-world examples (hospital team, GP practice, private clinic)
- Relationship to staff and patients
2. Data Model¶
Organisationtableorganisation_staff_memberjoin tableorganisation_patient_memberjoin table- Rationale for two separate join tables (GDPR / data segregation)
3. FHIR Mapping¶
OrganizationresourcePractitionerRolefor staff membershipPatient.managingOrganizationandCareTeamfor patient membership
4. Business Rules¶
- Staff and patients can belong to zero or more Organisations
is_primaryon staff membership — default login landing contextis_primaryon patient membership — primary responsible Organisation- Organisation types:
hospital_team | gp_practice | private_clinic | department | teaching_establishment
5. API Endpoints¶
All endpoints are admin-only (admin or superadmin system permissions required). The API uses the American spelling organizations for FHIR alignment.
GET /api/organizations— list all organisationsPOST /api/organizations— create organisationGET /api/organizations/{id}— retrieve organisation with staff/patient lists and countsPUT /api/organizations/{id}— update organisationPOST /api/organizations/{id}/staff— add staff memberPOST /api/organizations/{id}/patients— add patientDELETE /api/organizations/{id}/staff/{userId}— remove staff member (requires CSRF)DELETE /api/organizations/{id}/patients/{patientId}— remove patient (requires CSRF)
6. Permissions & Access¶
- All organisation CRUD operations require admin or superadmin system permissions
- Mutating operations (DELETE) require CSRF token validation
is_primarystaff membership controls default Organisation on login
7. Naming Convention¶
Organizationin code/API (FHIR-aligned)Organisationin UI (British spelling)
8. Out of Scope (Future)¶
- Nested / federated Organisation hierarchies
- Ward sub-groups
- Clinic lists
- Organisation-level access policies