Prep for AAPOR with Confex and NCSD STD. General clean up.

This commit is contained in:
Scott Idem
2023-05-02 09:50:24 -04:00
parent c687ade3fa
commit c1f68522aa
6 changed files with 519 additions and 96 deletions

View File

@@ -331,7 +331,7 @@ async def event_importing_create_update_w_external_id(
# ### BEGIN ### Event Importing ### event_importing_program_data() ###
# Based on the program import template the clients are given.
# Create and update locations, sessions, presentations, and presenters as needed.
# Updated 2022-10-07
# Updated 2023-05-01
@router.post('/event/{event_id}/importing/program_data', response_model=Resp_Body_Base)
async def event_importing_program_data(
event_id: str = Query(..., min_length=11, max_length=22),
@@ -410,6 +410,7 @@ async def event_importing_program_data(
'location_external_id': str, 'location_code': str, 'location_sort': int,
'presentation_external_id': str, 'presentation_code': str, 'presentation_sort': int,
'presenter_external_id': str, 'presenter_code': str, 'presenter_number': int, 'presenter_designations': str, 'presenter_sort': int,
'session_external_id': str, 'session_code': str, 'session_sort': int,
@@ -441,19 +442,22 @@ async def event_importing_program_data(
'Affiliations': 'presenter_presenter_affiliations',
'Company': 'presenter_presenter_affiliations',
'email': 'presenter_email',
'Email': 'presenter_email',
'Email Address': 'presenter_email',
'CC Email Address': 'presenter_cc_email',
'location_title': 'location_name',
'Location Code': 'location_code',
'session_location': 'location_code',
'Session Location': 'location_code',
'location_title': 'location_name',
'Location Name': 'location_name',
'session_location': 'location_name',
'Session Location': 'location_name',
# 'session_location': 'location_name',
'session_title': 'session_name',
'Session Code': 'session_code',
'Session Name': 'session_name',
'Session Hide': 'hide_session',
'presentation_title': 'presentation_name',
'Presentation Code': 'presentation_code',
@@ -462,6 +466,9 @@ async def event_importing_program_data(
'Presenter Code': 'presenter_code',
'Presenter Number': 'presenter_number', # for sorting
'Presenter Name': 'presenter_name',
'Presenter Notes': 'presenter_notes',
'Notes': 'presenter_notes',
},
inplace = True)
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -488,6 +495,7 @@ async def event_importing_program_data(
else:
log.warning('No location external ID or code was found. Creating one with the name...')
event_location_name = record.get('location_name', '').strip()
# event_location_code = event_location_name
event_location_external_id = f'{event_location_name}' # .strip()
log.debug(f'Event Location External ID: {event_location_external_id}')
@@ -547,7 +555,10 @@ async def event_importing_program_data(
event_location_data = {}
event_location_data['code'] = record.get('location_code')
event_location_data['event_id'] = event_id # INSERT and UPDATE the event_id just in case
event_location_data['name'] = record.get('location_name')
if record.get('location_name'):
event_location_data['name'] = record.get('location_name')
elif record.get('location_code'):
event_location_data['name'] = record.get('location_code')
event_location_data['enable'] = True
event_location_id = None
@@ -613,6 +624,9 @@ async def event_importing_program_data(
event_session_data['sort'] = record.get('session_sort')
if record.get('hide_session') in (True, 1, 'yes', 'Yes', 'YES'):
event_session_data['hide'] = True
event_session_data['enable'] = True
event_session_data['notes'] = record.get('session_notes')
@@ -670,15 +684,19 @@ async def event_importing_program_data(
event_presentation_data['name'] = record.get('presentation_name')
event_presentation_data['description'] = record.get('presentation_description')
event_presentation_data['start_datetime'] = record.get('presentation_start_datetime')
# event_presentation_start_datetime = record.get('presentation_start_date', '') + ' ' + record.get('presentation_start_time', '')
# event_presentation_data['start_datetime'] = event_presentation_start_datetime
data['presentation_start_datetime'] = event_presentation_data['start_datetime']
if record.get('presentation_start_datetime'):
event_presentation_data['start_datetime'] = record.get('presentation_start_datetime')
data['presentation_start_datetime'] = event_presentation_data['start_datetime']
else:
event_presentation_data['start_datetime'] = None
data['presentation_start_datetime'] = None
event_presentation_data['end_datetime'] = record.get('presentation_end_datetime')
# event_presentation_end_datetime = record.get('presentation_end_date', '') + ' ' + record.get('presentation_end_time', '')
# event_presentation_data['end_datetime'] = event_presentation_end_datetime
data['presentation_end_datetime'] = event_presentation_data['end_datetime']
if record.get('presentation_end_datetime'):
event_presentation_data['end_datetime'] = record.get('presentation_end_datetime')
data['presentation_end_datetime'] = event_presentation_data['end_datetime']
else:
event_presentation_data['end_datetime'] = None
data['presentation_end_datetime'] = None
event_presentation_data['sort'] = record.get('presentation_sort')