%%WRITTEN BY CAGDAS

classdef MyZeoManager
    %MYZEOMANAGER Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
    end
    
    methods (Static)
        function getSleepPatterns(user)
            [FileName,PathName,FilterIndex] = uigetfile('*.csv');
            fid = fopen([PathName FileName]);
            read = fgets(fid); % the first line is header
            read = fgets(fid);

            while ischar(read)
                parsed = strsplit(read,',');
                Pattern.hypnogram = parsed(15);
                Pattern.session = datestr(str2num(parsed{2})/86400/1000 + datenum(1970,1,1));
                DatabaseManager.saveSleepPattern(Pattern,user.id,'MyZeo');
                read = fgets(fid);
            end
        end
    
end

