Medial Code Documentation
Loading...
Searching...
No Matches
ElixhauserGenerator.h
Go to the documentation of this file.
1#pragma once
2#include "FeatureGenerator.h"
3
8private:
9 vector<string> types = { "CONGESTIVE_HEART_FAILURE","CARDIAC_ARRHYTHMIAS","VALVULAR_DISEASE","PULMONARY_CIRCULATION","PERIPHERAL_VASCULAR","HYPERTENSION","PARALYSIS","OTHER_NEUROLOGICAL",
10 "CHRONIC_PULMONARY","DIABETES_UNCOMPLICATED","DIABETES_COMPLICATED","HYPOTHYROIDISM","RENAL_FAILURE","LIVER_DISEASE","PEPTIC_ULCER","AIDS","LYMPHOMA","METASTATIC_CANCER","SOLID_TUMOR",
11 "RHEUMATOID_ARTHRITIS","COAGULOPATHY","OBESITY","WEIGHT_LOSS","FLUID_ELECTROLYTE","BLOOD_LOSS_ANEMIA","DEFICIENCY_ANEMIAS","ALCOHOL_ABUSE","DRUG_ABUSE","PSYCHOSES","DEPRESSION" };
12 map<string, vector<int>> _weights = { {"ahrq",{9,0,0,6,3,-1,5,5,3,0,-3,0,6,4,0,0,6,14,7,0,11,-5,9,11,-3,-2,-1,-7,-5,-5}},{"vanwarlaven",{7,5,-1,4,2,0,7,6,3,0,0,0,5,11,0,0,9,12,4,0,3,-4,6,5,-2,-2,0,-7,0,-3}} };
13 vector<vector<string>> drgSets, diagSets;
14 vector<vector<unsigned char>> drgLuts,diagLuts;
15
16 void parseSets(string& init_string, vector<vector<string>>& sets);
17 void initSets();
18
19 // Helper
20 vector<int> weights;
21
22public:
23 // Feature Descrption
24 string drgSignalName = "DRG_IP", diagSignalName = "DIAGNOSIS_IP";
25 int drgSignalId, diagSignalId;
26 string type; // ahrq/vanwarlaven
27
28 // parameters (should be serialized)
29 int win_from = 0;
30 int win_to = 360000;
34
35 // Constructor/Destructor
37 generator_type = FTR_GEN_ELIXHAUSER; req_signals = { drgSignalName,diagSignalName }; initSets();
38 }
39
41
44 virtual int init(map<string, string>& mapper);
45
46 // Name
47 void set_names() { if (names.empty()) names.push_back("FTR_" + int_to_string_digits(serial_id, 6) + ".Elixhauser"); tags.push_back("Elixhauser"); }
48
49 // Copy
50 virtual void copy(FeatureGenerator *generator) { *this = *(dynamic_cast<ElixhauserGenerator *>(generator)); }
51
54
55 // Signal Ids
56 void set_signal_ids(MedSignals& sigs) { drgSignalId = sigs.sid(drgSignalName); diagSignalId = sigs.sid(diagSignalName); }
57
58 // Learn a generator
59 int _learn(MedPidRepository& rep, const MedSamples& samples, vector<RepProcessor *> processors);
60
61 // generate a new feature
62 int _generate(PidDynamicRec& rec, MedFeatures& features, int index, int num, vector<float *> &_p_data);
63
64 // Serialization
65 ADD_CLASS_NAME(ElixhauserGenerator)
66 ADD_SERIALIZATION_FUNCS(generator_type, types, type, drgSignalName, diagSignalName, drgSets, diagSets, req_signals);
67};
FeatureGenerator : creating features from raw signals.
@ FTR_GEN_ELIXHAUSER
Calculate Current Elixhauser given latest DRG and Diagnosis information. Creates ElixhauserGenerator.
Definition FeatureGenerator.h:45
#define ADD_SERIALIZATION_FUNCS(...)
Definition SerializableObject.h:122
Definition ElixhauserGenerator.h:7
virtual int init(map< string, string > &mapper)
The parsed fields from init command.
Definition Elixhauser.cpp:40
int win_to
time window for feature: win_to is the maximal time before the prediction time
Definition ElixhauserGenerator.h:30
int drg_time_unit_sig
the time init in which the signal is given. (set correctly from Repository in learn and _generate)
Definition ElixhauserGenerator.h:32
int time_unit_win
the time unit in which the windows are given. Default: Undefined
Definition ElixhauserGenerator.h:31
void init_tables(MedDictionarySections &dict)
Init required tables.
Definition Elixhauser.cpp:80
int win_from
time window for feature: win_from is the minimal time before from the prediction time
Definition ElixhauserGenerator.h:29
int diag_time_unit_sig
the time init in which the signal is given. (set correctly from Repository in learn and _generate)
Definition ElixhauserGenerator.h:33
Definition FeatureGenerator.h:53
vector< string > tags
Tags - for defining labels or groups. may be used later for filtering for example.
Definition FeatureGenerator.h:69
FeatureGeneratorTypes generator_type
Type.
Definition FeatureGenerator.h:57
vector< string > names
Feature name.
Definition FeatureGenerator.h:60
Definition MedDictionary.h:87
A class for holding features data as a virtual matrix
Definition MedFeatures.h:47
Definition MedPidRepository.h:87
MedSamples represent a collection of samples per different id The data is conatined in a vector of ...
Definition MedSamples.h:129
Definition MedSignals.h:719
static const int Undefined
undefined time unit
Definition MedTime.h:24
Definition MedPidRepository.h:127