import type { IValueSet } from '../services/ValueSetService.tsx'; export const AKASHIC_ORGANIZATION_ROLE_SYSTEM = 'https://akashichealthrecords.com/fhir/CodeSystem/organization-role'; export const AKASHIC_LEADERSHIP_DESIGNATION_SYSTEM = 'https://akashichealthrecords.com/fhir/CodeSystem/leadership-designation'; export const AKASHIC_TRAINING_LEVEL_SYSTEM = 'https://akashichealthrecords.com/fhir/CodeSystem/training-level'; export const PRIMARY_ORGANIZATION_ROLE_EXTENSION_URL = 'https://akashichealthrecords.com/fhir/StructureDefinition/practitioner-role-primary-role'; export const LEADERSHIP_DESIGNATION_EXTENSION_URL = 'https://akashichealthrecords.com/fhir/StructureDefinition/practitioner-role-leadership-designation'; export const TRAINING_LEVEL_EXTENSION_URL = 'https://akashichealthrecords.com/fhir/StructureDefinition/practitioner-role-training-level'; export type StaffWorkspaceKey = | 'Practitioners' | 'Receptionists' | 'PlatformManagers' | 'Admins'; export type StaffWorkspaceOption = { key: StaffWorkspaceKey; name: string; description: string; }; export const STAFF_WORKSPACES: StaffWorkspaceOption[] = [ { key: 'Practitioners', name: 'Practitioner', description: 'Clinical workspace for physicians, nurses, and other care-team members.', }, { key: 'Receptionists', name: 'Receptionist', description: 'Front-desk workspace for appointments, patients, and communications.', }, { key: 'Admins', name: 'Admin', description: 'Organization administration workspace for staff, services, and settings.', }, { key: 'PlatformManagers', name: 'Platform Manager', description: 'Platform-level workspace for shared content and platform operations.', }, ]; export type OrganizationRoleFamily = | 'physician-medical' | 'nursing-advanced-practice' | 'clinical-support-allied-health' | 'administrative-operations'; export type OrganizationRoleOption = IValueSet & { family: OrganizationRoleFamily; clinical: boolean; }; export type OrganizationRoleGroup = { label: string; family: OrganizationRoleFamily; items: OrganizationRoleOption[]; }; const organizationRole = ( code: string, display: string, family: OrganizationRoleFamily, clinical: boolean, ): OrganizationRoleOption => ({ system: AKASHIC_ORGANIZATION_ROLE_SYSTEM, code, display, family, clinical, }); export const ORGANIZATION_ROLE_GROUPS: OrganizationRoleGroup[] = [ { label: 'Physician & Medical', family: 'physician-medical', items: [ organizationRole('physician', 'Physician', 'physician-medical', true), organizationRole('attending-physician', 'Attending Physician', 'physician-medical', true), organizationRole('hospitalist', 'Hospitalist', 'physician-medical', true), organizationRole('fellow', 'Fellow', 'physician-medical', true), organizationRole('resident-physician', 'Resident Physician', 'physician-medical', true), organizationRole('medical-student', 'Medical Student', 'physician-medical', true), ], }, { label: 'Nursing & Advanced Practice', family: 'nursing-advanced-practice', items: [ organizationRole('nurse-practitioner', 'Nurse Practitioner', 'nursing-advanced-practice', true), organizationRole('registered-nurse', 'Registered Nurse', 'nursing-advanced-practice', true), organizationRole('licensed-practical-nurse', 'Licensed Practical Nurse', 'nursing-advanced-practice', true), organizationRole('licensed-vocational-nurse', 'Licensed Vocational Nurse', 'nursing-advanced-practice', true), organizationRole('certified-nursing-assistant', 'Certified Nursing Assistant', 'nursing-advanced-practice', true), ], }, { label: 'Clinical Support & Allied Health', family: 'clinical-support-allied-health', items: [ organizationRole('medical-assistant', 'Medical Assistant', 'clinical-support-allied-health', true), organizationRole('physician-assistant', 'Physician Assistant', 'clinical-support-allied-health', true), organizationRole('pharmacist', 'Pharmacist', 'clinical-support-allied-health', true), organizationRole('therapist', 'Therapist', 'clinical-support-allied-health', true), organizationRole('social-worker', 'Social Worker', 'clinical-support-allied-health', true), organizationRole('dietitian', 'Dietitian', 'clinical-support-allied-health', true), organizationRole('laboratory-professional', 'Laboratory Professional', 'clinical-support-allied-health', true), organizationRole('radiology-professional', 'Radiology Professional', 'clinical-support-allied-health', true), organizationRole('medical-scribe', 'Medical Scribe', 'clinical-support-allied-health', true), organizationRole('care-coordinator', 'Care Coordinator', 'clinical-support-allied-health', true), ], }, { label: 'Administrative & Operations', family: 'administrative-operations', items: [ organizationRole('receptionist', 'Receptionist', 'administrative-operations', false), organizationRole('healthcare-administrator', 'Healthcare Administrator', 'administrative-operations', false), organizationRole('practice-manager', 'Practice Manager', 'administrative-operations', false), organizationRole('human-resources', 'Human Resources', 'administrative-operations', false), organizationRole('scheduling-coordinator', 'Scheduling Coordinator', 'administrative-operations', false), organizationRole('billing-specialist', 'Billing Specialist', 'administrative-operations', false), organizationRole('information-technology', 'Information Technology', 'administrative-operations', false), ], }, ]; export const ORGANIZATION_ROLE_OPTIONS = ORGANIZATION_ROLE_GROUPS.flatMap( (group) => group.items, ); export const LEADERSHIP_DESIGNATIONS: IValueSet[] = [ { system: AKASHIC_LEADERSHIP_DESIGNATION_SYSTEM, code: 'medical-director', display: 'Medical Director', }, { system: AKASHIC_LEADERSHIP_DESIGNATION_SYSTEM, code: 'head-of-department', display: 'Head of Department', }, { system: AKASHIC_LEADERSHIP_DESIGNATION_SYSTEM, code: 'lead-physician', display: 'Lead Physician', }, { system: AKASHIC_LEADERSHIP_DESIGNATION_SYSTEM, code: 'chief-resident', display: 'Chief Resident', }, { system: AKASHIC_LEADERSHIP_DESIGNATION_SYSTEM, code: 'nurse-administrator', display: 'Nurse Administrator', }, { system: AKASHIC_LEADERSHIP_DESIGNATION_SYSTEM, code: 'clinical-nurse-manager', display: 'Clinical Nurse Manager', }, ]; export const TRAINING_LEVELS: IValueSet[] = [ { system: AKASHIC_TRAINING_LEVEL_SYSTEM, code: 'pgy-1', display: 'PGY-1' }, { system: AKASHIC_TRAINING_LEVEL_SYSTEM, code: 'pgy-2', display: 'PGY-2' }, { system: AKASHIC_TRAINING_LEVEL_SYSTEM, code: 'pgy-3', display: 'PGY-3' }, { system: AKASHIC_TRAINING_LEVEL_SYSTEM, code: 'pgy-4', display: 'PGY-4' }, { system: AKASHIC_TRAINING_LEVEL_SYSTEM, code: 'pgy-5', display: 'PGY-5' }, { system: AKASHIC_TRAINING_LEVEL_SYSTEM, code: 'pgy-6', display: 'PGY-6' }, { system: AKASHIC_TRAINING_LEVEL_SYSTEM, code: 'pgy-7-plus', display: 'PGY-7+' }, ]; export const TRAINING_ROLE_CODES = new Set(['resident-physician', 'fellow']); export const getCustomOrganizationRoleSystem = (organizationId?: string) => `${AKASHIC_ORGANIZATION_ROLE_SYSTEM}/${organizationId || 'organization-defined'}`; export const slugifyOrganizationRole = (value: string) => value .trim() .toLocaleLowerCase() .replace(/[^a-z0-9]+/g, '-') .replace(/^-+|-+$/g, ''); export const isClinicalOrganizationRole = (role?: IValueSet) => { if (!role) { return false; } return ORGANIZATION_ROLE_OPTIONS.some( (option) => option.system === role.system && option.code === role.code && option.clinical, ); };