Skip to content

Instantly share code, notes, and snippets.


Mohammad Ali Khan themakshter

View GitHub Profile
View ventilationModeParser.ts
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];
View alarmParser.ts
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',
View dummy-data-generator.js
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),
View random-value-generator.js
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)