Medial Code Documentation
Loading...
Searching...
No Matches
Internal
MedProcessTools
MedProcessTools
ElixhauserGenerator.h
Go to the documentation of this file.
1
#pragma once
2
#include "
FeatureGenerator.h
"
3
7
class
ElixhauserGenerator
:
public
FeatureGenerator
{
8
private
:
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
22
public
:
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;
31
int
time_unit_win
=
MedTime::Undefined
;
32
int
drg_time_unit_sig
=
MedTime::Undefined
;
33
int
diag_time_unit_sig
=
MedTime::Undefined
;
34
35
// Constructor/Destructor
36
ElixhauserGenerator
() :
FeatureGenerator
() {
37
generator_type
=
FTR_GEN_ELIXHAUSER
; req_signals = { drgSignalName,diagSignalName }; initSets();
38
}
39
40
~ElixhauserGenerator
() {};
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
53
void
init_tables
(
MedDictionarySections
& dict);
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.h
FeatureGenerator : creating features from raw signals.
FTR_GEN_ELIXHAUSER
@ FTR_GEN_ELIXHAUSER
Calculate Current Elixhauser given latest DRG and Diagnosis information. Creates ElixhauserGenerator.
Definition
FeatureGenerator.h:45
ADD_SERIALIZATION_FUNCS
#define ADD_SERIALIZATION_FUNCS(...)
Definition
SerializableObject.h:122
ElixhauserGenerator
Definition
ElixhauserGenerator.h:7
ElixhauserGenerator::init
virtual int init(map< string, string > &mapper)
The parsed fields from init command.
Definition
Elixhauser.cpp:40
ElixhauserGenerator::win_to
int win_to
time window for feature: win_to is the maximal time before the prediction time
Definition
ElixhauserGenerator.h:30
ElixhauserGenerator::drg_time_unit_sig
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
ElixhauserGenerator::time_unit_win
int time_unit_win
the time unit in which the windows are given. Default: Undefined
Definition
ElixhauserGenerator.h:31
ElixhauserGenerator::init_tables
void init_tables(MedDictionarySections &dict)
Init required tables.
Definition
Elixhauser.cpp:80
ElixhauserGenerator::win_from
int win_from
time window for feature: win_from is the minimal time before from the prediction time
Definition
ElixhauserGenerator.h:29
ElixhauserGenerator::diag_time_unit_sig
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
FeatureGenerator
Definition
FeatureGenerator.h:53
FeatureGenerator::tags
vector< string > tags
Tags - for defining labels or groups. may be used later for filtering for example.
Definition
FeatureGenerator.h:69
FeatureGenerator::generator_type
FeatureGeneratorTypes generator_type
Type.
Definition
FeatureGenerator.h:57
FeatureGenerator::names
vector< string > names
Feature name.
Definition
FeatureGenerator.h:60
MedDictionarySections
Definition
MedDictionary.h:87
MedFeatures
A class for holding features data as a virtual matrix
Definition
MedFeatures.h:47
MedPidRepository
Definition
MedPidRepository.h:87
MedSamples
MedSamples represent a collection of samples per different id The data is conatined in a vector of ...
Definition
MedSamples.h:129
MedSignals
Definition
MedSignals.h:719
MedTime::Undefined
static const int Undefined
undefined time unit
Definition
MedTime.h:24
PidDynamicRec
Definition
MedPidRepository.h:127
Generated on Mon Sep 15 2025 12:12:21 for Medial Code Documentation by
1.9.8