3#include <MedProcessTools/MedProcessTools/SampleFilter.h>
10 INPUT_TESTER_TYPE_UNDEFINED = 0,
11 INPUT_TESTER_TYPE_SIMPLE = 1,
12 INPUT_TESTER_TYPE_ATTR = 2,
13 INPUT_TESTER_TYPE_FEATURE_JSON = 3
17 TESTER_STAGE_UNDEFINED = 0,
18 TESTER_STAGE_BEFORE_MODEL = 1,
19 TESTER_STAGE_AFTER_MODEL = 2
29 int type = (int)INPUT_TESTER_TYPE_UNDEFINED;
31 int stage = (int)TESTER_STAGE_UNDEFINED;
42 int max_outliers_flag = 0;
49 virtual void input_from_string(
const string &in_str) {
return; };
55 virtual int test_if_ok(
MedPidRepository &rep,
int pid,
long long timestamp,
int &nvals,
int &noutliers) { nvals = 0; noutliers = 0;
return -1; }
57 virtual int test_if_ok(
MedSample &sample) {
return -1; };
59 virtual int test_if_ok(
int pid,
long long timestamp,
60 const unordered_map<
string, unordered_set<string>> &dict_unknown) {
return -1; }
65 return test_if_ok(rep, pid, timestamp, nvals, noutliers);
72 static int name_to_input_tester_type(
const string &name);
92 string err_message_template;
95 type = (int)INPUT_TESTER_TYPE_SIMPLE;
96 stage = (int)TESTER_STAGE_BEFORE_MODEL;
99 void input_from_string(
const string &in_str);
100 int test_if_ok(
MedPidRepository &rep,
int pid,
long long timestamp,
int &nvals,
int &noutliers);
102 int test_if_ok(
int pid,
long long timestamp,
const unordered_map<
string, unordered_set<string>> &dict_unknown);
118 type = (int)INPUT_TESTER_TYPE_ATTR;
119 stage = (int)TESTER_STAGE_AFTER_MODEL;
122 void input_from_string(
const string &in_str);
123 int init(map<string, string>& mapper);
126 int test_if_ok(
int pid,
long long timestamp,
const unordered_map<
string, unordered_set<string>> &dict_unknown) {
return 1; }
139 bool _learned =
false;
140 string resolved_feat_name =
"";
141 vector<string> req_signals;
153 type = (int)INPUT_TESTER_TYPE_FEATURE_JSON;
154 stage = (int)TESTER_STAGE_BEFORE_MODEL;
157 void input_from_string(
const string &in_str);
158 int init(map<string, string>& mapper);
162 int test_if_ok(
int pid,
long long timestamp,
const unordered_map<
string, unordered_set<string>> &dict_unknown) {
return 1; }
186 vector<InputTester *> testers;
187 int max_overall_outliers = (int)1e9;
193 int read_config(
const string &f_conf);
195 int test_if_ok(
int pid,
long long timestamp,
const unordered_map<
string, unordered_set<string>> &dict_unknown, vector<InputSanityTesterResult> &res);
198 int test_if_ok(
MedPidRepository &rep,
int pid,
long long timestamp,
int &nvals,
int &noutliers, vector<InputSanityTesterResult> &res);
201 int test_if_ok(
MedPidRepository &rep,
int pid,
long long timestamp, vector<InputSanityTesterResult> &res) {
202 int nvals, noutliers;
203 return test_if_ok(rep, pid, timestamp, nvals, noutliers, res);
207 int test_if_ok(
MedSample &sample, vector<InputSanityTesterResult> &res);
210 for (
auto &p_it : testers)
211 if (p_it != NULL)
delete p_it;
213 max_overall_outliers = (int)1e9;
An Abstract class that can be serialized and written/read from file.
A model = repCleaner + featureGenerator + featureProcessor + MedPredictor.
Definition MedModel.h:56
Definition MedPidRepository.h:87
MedSample represents a signle sample: id + time (date) Additional (optinal) entries: outcome,...
Definition MedSamples.h:20
SanitySimpleFilter helps making sanity tests on input data The basic tests optional are: (1) te...
Definition SampleFilter.h:412
Definition SerializableObject.h:32