Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
RepCreateBitSignal Class Reference
Inheritance diagram for RepCreateBitSignal:
RepProcessor SerializableObject

Public Member Functions

int init (map< string, string > &mapper)
 
void get_min_jitters (string &jitters_s)
 
void init_tables (MedDictionarySections &dict, MedSignals &sigs)
 Init required tables : Should be implemented for inheriting classes that have such tables.
 
void register_virtual_section_name_id (MedDictionarySections &dict)
 Register section id to section name of new virtual signals.
 
void set_required_signal_ids (MedDictionarySections &dict)
 Fill req_signal_ids : parent function just fills from req_signals.
 
void set_affected_signal_ids (MedDictionarySections &dict)
 Fill aff_signal_ids : parent function just fills from aff_signals.
 
int _apply (PidDynamicRec &rec, vector< int > &time_points, vector< vector< float > > &attributes_mat)
 apply processing on a single PidDynamicRec at a set of time-points : Should be implemented for all inheriting classes
 
void get_required_signal_categories (unordered_map< string, vector< string > > &signal_categories_in_use) const
 returns for each used signal it's used categories
 
- Public Member Functions inherited from RepProcessor
virtual void clear ()
 
virtual int init (void *params)
 initialize from a params object : Should be implemented for inheriting classes that have parameters
 
virtual void init_defaults ()
 initialize to default values : Should be implemented for inheriting classes that have parameters
 
virtual void set_signal (const string &_signalName)
 set signal-name : Should be implemented for inheriting classes that have signalName
 
virtual void set_signal_ids (MedSignals &sigs)
 set signal-ids : Should be implemented for inheriting classes that have signalId
 
virtual void get_required_signal_names (unordered_set< string > &signalNames)
 Append required signal names to set : parent function just uses req_signals.
 
virtual void get_required_signal_names (unordered_set< string > &signalNames, unordered_set< string > preReqSignals)
 Append required signal names to set only if processor is actually required to produce any of preReqSignals : parent function just uses req_signals.
 
virtual void add_virtual_signals (map< string, int > &_virtual_signals, map< string, string > &_virtual_signals_generic) const
 rep processors CREATING virtual signals need to implement this: adding their signals to the pile
 
virtual void get_required_signal_ids (unordered_set< int > &signalIds)
 Append required signal names to set : parent function just uses req_signals.
 
virtual void get_required_signal_ids (unordered_set< int > &signalIds, unordered_set< int > preReqSignals)
 Append required signal names to set only if processor is actually required to produce any of preReqSignals : parent function just uses req_signals.
 
bool is_signal_affected (int signalId)
 Check if a signal is affected by processor </summray>

Returns
true if affected, false if not

 
bool is_signal_affected (string &signalName)
 
virtual void fit_for_repository (MedPidRepository &rep)
 make changes to RepProcessor according to available signals in Repository
 
virtual bool filter (unordered_set< string > &reqSignals)
 Check if processor (and 'sub'-processors within) should be applied according to set of required signals </summray>

Returns
true if processor is not required and can be filtered, false otherwise

 
virtual void init_attributes ()
 Init attributes information : Should be implemented for inheriting classes that have attributes.
 
virtual int _learn (MedPidRepository &rep, MedSamples &samples, vector< RepProcessor * > &prev_processors)
 learn processing model on a subset of samples. Apply set of preceeding processors on DynamicPidRec before learning :
 
virtual int _conditional_learn (MedPidRepository &rep, MedSamples &samples, vector< RepProcessor * > &prev_processors, unordered_set< int > &neededSignalIds)
 learn processing model on a subset of samples only if required. Apply set of preceeding processors on DynamicPidRec before learning :
 
int learn (MedPidRepository &rep, MedSamples &samples, vector< RepProcessor * > &prev_processors)
 learn processing model on a subset of ids. Apply set of preceeding processors on DynamicPidRec before learning
 
int learn (MedPidRepository &rep)
 learn on all pids in repository, using fake samples - works only for repProcessors that ignore sample dates
 
int learn (MedPidRepository &rep, MedSamples &samples)
 learn on subset of samples without preceesing processors
 
virtual int conditional_learn (MedPidRepository &rep, MedSamples &samples, vector< RepProcessor * > &prev_processors, unordered_set< int > &neededSignalIds)
 learn processing model on a subset of samples only if required. Apply set of preceeding processors on DynamicPidRec before learning :
 
int conditional_learn (MedPidRepository &rep, MedSamples &samples, unordered_set< int > &neededSignalIds)
 learn processing model on a subset of ids only if required without preceesing processors
 
virtual int _conditional_apply (PidDynamicRec &rec, vector< int > &time_points, unordered_set< int > &neededSignalIds, vector< vector< float > > &attributes_vals)
 apply processing on a single PidDynamicRec at a set of time-points only if required : May be implemented for inheriting classes
 
virtual int _apply_simple (PidDynamicRec &rec, vector< int > &time_points)
 
int apply (PidDynamicRec &rec, vector< int > &time_points, vector< vector< float > > &attributes_vals)
 apply processing on a single PidDynamicRec at a set of time-points
 
int conditional_apply (PidDynamicRec &rec, vector< int > &time_points, unordered_set< int > &neededSignalIds, vector< vector< float > > &attributes_vals)
 apply processing on a single PidDynamicRec at a set of time-points only if required : if any of the signals in neededSignalIds is actually affected by processor
 
int apply (PidDynamicRec &rec, MedIdSamples &samples)
 apply processing on a single PidDynamicRec at a set of time-points given by samples
 
int conditional_apply (PidDynamicRec &rec, MedIdSamples &samples, unordered_set< int > &neededSignalIds)
 apply processing on a single PidDynamicRec at a set of time-points given by samples only if required
 
int conditional_apply_without_attributes (PidDynamicRec &rec, const MedIdSamples &samples, unordered_set< int > &neededSignalIds)
 apply processing on a single PidDynamicRec at a set of time-points given by samples only if required, not affecting attributes
 
virtual void dprint (const string &pref, int rp_flag)
 used for debug prints, each inheriting class can overload this one to get a more precise debug print.
 
virtual void make_summary ()
 
void * new_polymorphic (string derived_class_name)
 for polymorphic classes that want to be able to serialize/deserialize a pointer * to the derived class given its type one needs to implement this function to return a new to the derived class given its type (as in my_type)
 
size_t get_processor_size ()
 get size of processor + processor_type
 
size_t processor_serialize (unsigned char *blob)
 seialize processor + processor_type
 
virtual void print ()
 optional printing of processor
 
- Public Member Functions inherited from SerializableObject
virtual int version () const
 Relevant for serializations.
 
virtual string my_class_name () const
 For better handling of serializations it is highly recommended that each SerializableObject inheriting class will implement the next method.
 
virtual void serialized_fields_name (vector< string > &field_names) const
 The names of the serialized fields.
 
virtual void pre_serialization ()
 
virtual void post_deserialization ()
 
virtual size_t get_size ()
 Gets bytes sizes for serializations.
 
virtual size_t serialize (unsigned char *blob)
 Serialiazing object to blob memory. return number ob bytes wrote to memory.
 
virtual size_t deserialize (unsigned char *blob)
 Deserialiazing blob to object. returns number of bytes read.
 
size_t serialize_vec (vector< unsigned char > &blob)
 
size_t deserialize_vec (vector< unsigned char > &blob)
 
virtual size_t serialize (vector< unsigned char > &blob)
 
virtual size_t deserialize (vector< unsigned char > &blob)
 
virtual int read_from_file (const string &fname)
 read and deserialize model
 
virtual int write_to_file (const string &fname)
 serialize model and write to file
 
virtual int read_from_file_unsafe (const string &fname)
 read and deserialize model without checking version number - unsafe read
 
int init_from_string (string init_string)
 Init from string.
 
int init_params_from_file (string init_file)
 
int init_param_from_file (string file_str, string &param)
 
int update_from_string (const string &init_string)
 
virtual int update (map< string, string > &map)
 Virtual to update object from parsed fields.
 
virtual string object_json () const
 

Data Fields

string in_sig = ""
 the name of input categorial signal
 
string out_virtual = ""
 the name of the output virtual signal
 
int t_chan = 0
 time channel for categorial data
 
int c_chan = 0
 channel for categorial data
 
int duration_chan = 1
 if >=0 the channel of duration for the categorial signal
 
int min_duration = 60
 minimal duration of a category
 
vector< int > min_durations = {}
 option to state the min_duration for each category specifically
 
int max_duration = 180
 maximal duration of a category
 
float duration_add = 0
 
float duration_mult = 0.1f
 will add to each duration (duration_add + duration_mult*duration)
 
int dont_look_back = 7
 how many days back to not look at in in_sig. This is usefull in many cases
 
int min_clip_time = 7
 minimal number of days to consider clipping after due to change to other drugs.
 
int last_clip_period = 30
 after joining periods, we clip the last one to be exactly last_clip_period after the last appearance of the drug
 
vector< int > min_jitters = { 0,0,0 }
 minimal length for allowed jitters : A-AB-B,ABC-AB-A,AB-A-AC
 
int max_min_jitters
 
vector< string > categories_names
 the names of the categories to create, categories_names[j] will sit at bit j (1 << j)
 
vector< vector< string > > categories_sets
 the sets defining each category.
 
int time_unit_sig = MedTime::Date
 time unit of the time channel in in_sig
 
int time_unit_duration = MedTime::Days
 time unit of the duration (both in signal and in min_duration)
 
bool change_at_prescription_mode = false
 change_at_prescription_mode = true - change signal at every prescription (only the relevant drugs). When false change only when prescription changes
 
MedDictionarySections_dict
 
string print_dict = ""
 
int time_channels = 1
 
vector< char > all_cat_lut
 
vector< vector< char > > categories_luts
 
ADD_SERIALIZATION_FUNCS(processor_type, in_sig, out_virtual, aff_signals, req_signals, t_chan, c_chan, duration_chan, min_duration, min_durations, max_duration, duration_add, duration_mult, dont_look_back, min_clip_time, last_clip_period, categories_names, categories_sets, time_unit_sig, time_unit_duration, change_at_prescription_mode, virtual_signals_generic, time_channels, min_jitters) private int in_sid = -1
 
vector< string > registry_values
 
- Data Fields inherited from RepProcessor
RepProcessorTypes processor_type = REP_PROCESS_LAST
 type of repository processor
 
unordered_set< string > req_signals
 names of signals required for processsing
 
unordered_set< int > req_signal_ids
 ids of signals required for processing
 
unordered_set< string > aff_signals
 names of signals affected by processing
 
unordered_set< int > aff_signal_ids
 ids of signals affected by processing
 
bool unconditional = false
 indicated that processor should ALWAYS be applied
 
vector< string > attributes
 attributes generated by the processor (optional)
 
vector< pair< string, int > > virtual_signals
 virtual signals are created only in rep processors but can be used by any rep processor that comes after or any feture generator as a regular signal.
 
vector< pair< string, string > > virtual_signals_generic
 

Additional Inherited Members

- Static Public Member Functions inherited from RepProcessor
static RepProcessormake_processor (string name)
 create a new repository processor from name
 
static RepProcessormake_processor (string type, string params)
 create a new repository processor from name and a parameters string
 
static RepProcessormake_processor (RepProcessorTypes type)
 create a new repository processor from type
 
static RepProcessormake_processor (RepProcessorTypes type, string params)
 create a new repository processor from type and a parameters string
 
static RepProcessorcreate_processor (string &params)
 create a new repository processor from parameters string which contains rp_type
 

Member Function Documentation

◆ _apply()

int RepCreateBitSignal::_apply ( PidDynamicRec rec,
vector< int > &  time_points,
vector< vector< float > > &  attributes_mat 
)
virtual

apply processing on a single PidDynamicRec at a set of time-points : Should be implemented for all inheriting classes

Reimplemented from RepProcessor.

◆ get_required_signal_categories()

void RepCreateBitSignal::get_required_signal_categories ( unordered_map< string, vector< string > > &  signal_categories_in_use) const
virtual

returns for each used signal it's used categories

Reimplemented from RepProcessor.

◆ init()

int RepCreateBitSignal::init ( map< string, string > &  mapper)
virtual
if (field == "output_name")
output_name = entry.second;
else if (field == "signal")
signalName = entry.second;
else if (field == "unconditional")
unconditional = med_stoi(entry.second) > 0;
else if (field == "work_channel")
work_channel = med_stoi(entry.second);
else if (field == "start_time_channel")
start_time_channel = med_stoi(entry.second);
else if (field == "end_time_channel")
end_time_channel = med_stoi(entry.second);
else if (field == "time_window")
time_window = med_stoi(entry.second);
else if (field == "time_unit")
time_unit = med_time_converter.string_to_type(entry.second);
else if (field == "factor")
factor = med_stof(entry.second);
else if (field == "drop_missing_rate")
drop_missing_rate = med_stof(entry.second);
else if (field == "buffer_first")
buffer_first = med_stoi(entry.second) > 0;
else if (field == "output_signal_type")
output_signal_type = entry.second;
else if (field == "rp_type")
{
}
else
MTHROW_AND_ERR("Error in RepAggregateSignal::init - Unsupported param \"%s\"\n", field.c_str());
int string_to_type(const string &str)
Convert string to type.
Definition MedTime.cpp:358
bool unconditional
indicated that processor should ALWAYS be applied
Definition RepProcess.h:63

[RepAggregateSignal::init]

[RepCreateBitSignal::init]

Reimplemented from RepProcessor.

◆ init_tables()

void RepCreateBitSignal::init_tables ( MedDictionarySections dict,
MedSignals sigs 
)
virtual

Init required tables : Should be implemented for inheriting classes that have such tables.

Reimplemented from RepProcessor.

◆ register_virtual_section_name_id()

void RepCreateBitSignal::register_virtual_section_name_id ( MedDictionarySections dict)
virtual

Register section id to section name of new virtual signals.

Reimplemented from RepProcessor.

◆ set_affected_signal_ids()

void RepCreateBitSignal::set_affected_signal_ids ( MedDictionarySections dict)
inlinevirtual

Fill aff_signal_ids : parent function just fills from aff_signals.

Reimplemented from RepProcessor.

◆ set_required_signal_ids()

void RepCreateBitSignal::set_required_signal_ids ( MedDictionarySections dict)
inlinevirtual

Fill req_signal_ids : parent function just fills from req_signals.

Reimplemented from RepProcessor.


The documentation for this class was generated from the following files: