예제 #1
0
class Importer(object):
        
    def __init__(self, uri=None, verbose=False):
        self.client = Client(uri, verbose)
    
    def import_all_patients(self, clinic):
        # all_patients = self.client.get_all_patients(clinic.te_id)
        # return all_patients
        # not sure what this returns since they all the RPC calls are failing
        # for me ATM
        # return self.update_local_patients(all_patients)
        raise NotImplemented, 'all these are failing for me, without any '\
                                'documentation I am unable to continue'
    
    def import_updated_patients(self, user, clinic, since, until):
        updated_patients = self.client.get_updated_patients(clinic.te_id, since, until)
        logger.info('Receiving updated patients for %s between %s and %s' % (
            clinic.name,
            since,
            until
        ))
        return self.update_local_patients(user, updated_patients)
    
    def update_local_patients(self, user, remote_patients):
        for remote_patient in remote_patients:
            try:
                yield self.update_local_patient(user, remote_patient)
            except IntegrityError, e:
                logger.exception('Failed to create Patient for: %s' % (remote_patient,))
예제 #2
0
class Importer(object):
    def __init__(self, uri=None, verbose=False):
        self.client = Client(uri, verbose)

    def import_all_patients(self, clinic):
        # all_patients = self.client.get_all_patients(clinic.te_id)
        # return all_patients
        # not sure what this returns since they all the RPC calls are failing
        # for me ATM
        # return self.update_local_patients(all_patients)
        raise NotImplemented, 'all these are failing for me, without any '\
                                'documentation I am unable to continue'

    def import_updated_patients(self, user, clinic, since, until):
        updated_patients = self.client.get_updated_patients(
            clinic.te_id, since, until)
        logger.info('Receiving updated patients for %s between %s and %s' %
                    (clinic.name, since, until))
        return self.update_local_patients(user, updated_patients)

    def update_local_patients(self, user, remote_patients):
        for remote_patient in remote_patients:
            try:
                yield self.update_local_patient(user, remote_patient)
            except IntegrityError, e:
                logger.exception('Failed to create Patient for: %s' %
                                 (remote_patient, ))
예제 #3
0
 def __init__(self, uri=None, verbose=False):
     self.client = Client(uri, verbose)
예제 #4
0
 def __init__(self, uri=None, verbose=False):
     self.client = Client(uri, verbose)