Medial Code Documentation
|
A Class which represent time ranges of label values based on registry and labeling method. More...
#include <MedLabels.h>
Public Member Functions | |
void | prepare_from_registry (const vector< MedRegistryRecord > ®_records, const vector< MedRegistryRecord > *censor_records=NULL) |
bool | has_censor_reg () const |
return true if censor registry was provided | |
bool | has_censor_reg (int pid) const |
return true if found censor records for patient | |
void | get_pids (vector< int > &pids) const |
return all availbel pids from registry | |
void | get_records (int pid, vector< const MedRegistryRecord * > ®_records, vector< const MedRegistryRecord * > &censor_records) const |
get all registry and censor records for patient | |
void | calc_signal_stats (const string &repository_path, const string &signal_name, const string &signalHirerchyType, int ageBinValue, MedSamplingStrategy &sampler, const LabelParams &inc_labeling_params, map< float, map< float, vector< int > > > &maleSignalToStats, map< float, map< float, vector< int > > > &femaleSignalToStats, const string &debug_file="", const unordered_set< int > &debug_vals=default_empty_set) const |
calculates table statitics for interrsecting with registry of signal | |
void | create_incidence_file (const string &file_path, const string &rep_path, int age_bin, int min_age, int max_age, bool use_kaplan_meir=false, const string &sampler_name="yearly", const string &sampler_args="day_jump=365;start_year=2007;end_year=2012;prediction_month_day=101", const string &debug_file="") const |
calculate incidence and writes the result into file with old and new format | |
SamplingRes | get_samples (int pid, int time, vector< MedSample > &samples, bool show_conflicts=false) const |
returns label value for time point | |
SamplingRes | get_samples (int pid, const vector< MedSample > &samples, vector< MedSample > &new_samples, bool show_conflicts=false) const |
update outcome and outcomeTime keeping everything else | |
SamplingRes | get_samples (int pid, const vector< int > ×, vector< MedSample > &samples, bool show_conflicts=false) const |
returns label value for time points | |
void | create_samples (const MedSamplingStrategy *sampler, MedSamples &samples, bool show_conflicts=true) const |
Creates MedSamples using MedSampling. | |
void | relabel_samples (MedSamples &samples, bool show_conflicts=true) const |
relabels the samples besed on the labeler | |
MedLabels (const LabelParams ¶ms) | |
Ctor with labling params. | |
MedLabels (const string &labling_params) | |
Ctor with labling params as string. | |
Data Fields | |
LabelParams | labeling_params |
the labeling parameters - problem definition | |
A Class which represent time ranges of label values based on registry and labeling method.
The main procedure is to quety label value using get_label method
void MedLabels::calc_signal_stats | ( | const string & | repository_path, |
const string & | signal_name, | ||
const string & | signalHirerchyType, | ||
int | ageBinValue, | ||
MedSamplingStrategy & | sampler, | ||
const LabelParams & | inc_labeling_params, | ||
map< float, map< float, vector< int > > > & | maleSignalToStats, | ||
map< float, map< float, vector< int > > > & | femaleSignalToStats, | ||
const string & | debug_file = "" , |
||
const unordered_set< int > & | debug_vals = default_empty_set |
||
) | const |
calculates table statitics for interrsecting with registry of signal
repository_path | the repsitory path |
signalCode | the signal code to calculate the stats of the registry with |
signalHirerchyType | the Hirerchy type: [None, RC, ATC, BNF] for signals with hirerchy |
ageBinValue | the age bin size |
time_window_from | the minimal time before the event (registry start_time). may be negative to start after event |
time_window_to | the maximal time before the event (registry start_time). may be negative to end after event start |
sampler | the sampler for how to calc the non appearance of the signal with the registry. You may use MedSamplingAge for example to sample each patient once in each age in the registry dates |
debug_file | If provided the output path to write detailed results of the intersection of registry and signal |
debug_vals | If not empty and has debug_file. will write the intersection(by the time window) of the registry with those values |
maleSignalToStats The stats for males. the first key in the dictionary is the signal_value. the second key is age_bin and the vector is always of size 4: [signal_not_appear®istry_is_false, signal_not_appear®istry_is_true, signal_appears®istry_is_false, signal_appears®istry_is_true]
femaleSignalToStats The stats for the females. same format as males
void MedLabels::create_incidence_file | ( | const string & | file_path, |
const string & | rep_path, | ||
int | age_bin, | ||
int | min_age, | ||
int | max_age, | ||
bool | use_kaplan_meir = false , |
||
const string & | sampler_name = "yearly" , |
||
const string & | sampler_args = "day_jump=365;start_year=2007;end_year=2012;prediction_month_day=101" , |
||
const string & | debug_file = "" |
||
) | const |
calculate incidence and writes the result into file with old and new format
file_path | the output file path to write the results |
rep_path | the repository path to calculate the incidence |
age_bin | the age_bin for binning age groups for the incidence |
min_age | the minimal age fro the incidence |
max_age | the maximal age fro the incidence |
use_kaplan_meir | if True will calc using kaplan meier survivol rates |
sampler_name | the sampler name for calculating incidence |
sampler_args | the sampler args for calculating incidence - may control trail years for example |
void MedLabels::prepare_from_registry | ( | const vector< MedRegistryRecord > & | reg_records, |
const vector< MedRegistryRecord > * | censor_records = NULL |
||
) |
prepare MedLabels from registry (and censor if provided) based on labeling rules