Skip to content

Instantly share code, notes, and snippets.

View themakshter's full-sized avatar
💭
:shipit:

Mohammad Ali Khan themakshter

💭
:shipit:
View GitHub Profile
function generateDummyReadings(){
return {
peep: getRandomValue(10),
peakPressure: getRandomValue(100, 100),
patientRate: getRandomValue(220),
vte: getRandomValue(700),
inspiratoryTime: getRandomValue(3),
expiratoryTime: getRandomValue(5),
oxygen: getRandomValue(100),
flow: getRandomValue(30, 10)
export default function dummyDataGenerator(updateReadingStateFunction) {
let intervalFunction;
function getRandomValue(range, valueToSubtract = 0) {
return Math.round(Math.random() * range - valueToSubtract);
}
function generateDummyReadings() {
return {
peep: getRandomValue(10),
const Alarms = [
'Battery in Use',
'Circuit Integrity Failed',
'High Respiratory Rate',
'High FiO2',
'High PEEP',
'High Plateau Pressure',
'High Peak Pressure',
'Low Inspiratory Pressure',
'Low FiO2',
@themakshter
themakshter / ventilationModeParser.ts
Created May 9, 2020 19:03
Ventilation Mode Parser
const VentilationModes = ['VCV', 'PCV', 'AC-VCV', 'AC-PCV', 'CPAP'];
const ventilationMode = getVentilationMode(Data[29]);
function getVentilationMode(valueToParse: number): string {
// 0x1C is 00011100 so we find the values contain in bits 2-4
// we also want the index to retrieve the correct mode from our array
// so we shift the bits to the end to get the actual value
const ventilationModeIndex = (valueToParse & 0x1C) >> 2;
return VentilationModes[ventilationModeIndex];