Created
November 15, 2016 13:52
-
-
Save marianoqueirel/cae04c5616e92b13b7f8a8a5aa0de097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import mongoose from 'mongoose'; | |
const STATUS = ['registered', 'partial', 'final', 'corrected', 'appended', 'cancelled', 'entered-in-error']; | |
const REQUEST = ['DiagnosticOrder', 'ProcedureRequest']; | |
/* | |
* AU -> Audiology | NRS -> Nursing Service Measures | |
* BG -> Blood Gases | OSL -> Outside Lab | |
* BLB -> Blood Bank | OT -> Occupational Therapy | |
* CG -> Cytogenetics | OTH -> Other | |
* CH -> Chemistry | OUS -> OB Ultrasound | |
* CP -> Cytopathology | PF -> Pulmonary Function | |
* CT -> CAT Scan | PHR -> Pharmacy | |
* CTH -> Cardiac Catheterization | PHY -> Physician (Hx.Dx,admission note,etc) | |
* CUS -> Cardiac Ultrasound | PT -> Physical Therapy | |
* EC -> Electrocardiac(e.g.EKG,EEC,Holter) | RAD -> Radiology | |
* EN -> Electroneuro (EEG, EMG,EP,PSG) | RC -> Respiratory Care (therapy) | |
* GE -> Genetics | RT -> Radiation Therapy | |
* HM -> Hematology | RUS -> Radiology Ultrasound | |
* ICU -> Bedside ICU Monitoring | RX -> Radiograph | |
* IMM -> Immunology | SP -> Surgical Pathology | |
* LAB -> Laboratory | SR -> Serology | |
* MB -> Microbiology | TX -> Toxicology | |
* MCB -> Mycobacteriology | VR -> Virology | |
* MYC -> Mycology | VUS -> Vascular Ultrasound | |
* NMR -> Nuclear Magnetic Resonance | XRC -> Cineradiograph | |
* NMS -> Nuclear Medicine Scan | |
*/ | |
const CATEGORY = ['AU', 'BG', 'BLB', 'CG', 'CH', 'CP', 'CT', 'CTH', 'CUS', 'EC', 'EN', 'GE', 'HM', 'ICU', 'IMM', 'LAB', | |
'MB', 'MCB', 'MYC', 'NMR', 'NMS', 'NRS', 'OSL', 'OT', 'OTH', 'OUS', 'PF', 'PHR', 'PHY', 'PT', 'RAD', | |
'RC', 'RT', 'RUS', 'RX', 'SP', 'SR', 'TX', 'VR', 'VUS', 'XRC']; | |
/* | |
* < -> Off scale low | N -> Normal | |
* > -> Off scale high | ND -> Not Detected | |
* A -> Abnormal | NEG -> Negative | |
* AA -> Critically abnormal | NR -> Non-reactive | |
* B -> Better | NS -> Non-susceptible | |
* D -> Significant change down | POS -> Positive | |
* DET -> Detected | R -> Resistant | |
* H -> High | RR -> Reactive | |
* HH -> Critically high | S -> Susceptible | |
* HU -> Very high | SDD -> Susceptible-dose dependent | |
* I -> Intermediate | SYN-R -> Synergy - resistant | |
* IE -> Insufficient evidence | SYN-S -> Synergy - susceptible | |
* IND -> Indeterminate | U -> Significant change up | |
* L -> Low | VS -> Very susceptible. (IFMSO)** | |
* LL -> Critically low | W -> Worse | |
* LU -> Very low | WR -> Weakly reactive | |
* MS -> Moderately susceptible (IFMSO)** | | |
** IFMSO: Indicates for microbiology susceptibilities only | |
*/ | |
const INTERPRETATION = ["<", ">", "A", "AA", "B", "D", "DET", "H", "HH", "HU", "I", "IE", "IND", "L", "LL", "LU", "MS", | |
"N", "ND", "NEG", "NR", "NS", "POS", "R", "RR", "S", "SDD", "SYN-R", "SYN-S", "U", "VS", "W", "WR"]; | |
const ObservationSchema = new mongoose.Schema({ | |
//TODO loinc codes for Observation codes. | |
code: {type: mongoose.Schema.Types.ObjectId, ref: 'ObservationCode'}, | |
effective: {type: Date}, | |
//TODO Decide whether a single type of value is going, or is flexible and Unit. | |
value: {type: String}, | |
interpretation: {type: String, enum: INTERPRETATION}, | |
comments: {type: String}, | |
// TODO get codes from https://www.hl7.org/fhir/valueset-observation-methods.html | |
method: {type: String} | |
}); | |
const SpecimenSchema = new mongoose.Schema({}); | |
const DiagnosticReportSchema = new mongoose.Schema({ | |
status: {type: String, required: true, enum: STATUS}, | |
category: {type: String, required: true, enum: CATEGORY}, | |
code: {type: mongoose.Schema.Types.ObjectId, ref: 'Procedure', required: true}, | |
subject: {type: mongoose.Schema.Types.ObjectId, ref: 'Patient', required: true}, | |
effectiveDate: {type: Date, required: true}, | |
issued: {type: Date, required: true}, | |
performer: {type: mongoose.Schema.Types.ObjectId, ref: 'Practitioner'}, | |
request: [{ | |
kind: {type: String, enum: REQUEST}, | |
item: {type: mongoose.Schema.Types.ObjectId, refPath: 'request.kind'}, | |
_id: false | |
}], | |
observation: [{type: ObservationSchema}], | |
specimen: [{type: SpecimenSchema}], | |
image: [{link: String, comment: String, _id: false}], | |
conclusion: {type: String}, | |
codedDiagnosis: [{type: mongoose.Schema.Types.ObjectId, ref: 'Disease', _id: false}] | |
}); | |
export default mongoose.model('DiagnosticReport', DiagnosticReportSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment