First
This commit is contained in:
14
frontend/src/routes/chart/[mrn]/+layout.js
Normal file
14
frontend/src/routes/chart/[mrn]/+layout.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { get_api_lookup } from '$lib/backend.js';
|
||||
|
||||
/** @type {import('./$types').LayoutLoad} */
|
||||
export async function load({ params, fetch }) {
|
||||
const mrn = params.mrn;
|
||||
const facesheet = await get_api_lookup({ fetch, query: mrn, ordinal: '0', force: true });
|
||||
const match = /^(?<name>[^\r\n;]+);(?:\((?<alias>[^\)]*?)\))? (?:(?<icn>\d+) )?(?<ssn>\d{3}-\d{2}-\d{4}P?) (?<dob>.+?)\s*$/m.exec(facesheet);
|
||||
const facesheet_data = match ? match.groups : {};
|
||||
const m_sex = /^Birth Sex[ ]+:[ ]+(.+?)$/m.exec(facesheet);
|
||||
if(m_sex) facesheet_data.sex = m_sex[1];
|
||||
return {
|
||||
mrn, sensitive: facesheet.includes('***RESTRICTED RECORD***'), facesheet, facesheet_data
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user