Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
MedRegistryKeepAlive Class Reference

Keep Alive registry - use for censoring "dead" times. More...

#include <MedRegistry.h>

Inheritance diagram for MedRegistryKeepAlive:
MedRegistry SerializableObject

Public Member Functions

int init (map< string, string > &map)
 
ADD_SERIALIZATION_FUNCS(time_unit, registry_records, duration, max_repo_date, start_buffer_duration, secondry_start_buffer_duration, end_buffer_duration, signal_list) private void get_registry_records (int pid, int bdate, vector< UniversalSigVec_mem > &usv, vector< MedRegistryRecord > &results)
 < max date allowed to each pid constrain
 
- Public Member Functions inherited from MedRegistry
void write_text_file (const string &file_path) const
 Writes the file to text file in tab delimeted format: PID, Start_Date, End_Date, min_allowed_date, max_allowed_date, Age, RegistryValue.
 
void read_text_file (const string &file_path)
 Reads the file in text format in tab delimeted.
 
void create_registry (MedPidRepository &dataManager, medial::repository::fix_method method=medial::repository::fix_method::none, vector< RepProcessor * > *rep_processors=NULL)
 Creates vector of registry using already initialized MedPidRepository with signals in parallel manner for each patient.
 
void get_registry_creation_codes (vector< string > &signal_codes) const
 returns the signal codes used to create the registry - to load from rep
 
void get_registry_use_codes (vector< string > &signal_codes) const
 returns the signal codes used to create the registry - to use in create_registry command as input
 
void get_pids (vector< int > &pids) const
 returns all patients ids from registry - unique patient ids
 
void merge_records ()
 Merges registry record with same registry values (and continues in time)
 
void * new_polymorphic (string dname)
 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)
 
 MedRegistry ()
 Default Ctor.
 
virtual void clear_create_variables ()
 A function to clear creation variables that are on memory if needed.
 
virtual bool get_pid_records (PidRec &rec, int bDateCode, const vector< int > &used_sigs, vector< MedRegistryRecord > &results)
 
void set_rep_for_init (MedRepository &rep)
 Sets Repository object to initialize all registry object, if not given will try to use repository path to read and initialize repository.
 
- 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

int duration
 the duration buffer form start
 
int max_repo_date
 the maximal date for the repository
 
int start_buffer_duration
 the buffer duration from first signal
 
int secondry_start_buffer_duration
 the buffer duration for new region (after not active) - can be negative to look backward
 
int end_buffer_duration
 the buffer duration from last signal
 
vector< string > signal_list
 list of signals to fetch for keep alive time ranges
 
- Data Fields inherited from MedRegistry
vector< MedRegistryRecordregistry_records
 the registry records vector
 
int time_unit
 The time unit.
 

Additional Inherited Members

- Static Public Member Functions inherited from MedRegistry
static MedRegistrymake_registry (const string &registry_type, const string &init_str="")
 creates registry type and initialize it if init_str is not empty Use "binary" for MedRegistryCodesList and "categories" for MedRegistryCategories.
 
static MedRegistrymake_registry (const string &registry_type, MedRepository &rep, const string &init_str="")
 creates registry type and initialize it if init_str is not empty Use "binary" for MedRegistryCodesList and "categories" for MedRegistryCategories.
 
static MedRegistrycreate_registry_full (const string &registry_type, const string &init_str, const string &repository_path, MedModel &model_with_rep_processor, medial::repository::fix_method method=medial::repository::fix_method::none)
 Creates vector of registry records - handles everything for you in parallel manner for each patient - uses create_registry.
 
- Protected Attributes inherited from MedRegistry
vector< string > signalCodes_names
 the signals codes by name
 
bool need_bdate
 If true Bdate is also used in registry creation.
 
medial::repository::fix_method resolve_conlicts = medial::repository::fix_method::none
 resolve conflicts in registry method
 
MedRepositoryrep_for_init = NULL
 repository pointer to init dicts
 

Detailed Description

Keep Alive registry - use for censoring "dead" times.

Member Function Documentation

◆ get_registry_records()

void MedRegistryKeepAlive::get_registry_records ( int  pid,
int  bdate,
vector< UniversalSigVec_mem > &  usv,
vector< MedRegistryRecord > &  results 
)
virtual

< max date allowed to each pid constrain

Reimplemented from MedRegistry.

◆ init()

int MedRegistryKeepAlive::init ( map< string, string > &  map)
virtual
if (it->first == "duration")
duration = med_stoi(it->second);
else if (it->first == "rep")
repository_path = it->second;
else if (it->first == "max_repo_date")
max_repo_date = med_stoi(it->second);
else if (it->first == "secondry_start_buffer_duration")
secondry_start_buffer_duration = med_stoi(it->second);
else if (it->first == "start_buffer_duration")
start_buffer_duration = med_stoi(it->second);
else if (it->first == "end_buffer_duration")
end_buffer_duration = med_stoi(it->second);
else if (it->first == "signal_list")
boost::split(signal_list, it->second, boost::is_any_of(",;"));
else if (it->first == "pid_to_censor_dates") {
ifstream fr(it->second);
if (!fr.good())
MTHROW_AND_ERR("Error in MedRegistryCodesList::init - unable to open %s for reading.",
it->second.c_str());
string line;
while (getline(fr, line)) {
boost::trim(line);
if (line.empty() || line.at(0) == '#')
continue;
vector<string> tokens;
boost::split(tokens, line, boost::is_any_of("\t"));
if (tokens.size() != 2)
MTHROW_AND_ERR("Error in MedRegistryCodesList::init - in parsing pid_to_censor_dates file"
" - %s excpeting TAB for line:\n%s\n", it->second.c_str(), line.c_str());
if (pid_to_max_allowed.find(stoi(tokens[0])) == pid_to_max_allowed.end() ||
pid_to_max_allowed[stoi(tokens[0])] > stoi(tokens[1]))
pid_to_max_allowed[stoi(tokens[0])] = stoi(tokens[1]);
}
fr.close();
}
else
MTHROW_AND_ERR("Error in MedRegistryKeepAlive::init - unknown parameter %s\n", it->first.c_str());
int start_buffer_duration
the buffer duration from first signal
Definition MedRegistry.h:471
int duration
the duration buffer form start
Definition MedRegistry.h:469
int end_buffer_duration
the buffer duration from last signal
Definition MedRegistry.h:473
int max_repo_date
the maximal date for the repository
Definition MedRegistry.h:470
vector< string > signal_list
list of signals to fetch for keep alive time ranges
Definition MedRegistry.h:474
int secondry_start_buffer_duration
the buffer duration for new region (after not active) - can be negative to look backward
Definition MedRegistry.h:472

[MedRegistryKeepAlive::init]

[MedRegistryKeepAlive::init]

Reimplemented from SerializableObject.


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