Package: public-data-food-analysis-3
Public data food analysisInstallpip install public_data_food_analysis_3Example for data analysis on the Columbia studyimportpublic_data_food_analysis_3.columbiaaspdfacimportpandasaspdTake a brief look on the food logging dataset and the reference information sheetpdfac.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=pdfac.make_table(pdfac.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-14df<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...31.002.00.66666731.0000.020.6666671yrt19992T3-INTTRE2021-05-152021-05-1808:00:0018:00:004 days8...30.752.00.50000010.2520.510.2500002yrt20003T3-INTTRE2021-05-122021-05-1408:00:0016:00:003 days0...00.000.00.00000000.0000.000.0000003 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
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
%_logging_day_counts                                 1.0
good_logging_days                                    2.0
%_good_logging_days                             0.666667
good_window_days                                       3
%_good_window_days                                   1.0
outside_window_days                                    0
%_outside_window_days                                0.0
adherent_days                                          2
%_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
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
%_logging_day_counts                                0.75
good_logging_days                                    2.0
%_good_logging_days                                  0.5
good_window_days                                       1
%_good_window_days                                  0.25
outside_window_days                                    2
%_outside_window_days                                0.5
adherent_days                                          1
%_adherent_days                                     0.25
Name: 1, dtype: objectExample for data analysis using public data food analysis moduleimportpublic_data_food_analysis_3.coreaspdfacoimportpandasaspdtake a look at the original datasetdf=pdfaco.universal_key('data/test_food_details.csv')df.head(2)read the csv file successfully.<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=pdfaco.load_public_data(df)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=pdfaco.summarize_data(df,'local_time','unique_code')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]unique_code                      alqt14018795225
num_days                                      64
num_total_items                              488
num_f_n_b                                    484
num_medications                                3
num_water                                      1
breakfast_avg                           7.525781
breakfast_std                           5.434563
dinner_avg                             25.858594
dinner_std                              3.374839
eating_win_avg                         18.332813
eating_win_std                         -2.059723
good_logging_count                           484
breakfast variation (90%-10%)              13.45
dinner variation (90%-10%)                   3.1
2.5%                                    4.183333
95%                                    27.438333
duration mid 95%                       23.416667
Name: 1, dtype: object