Example #1
0
    def __init__(self):
        people = Person.objects()

        self.target_systems = {}

        # populate some dummy data in the bucket
        p = Person()
        p.first_name = 'test'
        p.last_name = 'test test'

        self.target_systems['test_doctor_123'] = {}
        for p in people:
            self.target_systems['test_doctor_123'][str(p.id)] = p
Example #2
0
def handshake():
    global stored_person
    incoming_json = request.get_json()
    print incoming_json
    target_id = incoming_json['target_system_id']
    user_id = incoming_json['username']

    # find our  user data and put it in the bucket
    try:
        u = User.objects(pk=user_id)[0]
        p = Person.objects(pk=user_id)[0]
        print u
        print p
        stored_person = p
        bucket.put(target_id, user_id, p)
    except ValidationError:
        return jsonify({
            'acknowledgement': False,
            'message': 'Could not find user with ID %s' % user_id
        })

    return jsonify({
        'acknowledgement': True,
        'messsage': 'Sending data to target %s' % target_id
    })
Example #3
0
def handshake():
    global stored_person
    incoming_json = request.get_json()
    print incoming_json
    target_id = incoming_json['target_system_id']
    user_id = incoming_json['username']

    # find our  user data and put it in the bucket
    try:
        u = User.objects(pk=user_id)[0]
        p = Person.objects(pk=user_id)[0]
        print u
        print p
        stored_person = p
        bucket.put(target_id, user_id, p)
    except ValidationError:
        return jsonify({'acknowledgement': False, 'message': 'Could not find user with ID %s' % user_id})

    return jsonify({'acknowledgement': True, 'messsage': 'Sending data to target %s' % target_id})
Example #4
0
def make_fake_people(number=10):

    result = []
    for i in xrange(number):
        p = Person()
        p.first_name = fake.first_name()
        p.last_name = fake.last_name()
        p.birth_date = fake.date()
        p.social_security = i
        p.emails = [fake.email()]
        p.sex = 'male' if fake.boolean() else 'female'
        p.marital_status = 'single' if fake.boolean() else 'single'
        p.religious_preference = 'unspecified'
        p.race = 'white'

        p.addresses = [make_fake_address()]
        p.phones = [fake.phone_number(), fake.phone_number()]
        result.append(p)

    return result
Example #5
0
def make_fake_people(number=10):

    result = []
    for i in xrange(number):
        p = Person()
        p.first_name = fake.first_name()
        p.last_name = fake.last_name()
        p.birth_date = fake.date()
        p.social_security = i
        p.emails = [fake.email()]
        p.sex = 'male' if fake.boolean() else 'female'
        p.marital_status = 'single' if fake.boolean() else 'single'
        p.religious_preference = 'unspecified'
        p.race = 'white'

        p.addresses = [ make_fake_address()]
        p.phones = [fake.phone_number(), fake.phone_number()]
        result.append(p)

    return result