def create_legacy_datasets(): domain = 'legacy' module = 'legacy' LocalDataset('observation',{},['process_observation'],domain,module) observation = dcarte.load('observation','legacy') LocalDataset('device_type',{},['process_device_type'],domain,module) device_type = dcarte.load('device_type','legacy') LocalDataset('flags',{},['process_flags'],domain,module) flags = dcarte.load('flags','legacy') LocalDataset('wellbeing',{},['process_wellbeing'],domain,module) wellbeing = dcarte.load('wellbeing','legacy') for dataset in ['motion', 'doors', 'physiology', 'temperature', 'activity', 'light']: LocalDataset(dataset_name= dataset, datasets = {'observation': observation, 'device_type': device_type}, pipeline = [f'process_{dataset}'], domain = domain, module = module, dependencies = [['observation','legacy'],['device_type','legacy']]) LocalDataset(dataset_name = 'entryway', datasets = {'doors': dcarte.load('doors','legacy')}, pipeline = ['process_entryway'], domain = domain, module = module, dependencies = [['doors','legacy']])
def create_base_datasets(): domain = 'base' module = 'base' parent_datasets = { 'Doors': [['door', 'raw']], 'Entryway': [['doors', 'base']], 'Habitat': [['environmental', 'raw'], ['device_types', 'lookup']], 'Kitchen': [['appliances', 'raw'], ['doors', 'base'], ['activity', 'raw'], ['device_types', 'lookup']], 'Motion': [['activity', 'raw'], ['entryway', 'base'], ['sleep_event', 'raw']], 'Physiology': [['vital_signs', 'raw'], ['blood_pressure', 'raw'], ['device_types', 'lookup']], 'Sleep': [['sleep_mat', 'raw']], 'Transitions': [['motion', 'base']] } for dataset in [ 'Doors', 'Entryway', 'Habitat', 'Kitchen', 'Motion', 'Physiology', 'Sleep', 'Transitions' ]: p_datasets = {d[0]: dcarte.load(*d) for d in parent_datasets[dataset]} LocalDataset(dataset_name=dataset, datasets=p_datasets, pipeline=[f'process_{dataset.lower()}'], domain=domain, module=module, dependencies=parent_datasets[dataset])
def create_bed_occupancy(): dataset_name = 'bed_occupancy' datasets = {'sleep': dcarte.load('sleep', 'base')} pipeline = ['process_outcome'] domain = 'bed_habits' module = 'bed_occupancy' df = LocalDataset(dataset_name=dataset_name, datasets=datasets, pipeline=pipeline, domain=domain, module=module, update=True, dependencies=[['sleep', 'base']])
def create_weekly_profile(): module = "weekly_profile" data_type = 'profile' LocalDataset('activity_dailies',{'motion': dcarte.load('motion','base')}, ['activity_dailies'],data_type , module,[['motion','base']]) LocalDataset('activity_weeklies',{'activity_dailies': dcarte.load('activity_dailies','profile')}, ['activity_weeklies'],data_type , module,[['activity_dailies','profile']]) LocalDataset('sleep_dailies',{'sleep': dcarte.load('sleep','base')}, ['sleep_dailies'],data_type , module,[['sleep','base']]) LocalDataset('sleep_weeklies',{'sleep_dailies': dcarte.load('sleep_dailies','profile')}, ['sleep_weeklies'],data_type , module,[['sleep_dailies','profile']]) LocalDataset('physiology_dailies',{'physiology': dcarte.load('physiology','base')}, ['physiology_dailies'],data_type , module,[['physiology','base']]) LocalDataset('physiology_weeklies',{'physiology_dailies': dcarte.load('physiology_dailies','profile')}, ['physiology_weeklies'],data_type , module,[['physiology_dailies','profile']]) LocalDataset('light',{'Habitat': dcarte.load('Habitat','base')}, ['process_light'],data_type , module,[['Habitat','base']]) LocalDataset('temperature',{'Habitat': dcarte.load('Habitat','base')}, ['process_temperature'],data_type , module,[['Habitat','base']])
def create_weekly_profile(): module_path = __file__ # since = '2022-02-10' # until = '2022-02-20' module = "weekly_profile" domain = 'profile' parent_datasets = { 'activity_dailies':[['motion','base']], 'activity_weeklies':[['activity_dailies','profile']], 'sleep_dailies':[['sleep','base']], 'sleep_weeklies':[['sleep_dailies','profile']], 'physiology_dailies':[['physiology','base']], 'physiology_weeklies':[['physiology_dailies','profile']], 'light':[['Habitat','base']], 'temperature':[['Habitat','base']]} for dataset in parent_datasets.keys(): p_datasets = {d[0]:dcarte.load(*d) for d in parent_datasets[dataset]} LocalDataset(dataset_name = dataset, datasets = p_datasets, pipeline = [f'process_{dataset.lower()}'], domain = domain, module = module, module_path = module_path, reload = True, dependencies = parent_datasets[dataset])
import dcarte print(dcarte.__version__) Local_Sleep = dcarte.load('Local_Sleep', 'sleep_study', update=True)
import sys import os sys.path.insert(0, os.path.abspath("/Users/eyalsoreq/github/DCARTE/")) import dcarte df = dcarte.load('activity', 'raw', update=True)