Exemplo n.º 1
0
Arquivo: doctors.py Projeto: p-p-m/tcp
	def move_holter_to_folder(self, holter):
		if not os.path.isdir(self._folder):
			pprint('creating folder:', os.path.split(self._folder)[1], self._engname)
			os.mkdir(self._folder)
		print 'holter:', os.path.split(holter)[1], ' >>> ', os.path.split(self._folder)[1], self._engname
		shutil.copy2(holter, self._folder)
		os.remove(holter)
Exemplo n.º 2
0
def _init_new_day():
    for doctor in all_doctors():
        prefolder = os.path.split(doctor.folder)[0]
        if os.path.split(doctor.folder)[1] != _today_date():
            pprint('init new day', _today_date())
            doctor.folder = os.path.join(prefolder, _today_date())
            doctor.save_doctor()
Exemplo n.º 3
0
def _reject_holter(holter):
    moved_holters_names = _get_all_holters_in_folder(DOCTORS)
    if os.path.split(holter)[1].lower() in moved_holters_names:
        pprint('holter:', os.path.split(holter)[1], '>>> rejected')
        shutil.copy2(holter, os.path.join(INBOX, 'rejected'))
        os.remove(holter)
        return True
    else:
        return False
Exemplo n.º 4
0
def _move_holters(holters):
    global next_doctor
    if holters:
        pprint('moving holters at:', datetime.datetime.now().strftime("%d-%m %H:%M"))
    for holter in holters:
        if _reject_holter(holter):
            continue
        next_doctor = _get_next_doctor(holter)
        next_doctor.move_holter_to_folder(holter)