// ============================================================ // RECORDING MODULES // Where a recording came from, and where its transcript belongs. // // Every recording is kept for 24 hours, so a transcription that fails or comes // back empty can be retried later. Retrying used to hand you the text on the // clipboard and leave you to find the right tab and paste it — which is work // the app already has the answer to: the module was recorded with the audio. // // One table, because three things have to agree about a module: the recorder // that tags the upload, the backup list that labels it, and the retry that // delivers the transcript. They disagreed before — recorders tagged // 'encounter' while the recording-started events said 'enc' — so this also // normalises the aliases rather than leaving each caller to guess. // ============================================================ (function () { var MODULES = { encounter: { tab: 'encounter', target: 'enc-transcript', label: 'Encounter HPI' }, dictation: { tab: 'dictation', target: 'dict-transcript', label: 'Dictation HPI' }, soap: { tab: 'soap', target: 'soap-transcript', label: 'SOAP Note' }, sick: { tab: 'sickvisit', target: 'sick-transcript', label: 'Sick Visit' }, wellvisit: { tab: 'wellvisit', target: 'wv-transcript', label: 'Well Visit' }, ed: { tab: 'ed', target: 'ed-transcript', label: 'ED Encounter' } }; // The short names the recording-started/stopped events have always used, and // the plain ones a person might see in a backup row. var ALIASES = { enc: 'encounter', dict: 'dictation', sickvisit: 'sick', 'sick-visit': 'sick', wv: 'wellvisit', 'well-visit': 'wellvisit', 'ed-encounter': 'ed' }; function normalize(module) { var name = String(module == null ? '' : module).trim().toLowerCase(); return ALIASES[name] || name; } function lookup(module) { return MODULES[normalize(module)] || null; } // A label for a backup row. Unknown modules keep their raw name rather than // being hidden, because an unrecognised one is worth seeing. function label(module) { var entry = lookup(module); if (entry) return entry.label; var name = normalize(module); return name && name !== 'recording' ? name : 'Recording'; } window.RecordingModules = { normalize: normalize, lookup: lookup, label: label, known: function () { return Object.keys(MODULES); } }; }());