Logo Lanfrica

davidsolomonyoyo-code/Pulse-Flow

Domain:

healthcare

Record type:

software
Creator:
dav
Host:
Patient-flow orchestration platform for hospitals — triage, queueing, scheduling, and capacity coordination, built phase-by-phase starting with a Kenya-deployment-first MVP. /** * Minimal starter template set. Locale field exists on every notification * record from day one per docs/KENYA_CONTEXT.md Section 5 — English and * Swahili are both first-class, not English-with-Swahili-bolted-on-later. * * {placeholders} are substituted from SendNotificationRequest.variables. */ export const TEMPLATES: Record > = { queue_position_update: { en: 'PulseFlow: You are now position {position} in the queue at {facilityName}. Estimated wait: {estimatedWaitMinutes} min.', sw: 'PulseFlow: Sasa uko nafasi ya {position} kwenye foleni katika {facilityName}. Muda wa kusubiri unaokadiriwa: dakika {estimatedWaitMinutes}.', }, appointment_confirmed: { en: 'PulseFlow: Your appointment at {facilityName} is confirmed for {appointmentTime}.', sw: 'PulseFlow: Miadi yako katika {facilityName} imethibitishwa kwa {appointmentTime}.', }, queue_called: { en: 'PulseFlow: Please proceed to {facilityName} reception now — you are being called.', sw: 'PulseFlow: Tafadhali enda kwenye mapokezi ya {facilityName} sasa — unaitwa.', }, }; export function renderTemplate( templateKey: string, locale: 'en' | 'sw', variables: Record , ): string { const templateSet = TEMPLATES[templateKey]; if (!templateSet) { throw new Error(`Unknown notification template: ${templateKey}`); } // Fall back to English if a translation is genuinely missing — better // than sending nothing, but this should be a temporary state, not a // permanent crutch for skipping translation work. const raw = templateSet[locale] ?? templateSet.en; return raw.replace(/\{(\w+)\}/g, (match, key) => key in variables ? variables[key] : match, ); }

Languages