Hardware components | ||||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
Software apps and online services | ||||||
![]() |
|
1 / 8 • Title
Voltage reader and Calculator
C/C++This uses a particle photon to read an analog voltage from the galvanic cell and converts these voltages with a formula to find the concentration of IAIP.
#include <math.h>
# define EULER 2.718281828459045235360287471352
# define VCONST 0.012779
int pin = A5;
int voltRaw = 0;
double voltage = 0;
double conc = 0;
bool hasRun = false;
double simVolts[2] = {0.008, 0.01};
void setup() {
pinMode(pin, INPUT);
pinMode(D7, OUTPUT);
}
void loop() {
//voltRaw = analogRead(A5);
//voltage = voltRaw/4095 * 3;
if(!hasRun) {
runSim();
hasRun = true;
}
}
void runSim() {
for(int i=0; i<sizeof(simVolts)/sizeof(double); i++) {
voltage = simVolts[i];
Particle.publish("Voltage:", String(voltage), 60, PRIVATE);
delay(2000);
}
conc = 0.4375 * pow(EULER, (simVolts[0]-simVolts[sizeof(simVolts)/sizeof(double) - 1]/VCONST));
Particle.publish("IAIP Concentration:", String(conc)+" Micg/ml", 60, PRIVATE);
}
Mortality Rate Finder
JavaUsing IAIP data from photon, we used multivariable regression to establish a relationship between mortality rates and the prognostic factors.
public class MortalityRateFinder {
private int SIRSval;
private double DICval;
private double MODSval;
private double IAIPval;
public MortalityRateFinder(int patientSIRS, int patientDIC, double patientMODS, double patientIAIPval) {
SIRSval = patientSIRS;
DICval = patientDIC;
MODSval = patientMODS;
IAIPval = patientIAIPval;
}
public int getSIRS() {return SIRSval;}
public double getDIC() {return DICval;}
public double getMODS() {return MODSval;}
public double getIAIP() {return IAIPval;}
public double calcMortality() {
double mortality = 2.32565811*SIRSval + 0.930263244*DICval + 0.186052649*(MODSval/100) + 6.51184271*IAIPval;
// Formula generated through parsing csv. files (n=6) on pubmed publications for data and using multivariable regression to find correlation between variables and the mortality rates. Algorithm tested on known data from other pubmed publications (n=5) with mean absolute deviation of 3.94 +/- 1.82% for mortality rates
return (int)(mortality*100)/100.0;
}
public String toString() {
if(calcMortality() <= 20) {
return "\nMortality = " + calcMortality() + "%";
}else {
return "\nMortality = " + calcMortality() +"%\nYOU ARE AT HIGH RISK OF DEATH";
}
}
}
Mortality Rate Finder Runner Class
JavaGathers input from the physician and uses Mortality Rate Finder class to calculate mortality rates.
import java.util.*;
public class MetrohacksRun {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("Please enter your SIRS value (<= 5): ");
int SIRS = console.nextInt();
System.out.print("\nPlease enter your DIC value (<= 6): ");
int DIC = console.nextInt();
System.out.print("\nPlease enter your MODS value (<= 100): ");
double MODS = console.nextDouble();
System.out.print("\nPlease enter your IAIP (<=1): ");
double IAIPval = console.nextDouble();
MortalityRateFinder patient = new MortalityRateFinder(SIRS, DIC, MODS, IAIPval);
System.out.println(patient);
}
}
Comments