Beispiel #1
0
 def _get_client_ids(**kwargs):
     client_search_data = {
         'teams': 1,
         'client_id': 1,
         'last_name': 1,
         'first_name': 1,
         'text28': 1,
         'dob': 1,
         'ssn': 1,
         'primary_assigned': 1,
         'client_status_f': 'ALL ACTIVE'
     }
     id_source = kwargs['id_source']
     driver = kwargs['driver']
     results = driver.process_advanced_search('Clients', client_search_data)
     client_ids = [x[' Id'] for x in results]
     bullhorn = Bullhorn()
     for client_id in client_ids:
         new_task = {
             'task_name': 'get_client_encounter_ids',
             'task_kwargs': {
                 'client_id': client_id,
                 'id_source': id_source
             }
         }
         bullhorn.publish('new_event', os.environ['CREDIBLE_MANAGER_ARN'],
                          ajson.dumps(new_task))
     return client_ids
Beispiel #2
0
def task(event, context):
    logging.info(
        f'started a call for a borg task, event: {event}, context: {context}')
    task_name = event['task_name']
    task_kwargs = event.get('task_kwargs', {})
    if task_kwargs is None:
        task_kwargs = {}
    task_function = getattr(LeechTasks, f'_{task_name}')
    results = task_function(**task_kwargs)
    logging.info(
        f'completed a call for borg task, event: {event}, results: {results}')
    return ajson.dumps(results)
 def for_index(self):
     indexed_value = {
         'sid_value': str(self._id_value),
         'identifier_stem': str(self._identifier_stem),
         'internal_id': str(self._internal_id),
         'id_value': self._id_value,
         'object_type': self._object_type,
         'object_value': ajson.dumps(self),
         'object_properties': self._object_properties
     }
     if isinstance(self._id_value, int) or isinstance(
             self._id_value, Decimal):
         indexed_value['numeric_id_value'] = self._id_value
     for property_name, property_value in self._object_properties.items():
         indexed_value[property_name] = property_value
     return indexed_value
Beispiel #4
0
 def _get_client_encounter_ids(**kwargs):
     client_id = kwargs['client_id']
     encounter_search_data = {
         'clientvisit_id': 1,
         'client_id': client_id,
         'service_type': 1,
         'non_billable': 1,
         'consumer_name': 1,
         'staff_name': 1,
         'client_int_id': 1,
         'emp_int_id': 1,
         'non_billable1': 3,
         'visittype': 1,
         'orig_rate_amount': 1,
         'timein': 1,
         'data_dict_ids': 83
     }
     driver = kwargs['driver']
     try:
         results = driver.process_advanced_search('ClientVisit',
                                                  encounter_search_data)
     except RuntimeError as e:
         logging.error(
             f'runtime error retrieving values for client_id: {client_id}: {e}'
         )
         results = []
     encounter_ids = [x['Service ID'] for x in results]
     bullhorn = Bullhorn()
     for encounter_id in encounter_ids:
         new_task = {
             'task_name': 'get_encounter',
             'task_kwargs': {
                 'encounter_id': encounter_id,
                 'client_id': client_id,
                 'id_source': kwargs['id_source']
             }
         }
         bullhorn.publish('new_event', os.environ['CREDIBLE_MANAGER_ARN'],
                          ajson.dumps(new_task))
     return encounter_ids
Beispiel #5
0
def _upload_object(bucket_name, folder_name, object_name, obj):
    resource = boto3.resource('s3')
    object_key = f'{folder_name}/{object_name}'
    resource.Object(bucket_name, object_key).put(Body=ajson.dumps(obj))
Beispiel #6
0
 def _send_message(cls, message: Dict, is_vpc: bool = False):
     topic_arn = cls._topic_arn
     if is_vpc:
         topic_arn = cls._vpc_topic_arn
     cls._bullhorn.publish('new_event', topic_arn, ajson.dumps(message))
 def for_stub_index(self):
     return ajson.dumps(self)