pycpshealthcare.db.MealTracker package

Submodules

pycpshealthcare.db.MealTracker.functions module

pycpshealthcare.db.MealTracker.functions.get_mealtracker_fitbit_results(test_ids, collection, timestamp_start, timestamp_end, values, time_sorted=True)[source]

A function that generates a MongoDB query from arguments for the specified collection.

Returns:

An iterable with the database query results.

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • test_ids (list<int>) – A list of test ids to query.

  • collection (pymongo.collection.Collection) – The collection of the sensor to query.

  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

pycpshealthcare.db.MealTracker.functions.get_mealtracker_fitbit_results_grouped(test_ids, collection, timestamp_start, timestamp_end, values, bin_size=60, bin_unit='minute')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

  • bin_size (int, optional) – The width of the mobile window, defaults to 60.

  • bin_unit (str, optional) – The unit of the mobile window, defaults to minute. Options are minute, hour, day.

pycpshealthcare.db.MealTracker.functions.get_mealtracker_meals_results(collection, test_ids, timestamp_start, timestamp_end, ouput_format='unwinded')[source]

A function that generates a MongoDB query from arguments for the specified collection.

Returns:

An iterable with the database query results.

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • test_ids (list<int>) – A list of test ids to query.

  • collection (pymongo.collection.Collection) – The collection of the sensor to query.

  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • ouput_format (str) – unwinded|original

pycpshealthcare.db.MealTracker.study module

class pycpshealthcare.db.MealTracker.study.MealTrackerStudy(connection)[source]

Bases: object

get_fitbit_at_meals(timestamp_start=None, timestamp_end=None, test_ids='all', values='all')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

get_fitbit_at_meals_grouped(timestamp_start=None, timestamp_end=None, test_ids='all', values='all', bin_size=60, bin_unit='minute')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

  • bin_size (int, optional) – The width of the mobile window, defaults to 60.

  • bin_unit (str, optional) – The unit of the mobile window, defaults to minute. Options are minute, hour, day.

get_fitbit_results(timestamp_start=None, timestamp_end=None, test_ids='all', values='all')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

get_fitbit_results_grouped(timestamp_start=None, timestamp_end=None, test_ids='all', values='all', bin_size=60, bin_unit='minute')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

  • bin_size (int, optional) – The width of the mobile window, defaults to 60.

  • bin_unit (str, optional) – The unit of the mobile window, defaults to minute. Options are minute, hour, day.

get_meals_results(timestamp_start=None, timestamp_end=None, test_ids='all', ouput_format='unwinded')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • ouput_format (str) – unwinded|original

pycpshealthcare.db.MealTracker.participant_study module

class pycpshealthcare.db.MealTracker.participant_study.MealTrackerStudyOcurrence(study_info, connection)[source]

Bases: object

A study class. Has methods for getting the data of all the sensors and measures of the respective study. A study is defined as all the test ocurrences of a corresponding study type for all the participant.

get_fitbit_at_meals(timestamp_start=None, timestamp_end=None, values='all')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

get_fitbit_at_meals_grouped(timestamp_start=None, timestamp_end=None, values='all', bin_size=60, bin_unit='minute')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

  • bin_size (int, optional) – The width of the mobile window, defaults to 60.

  • bin_unit (str, optional) – The unit of the mobile window, defaults to minute. Options are minute, hour, day.

get_fitbit_results(timestamp_start=None, timestamp_end=None, values='all')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

get_fitbit_results_grouped(timestamp_start=None, timestamp_end=None, values='all', bin_size=60, bin_unit='minute')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

  • bin_size (int, optional) – The width of the mobile window, defaults to 60.

  • bin_unit (str, optional) – The unit of the mobile window, defaults to minute. Options are minute, hour, day.

get_meals_results(timestamp_start=None, timestamp_end=None, ouput_format='unwinded')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • ouput_format (str) – unwinded|original

class pycpshealthcare.db.MealTracker.participant_study.ParticipantMealTrackerStudiesGroup(data, connection)[source]

Bases: object

get_fitbit_at_meals(timestamp_start=None, timestamp_end=None, test_ids='all', values='all')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

get_fitbit_at_meals_grouped(timestamp_start=None, timestamp_end=None, test_ids='all', values='all', bin_size=60, bin_unit='minute')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

  • bin_size (int, optional) – The width of the mobile window, defaults to 60.

  • bin_unit (str, optional) – The unit of the mobile window, defaults to minute. Options are minute, hour, day.

get_fitbit_results(timestamp_start=None, timestamp_end=None, test_ids='all', values='all')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

get_fitbit_results_grouped(timestamp_start=None, timestamp_end=None, test_ids='all', values='all', bin_size=60, bin_unit='minute')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • values (str|list<str>|None, optional) – The names (keys) of the values of the sensors to be returned by the query, defaults to “all” that brings

  • bin_size (int, optional) – The width of the mobile window, defaults to 60.

  • bin_unit (str, optional) – The unit of the mobile window, defaults to minute. Options are minute, hour, day.

get_meals_results(timestamp_start=None, timestamp_end=None, test_ids='all', ouput_format='unwinded')[source]
Returns:

an iterable with the query results

Return type:

pycpshealthcare.db.results.StudyResults

Parameters:
  • timestamp_start (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results from start of records.

  • timestamp_end (datetime.datetime|None, optional) – Datetime start filter for query. If not specified query will bring results to end of records.

  • test_ids (int|list<int>|None, optional) – The ids of the tests to be queried, defaults to “all” that brings data of all the test ids.

  • ouput_format (str) – unwinded|original

get_test_instance(specific_test_id)[source]