1#ifndef __COMMONTESTINGTOOLS_H
2#define __COMMONTESTINGTOOLS_H
4#include <AlgoMarker/AlgoMarker/AlgoMarker.h>
5#include <AlgoMarker/DynAMWrapper/DynAMWrapper.h>
6#include <AlgoMarker/CommonTestingTools/CommonTestingTools.h>
9#include <MedProcessTools/MedProcessTools/MedSamples.h>
10#include <MedIO/MedIO/MedIO.h>
11#include <json/json.hpp>
13#include <boost/property_tree/ptree.hpp>
14#include <boost/property_tree/json_parser.hpp>
15#include <boost/algorithm/string/predicate.hpp>
16#include <boost/algorithm/string.hpp>
20#include "DataLoader.h"
29namespace CommonTestingTools {
33 const map<int, int> code_to_status_tbl = {
45 const map<string, string> units_tbl = {
47 {
"Glucose" ,
"mg/dL" },
50 {
"Triglycerides" ,
"mg/dL" },
52 {
"RBC" ,
"10^6/uL" },
55 {
"WBC" ,
"10^3/uL" },
56 {
"Basophils#" ,
"#" },
57 {
"Basophils%" ,
"%" },
58 {
"Eosinophils#" ,
"#" },
59 {
"Eosinophils%" ,
"%" },
60 {
"Hematocrit" ,
"%" },
61 {
"Hemoglobin" ,
"g/dL" },
62 {
"Lymphocytes#" ,
"#" },
63 {
"Lymphocytes%" ,
"%" },
64 {
"MCH" ,
"pg/cell" },
65 {
"MCHC-M" ,
"g/dL" },
67 {
"Monocytes#" ,
"#" },
68 {
"Monocytes%" ,
"%" },
70 {
"Neutrophils#" ,
"#" },
71 {
"Neutrophils%" ,
"%" },
72 {
"Platelets" ,
"10^3/uL" },
80 string precision_float_to_string(
float val);
81 json read_json_array_next_chunk(ifstream& infile,
bool& in_array);
84 string expandEnvVars(
const string &str);
93 charpp_arr = (
char**)malloc(1);
94 charpp_buf = (
char*)malloc(1);
101 charpp_adaptor(
int capacity) : vector<string>(capacity) { init(); };
119 T* from_vec(
const vector<T>& orig) {
120 n_elem = (int)orig.size();
121 data_p_size = n_elem *
sizeof(T);
122 if (data_p_size == 0)
124 data_p = (T*)realloc(data_p, data_p_size);
125 memcpy(data_p, orig.data(), data_p_size);
131 T* get_volatile_data() {
132 if (data_p_size == 0)
138 json json_AddData(
const char *signalName,
int TimeStamps_len,
long long* TimeStamps,
int Values_len,
float* Values,
int n_time_channels,
int n_val_channels);
139 json json_AddDataStr(
const char *signalName,
int TimeStamps_len,
long long* TimeStamps,
int Values_len,
char** Values,
int n_time_channels,
int n_val_channels);
141 int get_preds_from_algomarker(
AlgoMarker *am, vector<MedSample> &res,
bool print_msgs,
DataLoader& d,
bool force_add_data, ofstream& msgs_stream, vector<string> ignore_sig,
bool extended_score=
false);
142 int get_preds_from_algomarker_single(
AlgoMarker *am, vector<MedSample> &res,
bool print_msgs,
DataLoader& d,
bool force_add_data, ofstream& msgs_stream, vector<string> ignore_sig, ofstream& json_reqfile_stream,
bool extended_score=
false);
143 void save_sample_vec(vector<MedSample> sample_vec,
const string& fname);
Logger.h - allowing logs with more control.
Definition AlgoMarker.h:272