Type sketch (not implemented)
Usage first — see rationale. Bodies stay unimplemented until a feature is requested.
Account { id, phone, email?, roles: Role[] }
Role = PATIENT | CLINICIAN | IMAGING | LAB | ADMIN
PatientProfile { accountId, displayName }
ClinicianProfile { accountId, specialty }
Appointment { id, patientId, clinicianId, slot, status }
Encounter { id, appointmentId, notes }
DiagnosticKind = IMAGING | LAB
DiagnosticOrder { id, encounterId?, patientId, kind, status }
DiagnosticResult { id, orderId, summary, artifactUri? }
Consent { accountId, purpose, grantedAt }
IdentityService
requestOtp(phone) -> void
verifyOtp(phone, code) -> Session
me(session) -> Account
BookingService
listAppointments(session) -> Appointment[]
requestAppointment(session, clinicianId, slot) -> Appointment
AgendaService
clinicianAgenda(session, day) -> Appointment[]
writeEncounterNote(session, encounterId, notes) -> Encounter
DiagnosticsService
worklist(session, kind) -> DiagnosticOrder[]
submitResult(session, orderId, result) -> DiagnosticResult
resultsForPatient(session, patientId) -> DiagnosticResult[]
Invariants: a patient cannot write DiagnosticResult. Only an ADMIN role opens the admin shell. kind is the only imaging-vs-lab split on the write API.