An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit fff57e0b authored by Aaron Bray's avatar Aaron Bray
Browse files

Add IdealBodyWeight to patient validation, update scenario unit test to read from src now

parent 0770612f
......@@ -21,7 +21,7 @@ public:
public:
void SetName(const std::string& Name);
std::string GetName() const;
std::string GetName() const;
void PerformSuite(bool Performed);
bool PerformedSuite();
......
......@@ -285,7 +285,7 @@ message PericardialEffusionData
message RespiratoryFatigueData
{
PatientActionData PatientAction = 1;
Scalar0To1Data Severity = 2;/**<<@brief Scale of affect, 0 no dyspnea, 1 having apnea. */
Scalar0To1Data Severity = 2;/**<<@brief Scale of affect, 0 no dyspnea, 1 having dyspnea. */
}
message SubstanceBolusStateData
......
......@@ -28,7 +28,7 @@ int main(int argc, char* argv[])
// Pulse Tests //
////////////////////
//peTest.ReadScenarios(peDir);
peTest.ReadScenarios(peDir);
//peTest.CardiovascularCircuitAndTransportTest(peDir);
//peTest.CardiovascularAndRenalCircuitAndTransportTest(peDir);
......
......@@ -54,6 +54,7 @@ public class PatientValidation extends ValidationTool
writer.println("|BodyDensity |"+patient.getBodyDensity());
writer.println("|BodyFatFraction |"+patient.getBodyFatFraction());
writer.println("|LeanBodyMass |"+patient.getLeanBodyMass());
writer.println("|IdealBodyWeight |"+patient.getIdealBodyWeight());
writer.println("|AlveoliSurfaceArea |"+patient.getAlveoliSurfaceArea());
writer.println("|RightLungRatio |"+patient.getRightLungRatio());
writer.println("|SkinSurfaceArea |"+patient.getSkinSurfaceArea());
......
......@@ -180,7 +180,7 @@ void PulseEngineTest::AerosolTest(const std::string& sOutputDirectory)
zhangConcentrations.GetLength().push_back(16.263765); // Boundary 1
zhangConcentrations.GetLength().push_back(25.854805); // Boundary 2
zhangConcentrations.GetLength().push_back(41.101852); // Boundary 3
zhangConcentrations.GetLength().push_back(65.83879); // Boundary 4
zhangConcentrations.GetLength().push_back(65.83879); // Boundary 4
zhangConcentrations.GetLength().push_back(103.87276); // Boundary 5
zhangConcentrations.GetLength().push_back(165.1284); // Boundary 6
zhangConcentrations.GetLength().push_back(260.5203); // Boundary 7
......
......@@ -21,47 +21,68 @@ void PulseEngineTest::ReadScenarios(const std::string& rptDirectory)
subMgr.LoadSubstanceDirectory();
PulseScenario scenario(subMgr);
std::string dir = GetCurrentWorkingDirectory();
dir.append("/verification/scenarios");
std::string line;
std::string sce_dir;
std::ifstream run_config;
run_config.open(GetCurrentWorkingDirectory()+"/run.config");
while (!run_config.eof()) // To get you all the lines.
{
std::getline(run_config, line); // Get the line.
size_t pos = line.find("scenario_dir=");
if (pos != std::string::npos)
{
sce_dir = line.substr(13);
break;
}
}
run_config.close();
SETestReport testReport(m_Logger);
SETestSuite& testSuite = testReport.CreateTestSuite();
testSuite.SetName(testName);
std::vector<std::string> files;
ListFiles(dir, files, ".json");
for (std::vector<std::string>::iterator it = files.begin(); it != files.end(); ++it)
if (sce_dir.empty())
{
SETestCase& testCase = testSuite.CreateTestCase();
testCase.AddFailure("Unable to find run.config to get scenario directory");
}
else
{
if (it->find("json") != std::string::npos)
std::vector<std::string> files;
ListFiles(sce_dir, files, ".json");
for (std::vector<std::string>::iterator it = files.begin(); it != files.end(); ++it)
{
if (it->find("PFT@") != std::string::npos ||
if (it->find("json") != std::string::npos)
{
if (it->find("PFT@") != std::string::npos ||
it->find("CBC@") != std::string::npos ||
it->find("MP@") != std::string::npos ||
it->find("MP@") != std::string::npos ||
it->find("Urinalysis@") != std::string::npos)// Ignore PFT, CBC, UPanel and MP files
continue;// TODO should actually peek the file and ensure it starts with a <scenario> tag
continue;// TODO should actually peek the file and ensure it starts with a <scenario> tag
pTimer.Start("Case");
SETestCase& testCase = testSuite.CreateTestCase();
Info(it->c_str());
try
{
if (scenario.SerializeFromFile(*it,JSON))
pTimer.Start("Case");
SETestCase& testCase = testSuite.CreateTestCase();
Info(it->c_str());
try
{
if (!scenario.IsValid())
testCase.AddFailure(*it + " is not a valid scenario!");
// todo check to see that all compartment, substances, property names are valid
if (scenario.SerializeFromFile(*it, JSON))
{
if (!scenario.IsValid())
testCase.AddFailure(*it + " is not a valid scenario!");
// todo check to see that all compartment, substances, property names are valid
}
else
{
testCase.AddFailure(*it + " has failed to load!");
}
}
else
catch (...)
{
testCase.AddFailure(*it + " has failed to load!");
testCase.AddFailure(*it + " has failed to load! unknown exception.");
}
testCase.GetDuration().SetValue(pTimer.GetElapsedTime_s("Case"), TimeUnit::s);
testCase.SetName(*it);
}
catch (...)
{
testCase.AddFailure(*it + " has failed to load! unknown exception.");
}
testCase.GetDuration().SetValue(pTimer.GetElapsedTime_s("Case"), TimeUnit::s);
testCase.SetName(*it);
}
}
testReport.SerializeToFile(rptDirectory + "/" + testName + "Report.json",JSON);
......
{
"Name": "MechanicalVentilation",
"Description": "Mimic a patient with generic impaired alveolar exchange and apnea, then ventilated by simulating inputs as if they are from external sensors.",
"Description": "Mimic a patient with generic impaired alveolar exchange and dyspnea, then ventilated by simulating inputs as if they are from external sensors.",
"StartType": {
"PatientConfiguration": {
"PatientFile": "StandardMale.json",
......
......@@ -41,6 +41,12 @@
},
"PropertyName": "LeanBodyMass",
"Unit": "kg"
}, {
"DecimalFormat": {
"Precision": 1
},
"PropertyName": "IdealBodyWeight",
"Unit": "kg"
}, {
"DecimalFormat": {
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment