"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getVitalsName = exports.vitalsNameMap = exports.vitalsNameUnitMap = exports.vitalTypesGrouped = void 0;

var _question = require("./question");

const vitalTypesGrouped = [{
  id: 'bp',
  name: 'Blood Pressure',
  includeInComparison: true,
  includeInAuto: true,
  subItems: [{
    id: 'sbp',
    name: 'Systolic Blood Pressure',
    chartName: 'SBP',
    startValue: 120,
    unit: 'mmHg'
  }, {
    id: 'dbp',
    name: 'Diastolic Blood Pressure',
    chartName: 'DBP',
    startValue: 80,
    unit: 'mmHg'
  }, {
    id: 'map',
    name: 'Mean Arterial Pressure',
    chartName: 'MAP',
    startValue: 90,
    unit: 'mmHg'
  }]
}, {
  id: 'hr',
  name: 'Heart Rate',
  chartName: 'HR',
  includeInComparison: true,
  includeInAuto: true,
  startValue: 80,
  unit: 'bpm'
}, {
  id: 'spo2',
  name: 'Oxygen saturation',
  chartName: 'SpO₂',
  includeInComparison: true,
  includeInAuto: true,
  startValue: 100,
  max: 100,
  min: 50,
  unit: '%',
  table: true
}, {
  id: 'ecg',
  name: 'ECG Rhythm',
  chartName: 'ECG',
  manualNote: 'This value is "auto-recorded" from previous value unless changed.',
  startValue: 'NSR',
  fillFromPrevious: true,
  choices: ['NSR', 'ST', 'SB', 'A-Fib', 'A-Flutter'].map(val => (0, _question.choice)(val, val)),
  table: true
}, {
  id: 'rr',
  name: 'Respiration Rate',
  chartName: 'RR',
  includeInComparison: true,
  includeInAuto: true,
  startValue: 16,
  unit: 'R/min',
  min: 0
}, {
  id: 'temp',
  name: 'Temperature',
  chartName: 'Temp',
  includeInAuto: true,
  startValue: 98.7,
  step: 0.1,
  min: 0,
  unit: '°F',
  table: true
}, {
  id: 'fico2',
  name: 'F.I. CO₂',
  chartName: 'FiCO₂',
  includeInAuto: true,
  startValue: 2,
  unit: 'mmHg',
  table: true
}, {
  id: 'etco2',
  name: 'E.T. CO₂',
  chartName: 'EtCO₂',
  includeInComparison: true,
  includeInAuto: true,
  startValue: 40,
  unit: 'mmHg',
  table: true
}, // {
//   id: 'fico2p',
//   name: 'F.I. CO₂ %',
//   chartName: 'FiCO₂',
//   includeInAuto: true,
//   startValue: 1,
//   step: 0.1,
//   unit: '%',
//   table: true,
// },
// {
//   id: 'etco2p',
//   name: 'E.T. CO₂ %',
//   chartName: 'EtCO₂',
//   includeInComparison: true,
//   includeInAuto: true,
//   startValue: 6,
//   step: 0.1,
//   unit: '%',
//   table: true,
// },
{
  id: 'fio2',
  name: 'F.I. O₂',
  chartName: 'FiO₂',
  includeInAuto: true,
  startValue: 21,
  max: 1500,
  min: 0,
  // We don't specify a unit here because
  // it could be either mmHg or %
  unit: '',
  table: true
}, {
  id: 'eto2',
  name: 'E.T. O₂',
  chartName: 'EtO₂',
  includeInAuto: true,
  startValue: 70,
  max: 1500,
  min: 0,
  // We don't specify a unit here because
  // it could be either mmHg or %
  unit: '',
  table: true
}, {
  id: 'fin2o',
  name: 'F.I. N₂O',
  chartName: 'FiN₂O',
  includeInAuto: true,
  startValue: 50,
  max: 1500,
  min: 0,
  // We don't specify a unit here because
  // it could be either mmHg or %
  unit: '',
  table: true
}, {
  id: 'etn2o',
  name: 'E.T. N₂O',
  chartName: 'EtN₂O',
  includeInAuto: true,
  startValue: 45,
  max: 1500,
  min: 0,
  // We don't specify a unit here because
  // it could be either mmHg or %
  unit: '',
  table: true
}, {
  id: 'fisev',
  name: 'F.I. Sevoflurane',
  chartName: 'FiSev',
  includeInAuto: true,
  startValue: 0,
  step: 0.01,
  min: 0,
  unit: '%',
  table: true
}, {
  id: 'etsev',
  name: 'E.T. Sevoflurane',
  chartName: 'EtSev',
  includeInAuto: true,
  startValue: 0,
  step: 0.01,
  min: 0,
  unit: '%',
  table: true
}, {
  id: 'fides',
  name: 'F.I. Desflurane',
  chartName: 'FiDes',
  includeInAuto: true,
  startValue: 0,
  step: 0.01,
  min: 0,
  unit: '%',
  table: true
}, {
  id: 'etdes',
  name: 'E.T. Desflurane',
  chartName: 'EtDes',
  includeInAuto: true,
  startValue: 0,
  step: 0.01,
  min: 0,
  unit: '%',
  table: true
}, {
  id: 'fiiso',
  name: 'F.I. Isoflurane',
  chartName: 'FiIso',
  includeInAuto: true,
  startValue: 0,
  step: 0.01,
  min: 0,
  unit: '%',
  table: true
}, {
  id: 'etiso',
  name: 'E.T. Isoflurane',
  chartName: 'EtIso',
  includeInAuto: true,
  startValue: 0,
  step: 0.01,
  min: 0,
  unit: '%',
  table: true
}, {
  id: 'mac',
  name: 'MAC',
  chartName: 'MAC',
  includeInAuto: true,
  startValue: 0.43,
  step: 0.01,
  min: 0,
  table: true
}, // {
//   id: 'pi',
//   name: 'Perfusion Index',
//   chartName: 'PI',
//   includeInAuto: true,
//   startValue: 8,
//   step: 0.1,
//   min: 0,
//   max: 100,
//   unit: '%',
//   table: true,
// },
{
  id: 'peep',
  name: 'PEEP',
  chartName: 'PEEP',
  manualNote: 'This value is "auto-recorded" from previous value unless changed.',
  step: 0.1,
  unit: 'cmH₂O',
  min: 0,
  startValue: 4,
  table: true,
  fillFromPrevious: true
}, {
  id: 'pip',
  name: 'PIP',
  chartName: 'PIP',
  // manualNote:
  //   'This value is "auto-recorded" from previous value unless changed.',
  step: 1,
  unit: 'cmH₂O',
  min: 0,
  startValue: 20,
  table: true // fillFromPrevious: true,

}, {
  id: 'tv',
  name: 'Tidal Volume',
  chartName: 'Tidal Volume',
  step: 1,
  unit: 'mL',
  min: 0,
  max: 10000,
  startValue: 500,
  table: true
}, {
  id: 'RSS',
  name: 'Ramsay Sedation Scale',
  chartName: 'Sed. Level (RSS)',
  startValue: 2,
  min: 1,
  max: 6,
  table: true
}, {
  id: 'GCS',
  name: 'Glasgow Coma Scale',
  chartName: 'Sed. Level (GCS)',
  startValue: 15,
  min: 3,
  max: 15,
  table: true
}, {
  id: 'ESS',
  name: 'Ellis Sedation Score',
  chartName: 'Sed. Level (ESS)',
  startValue: 0,
  min: -5,
  max: 4,
  table: true
}];
exports.vitalTypesGrouped = vitalTypesGrouped;
const vitalsNameUnitMap = vitalTypesGrouped.reduce((res, monitor) => {
  const {
    id,
    chartName,
    name,
    unit
  } = monitor;

  if (id !== 'bp' && !res[id]) {
    res[id] = [chartName || name, unit];
  }

  return res;
}, // start w/ BP ones
{
  sbp: ['SBP'],
  dbp: ['DBP'],
  map: ['MAP'],
  temp: ['Temp']
});
exports.vitalsNameUnitMap = vitalsNameUnitMap;
const vitalsNameMap = Object.entries(vitalsNameUnitMap).reduce((acc, [name, value]) => {
  acc[name] = value[0];
  return acc;
}, {});
exports.vitalsNameMap = vitalsNameMap;

const getVitalsName = key => vitalsNameMap[key];

exports.getVitalsName = getVitalsName;