Package: time-restricted-eating-experiments
Time Restricted Eating ExperimenTSInstallpip install time_restricted_eating_experimentsExample for data analysis on the Columbia studyimporttime_restricted_eating_experiments.columbiaastreetscimportpandasaspdTake a brief look on the food logging dataset and the reference information sheettreetsc.read_logging_data('data/col_test_data').head(2)<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>Unnamed: 0original_logtimedesc_textfood_typePID002021-05-12 02:30:00 +0000milkbyrt1999112021-05-12 02:45:00 +0000some medicationmyrt1999pd.read_excel('data/col_test_data/toy_data_17May2021.xlsx').head(2)<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>mCC_IDParticipant_Study_IDStudy PhaseIntervention group (TRE or HABIT)Start_DayEnd_dayEating_Window_StartEating_Window_End0yrt19992S-REMTRE2021-05-122021-05-1400:00:0023:59:001yrt19992T3-INTTRE2021-05-152021-05-1808:00:0018:00:00make the table that contains extra analytic information that we wantdf=treetsc.make_table(treetsc.read_logging_data('data/col_test_data')\,pd.read_excel('data/col_test_data/toy_data_17May2021.xlsx'))Participant yrt1999 didn't log any food items in the following day(s):
2021-05-18
Participant yrt2000 didn't log any food items in the following day(s):
2021-05-12
2021-05-13
2021-05-14
2021-05-15
2021-05-16
2021-05-17
2021-05-18
Participant yrt1999 have bad logging day(s) in the following day(s):
2021-05-12
2021-05-15
Participant yrt1999 have bad window day(s) in the following day(s):
2021-05-15
2021-05-17
Participant yrt1999 have non adherent day(s) in the following day(s):
2021-05-12
2021-05-15
2021-05-17df<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>mCC_IDParticipant_Study_IDStudy PhaseIntervention group (TRE or HABIT)Start_DayEnd_dayEating_Window_StartEating_Window_Endphase_durationcaloric_entries...logging_day_counts%_logging_day_countsgood_logging_days%_good_logging_daysgood_window_days%_good_window_daysoutside_window_days%_outside_window_daysadherent_days%_adherent_days0yrt19992S-REMTRE2021-05-122021-05-1400:00:0023:59:003 days7.0...3.01.002.00.6666673.01.000.00.02.00.6666671yrt19992T3-INTTRE2021-05-152021-05-1808:00:0018:00:004 days8.0...3.00.752.00.5000001.00.252.00.51.00.2500002yrt20003T3-INTTRE2021-05-122021-05-1408:00:0016:00:003 days0.0...0.00.000.00.0000000.00.000.00.00.00.0000003yrt20003T3-INTTRE2021-05-152021-05-1808:00:0016:00:004 days0.0...0.00.000.00.0000000.00.000.00.00.00.0000004yrt20014T12-ATRENaTNaTNaNNaNNaTNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN5 rows × 26 columnsdf.iloc[0]mCC_ID                                           yrt1999
Participant_Study_ID                                   2
Study Phase                                        S-REM
Intervention group (TRE or HABIT)                    TRE
Start_Day                            2021-05-12 00:00:00
End_day                              2021-05-14 00:00:00
Eating_Window_Start                             00:00:00
Eating_Window_End                               23:59:00
phase_duration                           3 days 00:00:00
caloric_entries                                      7.0
mean_daily_eating_window                           13.75
std_daily_eating_window                        11.986972
earliest_entry                                       4.5
2.5%                                              4.5375
97.5%                                            27.5625
duration mid 95%                                  23.025
logging_day_counts                                   3.0
%_logging_day_counts                                 1.0
good_logging_days                                    2.0
%_good_logging_days                             0.666667
good_window_days                                     3.0
%_good_window_days                                   1.0
outside_window_days                                  0.0
%_outside_window_days                                0.0
adherent_days                                        2.0
%_adherent_days                                 0.666667
Name: 0, dtype: objectdf.iloc[1]mCC_ID                                           yrt1999
Participant_Study_ID                                   2
Study Phase                                       T3-INT
Intervention group (TRE or HABIT)                    TRE
Start_Day                            2021-05-15 00:00:00
End_day                              2021-05-18 00:00:00
Eating_Window_Start                             08:00:00
Eating_Window_End                               18:00:00
phase_duration                           4 days 00:00:00
caloric_entries                                      8.0
mean_daily_eating_window                        8.666667
std_daily_eating_window                         8.504901
earliest_entry                                       7.5
2.5%                                                 7.7
97.5%                                               23.9
duration mid 95%                                    16.2
logging_day_counts                                   3.0
%_logging_day_counts                                0.75
good_logging_days                                    2.0
%_good_logging_days                                  0.5
good_window_days                                     1.0
%_good_window_days                                  0.25
outside_window_days                                  2.0
%_outside_window_days                                0.5
adherent_days                                        1.0
%_adherent_days                                     0.25
Name: 1, dtype: objectExample for data analysis using time restricted eating experiments core moduleimporttime_restricted_eating_experiments.coreastreetsimportpandasaspdtake a look at the original datasetdf=treets.file_loader('data/test_food_details.csv')df.head(2)<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>Unnamed: 0IDunique_coderesearch_info_iddesc_textfood_typeoriginal_logtimefoodimage_file_name013401477572733alqt14018795225150Waterw2017-12-08 17:30:00+00:00NaN11340148411111alqt14018795225150Coffee Whiteb2017-12-09 00:01:00+00:00NaNpreprocess the data to have extra basic featuresdf=treets.load_public_data(df,4)df.head(2)<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>Unnamed: 0IDunique_coderesearch_info_iddesc_textfood_typeoriginal_logtimeoriginal_logtime_notzdatelocal_timetimeweek_from_startyear013401477572733alqt14018795225150Waterw2017-12-08 17:30:00+00:002017-12-08 17:30:00+00:002017-12-0817.50000017:30:001201711340148411111alqt14018795225150Coffee Whiteb2017-12-09 00:01:00+00:002017-12-09 00:01:00+00:002017-12-0824.01666700:01:0012017do a brief annalysisdf=treets.summarize_data(df,'unique_code','local_time','date')df.head(2)<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>unique_codenum_daysnum_total_itemsnum_f_n_bnum_medicationsnum_waterbreakfast_avgbreakfast_stddinner_avgdinner_stdeating_win_avgeating_win_stdgood_logging_countbreakfast variation (90%-10%)dinner variation (90%-10%)2.5%95%duration mid 95%0alqt1148284857131499619347.8217956.71071723.4858974.86908215.664103-1.8416351462.9666679.6666674.53500026.81333322.6366671alqt1401879522564488484317.5257815.43456325.8585943.37483918.332813-2.05972348413.4500003.1000004.18333327.43833323.416667df.iloc[0]unique_code                      alqt1148284857
num_days                                     13
num_total_items                             149
num_f_n_b                                    96
num_medications                              19
num_water                                    34
breakfast_avg                          7.821795
breakfast_std                          6.710717
dinner_avg                            23.485897
dinner_std                             4.869082
eating_win_avg                        15.664103
eating_win_std                        -1.841635
good_logging_count                          146
breakfast variation (90%-10%)          2.966667
dinner variation (90%-10%)             9.666667
2.5%                                      4.535
95%                                   26.813333
duration mid 95%                      22.636667
Name: 0, dtype: objectdf.iloc[1]