Work on a lot of things. Mainly cleaning up person and profile related fields in multiple tables.

This commit is contained in:
Scott Idem
2021-09-10 18:12:24 -04:00
parent 72820f08ae
commit 15fd32b252
20 changed files with 558 additions and 219 deletions

View File

@@ -5,9 +5,11 @@ from fastapi import File, UploadFile
from typing import Dict, List, Optional, Set, Union from typing import Dict, List, Optional, Set, Union
from pydantic import BaseModel, EmailStr, Field, PrivateAttr, ValidationError, validator from pydantic import BaseModel, EmailStr, Field, PrivateAttr, ValidationError, validator
from app.db_sql import redis_lookup_id_random, sql_insert, sql_select, sql_update from app.db_sql import get_id_random, redis_lookup_id_random, sql_insert, sql_select, sql_update
from app.lib_general import log, logging from app.lib_general import log, logging
from app.methods.hosted_file_methods import load_hosted_file_obj
from app.models.event_file_models import Event_File_Base from app.models.event_file_models import Event_File_Base
@@ -36,7 +38,9 @@ def create_event_file_obj(event_file_obj_new:Event_File_Base):
def load_event_file_obj( def load_event_file_obj(
event_file_id: int|str, event_file_id: int|str,
limit: int = 1000, limit: int = 1000,
model_as_dict: bool = False, model_as_dict: bool = True,
by_alias: bool = True,
exclude_unset: bool = False,
enabled: str = 'enabled', # enabled, disabled, all enabled: str = 'enabled', # enabled, disabled, all
inc_hosted_file: bool = False, inc_hosted_file: bool = False,
) -> Event_File_Base|dict|bool: ) -> Event_File_Base|dict|bool:
@@ -53,6 +57,11 @@ def load_event_file_obj(
else: else:
return False return False
if event_file_rec.get('for_type') and event_file_rec.get('for_id') and not event_file_rec.get('for_id_random'):
event_file_rec['for_id_random'] = get_id_random(event_file_rec.get('for_id'), table_name=event_file_rec.get('for_type'))
hosted_file_id = event_file_rec.get('hosted_file_id', None)
try: try:
event_file_obj = Event_File_Base(**event_file_rec) event_file_obj = Event_File_Base(**event_file_rec)
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -61,6 +70,18 @@ def load_event_file_obj(
log.error(e.json()) log.error(e.json())
return False return False
if inc_hosted_file and hosted_file_id:
log.info('Need to include hosted file...')
if hosted_file_obj := load_hosted_file_obj(
hosted_file_id = hosted_file_id,
enabled = enabled,
):
event_file_obj.hosted_file = hosted_file_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset)
else:
event_file_obj.hosted_file = None
else:
event_file_obj.hosted_file = None
# if inc_hosted_file: # if inc_hosted_file:
# x_id = event_file_rec.get('x_id', None) # x_id = event_file_rec.get('x_id', None)
# if x_obj_result := load_x_obj(x_id=x_id): # if x_obj_result := load_x_obj(x_id=x_id):
@@ -70,13 +91,114 @@ def load_event_file_obj(
# model_as_dict = True # model_as_dict = True
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if model_as_dict: if model_as_dict:
return event_file_obj.dict(by_alias=True, exclude_unset=False) # pylint: disable=no-member log.debug(event_file_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset)) # pylint: disable=no-member)
return event_file_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member
else: else:
return event_file_obj return event_file_obj
# ### END ### API Event File Methods ### load_event_file_obj() ### # ### END ### API Event File Methods ### load_event_file_obj() ###
# ### BEGIN ### API Event File Methods ### get_event_file_rec_list() ###
# Updated 2021-09-10
def get_event_file_rec_list(
for_type: str, # NOTE: This is not for_obj_type because the field name is actually for_type
for_id: int|str, # NOTE: This is not for_obj_id because the field name is actually for_id
file_purpose_id: int = None, # NOTE: Not prefixed with lu_
file_purpose: str = None,
priority: bool = None,
group: str = None,
# event_id: str = None,
# event_person_id: str = None,
# event_presentation_id: str = None,
# event_presenter_id: str = None,
# event_session_id: str = None,
enabled: str = 'enabled', # enabled, disabled, all
limit: int = 100,
) -> list|bool:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if for_id := redis_lookup_id_random(record_id_random=for_id, table_name=for_type): pass
else: return False
data = {}
data['for_type'] = for_type
data['for_id'] = for_id
data['file_purpose_id'] = file_purpose_id
data['file_purpose'] = file_purpose
data['priority'] = priority
# data['sort'] = sort
data['group'] = group # Same or similar as file purpose?
sql_for_type_id = f'`event_file`.for_type = :for_type AND `event_file`.for_id = :for_id'
if file_purpose_id:
sql_file_purpose_id = f'AND `event_file`.lu_file_purpose_id = :file_purpose_id'
else:
sql_file_purpose_id = ''
if file_purpose:
sql_file_purpose = f'AND `event_file`.file_purpose = :file_purpose'
else:
sql_file_purpose = ''
if priority:
sql_priority = f'AND `event_file`.priority = :priority'
else:
sql_priority = ''
if group:
sql_group = f'AND `event_file`.group = :group'
else:
sql_group = ''
if enabled in ['enabled', 'disabled', 'all']:
if enabled == 'enabled':
data['enable'] = True
sql_enabled = f'AND `event_file`.enable = :enable'
elif enabled == 'disabled':
data['enable'] = False
sql_enabled = f'AND `event_file`.enable = :enable'
elif enabled == 'all':
sql_enabled = ''
if limit:
data['limit'] = limit
sql_limit = f'LIMIT :limit'
else:
sql_limit = ''
sql = f"""
SELECT `event_file`.id AS 'event_file_id', `event_file`.id_random AS 'event_file_id_random'
FROM `event_file` AS `event_file`
WHERE
{sql_for_type_id}
{sql_file_purpose_id}
{sql_file_purpose}
{sql_priority}
{sql_group}
{sql_enabled}
ORDER BY `event_file`.created_on DESC, `event_file`.updated_on DESC
{sql_limit};
"""
if event_file_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
event_file_rec_li = event_file_rec_li_result
else:
event_file_rec_li = []
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_file_rec_li_result)
log.debug(type(event_file_rec_li))
log.debug(len(event_file_rec_li))
return event_file_rec_li
# ### END ### API Event File Methods ### get_event_file_rec_list() ###
# ### BEGIN ### API Event File Methods ### load_event_file_obj_list() ### # ### BEGIN ### API Event File Methods ### load_event_file_obj_list() ###
def load_event_file_obj_list( def load_event_file_obj_list(

View File

@@ -32,6 +32,10 @@ def load_event_person_obj(
by_alias: bool = True, by_alias: bool = True,
exclude_unset: bool = True, exclude_unset: bool = True,
model_as_dict: bool = False, model_as_dict: bool = False,
event_file_file_purpose_id: int = None,
event_file_file_purpose: str = None,
event_file_priority: bool = None,
event_file_group: str = None,
inc_address: bool = False, inc_address: bool = False,
inc_contact: bool = False, inc_contact: bool = False,
inc_event_abstract_list: bool = False, inc_event_abstract_list: bool = False,
@@ -97,8 +101,8 @@ def load_event_person_obj(
# Updated 2021-09-07 # Updated 2021-09-07
if inc_event_person_profile: if inc_event_person_profile:
log.info('Need to include event person profile data...')
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL # log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event person profile data...')
if event_person_profile_obj := load_event_person_profile_obj( if event_person_profile_obj := load_event_person_profile_obj(
event_person_profile_id = event_person_profile_id event_person_profile_id = event_person_profile_id
): ):
@@ -110,9 +114,10 @@ def load_event_person_obj(
if inc_event_presentation_list: pass if inc_event_presentation_list: pass
# Updated 2021-09-10
if inc_event_presenter_list: if inc_event_presenter_list:
log.info('Need to include event presenter list...')
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event presenter list...')
from app.methods.event_presenter_methods import get_event_presenter_rec_list, load_event_presenter_obj from app.methods.event_presenter_methods import get_event_presenter_rec_list, load_event_presenter_obj
if event_presenter_rec_list_result := get_event_presenter_rec_list( if event_presenter_rec_list_result := get_event_presenter_rec_list(
event_person_id = event_person_id, event_person_id = event_person_id,
@@ -179,20 +184,21 @@ def load_event_person_obj(
# ### BEGIN ### API Event Person Methods ### get_event_person_rec_list() ### # ### BEGIN ### API Event Person Methods ### get_event_person_rec_list() ###
# for_obj_type: account, event, event_registration, event_badge, person, user # for_obj_type: account, event, event_registration, event_badge, person, user
# Updated 2021-09-10
def get_event_person_rec_list( def get_event_person_rec_list(
for_obj_type: str, for_obj_type: str, # NOTE: This is not for_type because the field name generated based
for_obj_id: str, for_obj_id: str, # NOTE: This is not for_id because the field name generated based
limit: int = 1000,
enabled: str = 'enabled', # enabled, disabled, all enabled: str = 'enabled', # enabled, disabled, all
limit: int = 1000,
) -> list|bool: ) -> list|bool:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals()) log.debug(locals())
if for_obj_id := redis_lookup_id_random(record_id_random=for_obj_id, table_name=for_obj_type): pass if for_obj_id := redis_lookup_id_random(record_id_random=for_obj_id, table_name=for_obj_type): pass
else: return False else: return False
data = {} data = {}
data[f'{for_obj_type}_id'] = for_obj_id data[f'{for_obj_type}_id'] = for_obj_id
# data['for_obj_type'] = for_obj_type
sql_obj_type_id = f'`tbl`.{for_obj_type}_id = :{for_obj_type}_id' sql_obj_type_id = f'`tbl`.{for_obj_type}_id = :{for_obj_type}_id'
# if enabled in ['enabled', 'disabled', 'all']: # if enabled in ['enabled', 'disabled', 'all']:

View File

@@ -24,6 +24,13 @@ def load_event_presentation_obj(
event_presentation_id: int|str, event_presentation_id: int|str,
enabled: str = 'enabled', # enabled, disabled, all enabled: str = 'enabled', # enabled, disabled, all
limit: int = 1000, limit: int = 1000,
by_alias: bool = True,
exclude_unset: bool = True,
model_as_dict: bool = False,
event_file_file_purpose_id: int = None,
event_file_file_purpose: str = None,
event_file_priority: bool = None,
event_file_group: str = None,
inc_address: bool = False, inc_address: bool = False,
inc_contact: bool = False, inc_contact: bool = False,
inc_event_abstract_list: bool = False, inc_event_abstract_list: bool = False,
@@ -37,6 +44,7 @@ def load_event_presentation_obj(
inc_event_presenter_list: bool = False, inc_event_presenter_list: bool = False,
inc_event_registration: bool = False, inc_event_registration: bool = False,
#inc_event_registration_list: bool = False, #inc_event_registration_list: bool = False,
inc_event_session: bool = False,
inc_person: bool = False, inc_person: bool = False,
inc_user: bool = False, inc_user: bool = False,
) -> Event_Presentation_Base|bool: ) -> Event_Presentation_Base|bool:
@@ -46,101 +54,119 @@ def load_event_presentation_obj(
if event_presentation_id := redis_lookup_id_random(record_id_random=event_presentation_id, table_name='event_presentation'): pass if event_presentation_id := redis_lookup_id_random(record_id_random=event_presentation_id, table_name='event_presentation'): pass
else: return False else: return False
if event_presentation_rec := sql_select(table_name='v_event_presentation', record_id=event_presentation_id): if event_presentation_rec := sql_select(table_name='v_event_presentation', record_id=event_presentation_id): pass
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL else: return False
log.debug(event_presentation_rec)
try: # log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
event_presentation_obj = Event_Presentation_Base(**event_presentation_rec) log.debug(event_presentation_rec)
log.debug(event_presentation_obj)
except ValidationError as e:
log.error(e.json())
return False
# event_presentation_obj = Event_Presentation_Base(**event_presentation_rec) try:
# log.debug(event_presentation_obj) log.info('Try to apply event presentation record data to Event_Presentation_Base...')
event_presentation_obj = Event_Presentation_Base(**event_presentation_rec)
#return False log.debug(event_presentation_obj)
except ValidationError as e:
#account_id = event_presentation_rec.get('account_id', None) log.error(e.json())
event_id = event_presentation_rec.get('event_id', None)
event_abstract_id = event_presentation_rec.get('event_abstract_id', None)
event_person_id = event_presentation_rec.get('event_person_id', None)
event_session_id = event_presentation_rec.get('event_session_id', None)
#if inc_event: pass
if inc_event_abstract_list: pass
#if inc_event_badge_list: pass
if inc_event_device_list: pass
if inc_event_file_list: pass
if inc_event_person_list: pass
if inc_event_presenter_list:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
data = {}
data['event_presentation_id'] = event_presentation_id
if enabled in ['enabled', 'disabled', 'all']:
if enabled == 'enabled':
data['enable'] = True
sql_enabled = f'AND `event_presenter`.enable = :enable'
elif enabled == 'disabled':
data['enable'] = False
sql_enabled = f'AND `event_presenter`.enable = :enable'
elif enabled == 'all':
sql_enabled = ''
# else: event_obj['event_session'] = None
# if limit:
# data['limit'] = limit
# sql_limit = f'LIMIT :limit'
# else:
# sql_limit = ''
sql = f"""
SELECT `event_presenter`.id AS 'event_presenter_id', `event_presenter`.id_random AS 'event_presenter_id_random'
FROM `event_presenter` AS `event_presenter`
WHERE `event_presenter`.event_presentation_id = :event_presentation_id
{sql_enabled}
ORDER BY `event_presenter`.created_on DESC, `event_presenter`.updated_on DESC;
"""
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if event_presenter_obj_li_result := sql_select(data=data, sql=sql, as_list=True):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_presenter_obj_li_result)
event_presenter_obj_li = []
for event_presenter_obj in event_presenter_obj_li_result:
event_presenter_id = event_presenter_obj.get('event_presenter_id', None)
if event_presenter_obj := load_event_presenter_obj(
event_presenter_id = event_presenter_id,
enabled = enabled,
inc_address = inc_address,
inc_contact = inc_contact,
inc_event_abstract_list = inc_event_abstract_list,
inc_event_badge = inc_event_badge,
inc_event_device_list = inc_event_device_list,
inc_event_file_list = inc_event_file_list,
inc_event_person = inc_event_person,
inc_event_person_profile = inc_event_person_profile,
inc_event_registration = inc_event_registration,
inc_person = inc_person,
inc_user = inc_user,
):
data = event_presenter_obj.dict(by_alias=True, exclude_unset=True)
event_presenter_obj_li.append(data)
log.debug(event_presenter_obj_li)
event_presentation_obj.event_presenter_list = event_presenter_obj_li
else:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_presenter_obj_li_result)
event_presentation_obj.event_presenter_list = []
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
#if inc_user: pass
else:
return False return False
return event_presentation_obj # event_presentation_obj = Event_Presentation_Base(**event_presentation_rec)
# log.debug(event_presentation_obj)
# account_id = event_presentation_rec.get('account_id', None)
event_id = event_presentation_rec.get('event_id', None)
event_abstract_id = event_presentation_rec.get('event_abstract_id', None)
event_person_id = event_presentation_rec.get('event_person_id', None)
event_session_id = event_presentation_rec.get('event_session_id', None)
# if inc_event: pass
if inc_event_abstract_list: pass
# if inc_event_badge_list: pass
if inc_event_device_list: pass
if inc_event_file_list: pass
if inc_event_person_list: pass
if inc_event_presenter_list:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
data = {}
data['event_presentation_id'] = event_presentation_id
if enabled in ['enabled', 'disabled', 'all']:
if enabled == 'enabled':
data['enable'] = True
sql_enabled = f'AND `event_presenter`.enable = :enable'
elif enabled == 'disabled':
data['enable'] = False
sql_enabled = f'AND `event_presenter`.enable = :enable'
elif enabled == 'all':
sql_enabled = ''
# else: event_obj['event_session'] = None
# if limit:
# data['limit'] = limit
# sql_limit = f'LIMIT :limit'
# else:
# sql_limit = ''
sql = f"""
SELECT `event_presenter`.id AS 'event_presenter_id', `event_presenter`.id_random AS 'event_presenter_id_random'
FROM `event_presenter` AS `event_presenter`
WHERE `event_presenter`.event_presentation_id = :event_presentation_id
{sql_enabled}
ORDER BY `event_presenter`.created_on DESC, `event_presenter`.updated_on DESC;
"""
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if event_presenter_obj_li_result := sql_select(data=data, sql=sql, as_list=True):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_presenter_obj_li_result)
event_presenter_obj_li = []
for event_presenter_obj in event_presenter_obj_li_result:
event_presenter_id = event_presenter_obj.get('event_presenter_id', None)
if event_presenter_obj := load_event_presenter_obj(
event_presenter_id = event_presenter_id,
enabled = enabled,
inc_address = inc_address,
inc_contact = inc_contact,
inc_event_abstract_list = inc_event_abstract_list,
inc_event_badge = inc_event_badge,
inc_event_device_list = inc_event_device_list,
inc_event_file_list = inc_event_file_list,
inc_event_person = inc_event_person,
inc_event_person_profile = inc_event_person_profile,
inc_event_registration = inc_event_registration,
inc_person = inc_person,
inc_user = inc_user,
):
data = event_presenter_obj.dict(by_alias=True, exclude_unset=True)
event_presenter_obj_li.append(data)
log.debug(event_presenter_obj_li)
event_presentation_obj.event_presenter_list = event_presenter_obj_li
else:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_presenter_obj_li_result)
event_presentation_obj.event_presenter_list = []
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if inc_event_session:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
from app.methods.event_session_methods import load_event_session_obj
if event_session_obj := load_event_session_obj(
event_session_id = event_session_id,
# Don't append the presentation list and things
):
log.debug(event_session_obj)
event_presentation_obj.event_session = event_session_obj
else:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_session_obj)
event_presentation_obj.event_session = None
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if model_as_dict:
return event_presentation_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member
else:
return event_presentation_obj
# ### END ### API Event Presentation Methods ### load_event_presentation_obj() ### # ### END ### API Event Presentation Methods ### load_event_presentation_obj() ###

View File

@@ -23,6 +23,10 @@ def load_event_presenter_obj(
by_alias: bool = True, by_alias: bool = True,
exclude_unset: bool = True, exclude_unset: bool = True,
model_as_dict: bool = False, model_as_dict: bool = False,
event_file_file_purpose_id: int = None,
event_file_file_purpose: str = None,
event_file_priority: bool = None,
event_file_group: str = None,
inc_address: bool = False, inc_address: bool = False,
inc_contact: bool = False, inc_contact: bool = False,
inc_event_abstract_list: bool = False, # For event_presenter and using load_event_person_obj inc_event_abstract_list: bool = False, # For event_presenter and using load_event_person_obj
@@ -32,8 +36,9 @@ def load_event_presenter_obj(
inc_event_person: bool = False, # Using load_event_person_obj inc_event_person: bool = False, # Using load_event_person_obj
inc_event_person_profile: bool = False, # Using load_event_person_obj inc_event_person_profile: bool = False, # Using load_event_person_obj
inc_event_presentation: bool = False, inc_event_presentation: bool = False,
inc_event_presentation_list: bool = False, # Using load_event_session_obj
inc_event_registration: bool = False, # Using load_event_person_obj inc_event_registration: bool = False, # Using load_event_person_obj
# inc_event_session: bool = False, inc_event_session: bool = False,
inc_person: bool = False, # Using load_event_person_obj inc_person: bool = False, # Using load_event_person_obj
inc_user: bool = False, # Using load_event_person_obj inc_user: bool = False, # Using load_event_person_obj
) -> Event_Presenter_Base|bool: ) -> Event_Presenter_Base|bool:
@@ -72,22 +77,58 @@ def load_event_presenter_obj(
# if inc_event: pass # if inc_event: pass
if inc_event_abstract_list: pass if inc_event_abstract_list: pass
if inc_event_device_list: pass if inc_event_device_list: pass
if inc_event_file_list: pass
if inc_event_file_list:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event file list...')
from app.methods.event_file_methods import get_event_file_rec_list, load_event_file_obj
if event_file_rec_list_result := get_event_file_rec_list(
for_type = 'event_presenter',
for_id = event_presenter_id,
file_purpose_id = event_file_file_purpose_id,
file_purpose = event_file_file_purpose,
priority = event_file_priority,
group = event_file_group,
enabled = enabled,
limit = limit,
):
event_file_result_list = []
for event_file_rec in event_file_rec_list_result:
if load_event_file_result := load_event_file_obj(
event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled,
limit = limit,
# inc_hosted_file = inc_hosted_file,
# by_alias = by_alias,
# exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
):
event_file_result_list.append(load_event_file_result)
else:
event_file_result_list.append(None)
log.debug(event_file_result_list)
event_presenter_obj.event_file_list = event_file_result_list
elif isinstance(event_file_rec_list_result, list):
event_presenter_obj.event_file_list = []
else:
event_presenter_obj.event_file_list = None
if inc_event_person: if inc_event_person:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event person...')
if event_person_obj := load_event_person_obj( if event_person_obj := load_event_person_obj(
event_person_id = event_person_id, event_person_id = event_person_id,
enabled = enabled, enabled = enabled,
inc_address = inc_address, inc_address = inc_address,
inc_contact = inc_contact, inc_contact = inc_contact,
inc_event_badge = inc_event_badge, inc_event_badge = inc_event_badge,
inc_event_person_profile = inc_event_person_profile, inc_event_person_profile = inc_event_person_profile,
inc_event_registration = inc_event_registration, inc_event_registration = inc_event_registration,
inc_person = inc_person, inc_person = inc_person,
inc_user = inc_user, inc_user = inc_user,
): ):
log.debug(event_person_obj) log.debug(event_person_obj)
event_presenter_obj.event_person = event_person_obj event_presenter_obj.event_person = event_person_obj
else: else:
@@ -98,11 +139,14 @@ def load_event_presenter_obj(
if inc_event_presentation: if inc_event_presentation:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event presentation...')
from app.methods.event_presentation_methods import load_event_presentation_obj from app.methods.event_presentation_methods import load_event_presentation_obj
if event_presentation_obj := load_event_presentation_obj( if event_presentation_obj := load_event_presentation_obj(
event_presentation_id = event_presentation_id, event_presentation_id = event_presentation_id,
): # Don't append the session, presentation list, and things
):
log.debug(event_presentation_obj) log.debug(event_presentation_obj)
event_presenter_obj.event_presentation = event_presentation_obj event_presenter_obj.event_presentation = event_presentation_obj
else: else:
@@ -111,6 +155,24 @@ def load_event_presenter_obj(
event_presenter_obj.event_presentation = None event_presenter_obj.event_presentation = None
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if inc_event_session:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event session...')
from app.methods.event_session_methods import load_event_session_obj
if event_session_obj := load_event_session_obj(
event_session_id = event_session_id,
inc_event_presentation_list = inc_event_presentation_list,
):
log.debug(event_session_obj)
event_presenter_obj.event_session = event_session_obj
else:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_session_obj)
event_presenter_obj.event_session = None
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if model_as_dict: if model_as_dict:
return event_presenter_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member return event_presenter_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member
else: else:
@@ -132,8 +194,8 @@ def get_event_presenter_rec_list(
else: return False else: return False
data = {} data = {}
data[f'event_person_id'] = event_person_id data['event_person_id'] = event_person_id
data[f'event_presentation_id'] = event_presentation_id data['event_presentation_id'] = event_presentation_id
if event_person_id: if event_person_id:
sql_where_event_person_id = f'`event_presenter`.event_person_id = :event_person_id' sql_where_event_person_id = f'`event_presenter`.event_person_id = :event_person_id'

View File

@@ -27,6 +27,10 @@ def load_event_session_obj(
exclude_unset: bool = True, exclude_unset: bool = True,
model_as_dict: bool = False, model_as_dict: bool = False,
enabled: str = 'enabled', # enabled, disabled, all enabled: str = 'enabled', # enabled, disabled, all
event_file_file_purpose_id: int = None,
event_file_file_purpose: str = None,
event_file_priority: bool = None,
event_file_group: str = None,
inc_address: bool = False, inc_address: bool = False,
inc_contact: bool = False, inc_contact: bool = False,
inc_event_abstract_list: bool = False, inc_event_abstract_list: bool = False,
@@ -42,6 +46,7 @@ def load_event_session_obj(
inc_event_presenter_list: bool = False, inc_event_presenter_list: bool = False,
inc_event_registration_list: bool = False, inc_event_registration_list: bool = False,
inc_event_track: bool = False, inc_event_track: bool = False,
inc_hosted_file: bool = False,
inc_poc_event_person: bool = False, inc_poc_event_person: bool = False,
inc_person: bool = False, inc_person: bool = False,
inc_user: bool = False, inc_user: bool = False,
@@ -79,20 +84,56 @@ def load_event_session_obj(
if inc_event_file_list: pass if inc_event_file_list: pass
if inc_event_file_list: if inc_event_file_list:
if event_file_dict_list := load_event_file_obj_list( log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
event_session_id = event_session_id, log.info('Need to include event file list...')
limit = limit,
model_as_dict = model_as_dict, from app.methods.event_file_methods import get_event_file_rec_list, load_event_file_obj
enabled = enabled, if event_file_rec_list_result := get_event_file_rec_list(
): for_type = 'event_session',
event_session_obj.event_file_list = event_file_dict_list for_id = event_session_id,
else: event_session_obj.event_file_list = [] file_purpose_id = event_file_file_purpose_id,
file_purpose = event_file_file_purpose,
priority = event_file_priority,
group = event_file_group,
enabled = enabled,
limit = limit,
):
event_file_result_list = []
for event_file_rec in event_file_rec_list_result:
if load_event_file_result := load_event_file_obj(
event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled,
limit = limit,
inc_hosted_file = inc_hosted_file,
# model_as_dict = True,
# by_alias = by_alias,
# exclude_unset = False,
):
event_file_result_list.append(load_event_file_result)
else:
event_file_result_list.append(None)
log.debug(event_file_result_list)
event_session_obj.event_file_list = event_file_result_list
elif isinstance(event_file_rec_list_result, list):
event_session_obj.event_file_list = []
else:
event_session_obj.event_file_list = None
# if event_file_dict_list := load_event_file_obj_list(
# event_session_id = event_session_id,
# limit = limit,
# model_as_dict = model_as_dict,
# enabled = enabled,
# ):
# event_session_obj.event_file_list = event_file_dict_list
# else: event_session_obj.event_file_list = []
if inc_event_location and event_location_id: if inc_event_location and event_location_id:
log.info('Need to include event location...')
if event_location_obj := load_event_location_obj( if event_location_obj := load_event_location_obj(
event_location_id=event_location_id, event_location_id = event_location_id,
enabled=enabled, enabled = enabled,
): ):
event_session_obj.event_location = event_location_obj.dict(by_alias=True, exclude_unset=True) event_session_obj.event_location = event_location_obj.dict(by_alias=True, exclude_unset=True)
else: else:
event_session_obj.event_location = None event_session_obj.event_location = None

View File

@@ -89,7 +89,7 @@ base_fields['obj_id'] = {}
base_fields['obj_name'] = {} base_fields['obj_name'] = {}
base_fields['obj_notes'] = {} base_fields['obj_notes'] = {}
base_fields['for_id_random'] = xxx_id_random_field_schema_default # NOTE: This field may need to be set = None in the actual models with this field. # base_fields['for_id_random'] = xxx_id_random_field_schema_default # NOTE: This field may need to be set = None in the actual models with this field.
#xxx_id_random_field_schema['alias'] = 'order_id_random' #xxx_id_random_field_schema['alias'] = 'order_id_random'
#base_fields['id_random'] = xxx_id_random_field_schema_default #base_fields['id_random'] = xxx_id_random_field_schema_default

View File

@@ -40,20 +40,27 @@ class Cont_Edu_Cert_Person_Base(BaseModel):
external_id: Optional[str] external_id: Optional[str]
pronouns: Optional[str] # Preferred pronouns
informal_name: Optional[str] informal_name: Optional[str]
title_names: Optional[str] # Title for generation, official position, or professional or academic qualification, other honorific, or other name prefix
given_name: Optional[str] given_name: Optional[str]
family_name: Optional[str]
middle_name: Optional[str] middle_name: Optional[str]
# prefix: Optional[str] family_name: Optional[str]
# suffix: Optional[str] designations: Optional[str] # Temporary or long-term designations related to family, relationships, person differentiation (Junior/Senior), location, social status, professional qualifications, legal status, or other name suffix
full_name: Optional[str]
informal_full_name: Optional[str] professional_title: Optional[str] # Professional title
last_first_name: Optional[str] # title: Optional[str] # NOTE: Phasing out! Use *professional_title* instead.
display_name: Optional[str] # Custom whatever they want for public display display_name: Optional[str] # Custom whatever they want for public display
title: Optional[str] # BEGIN # Auto created name variations
last_first_name: Optional[str]
full_name: Optional[str]
informal_full_name: Optional[str]
organization_name: Optional[str] affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
# organization_name: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
email: Optional[str] email: Optional[str]

View File

@@ -72,7 +72,7 @@ class Contact_Base(BaseModel):
other_text: Optional[str] other_text: Optional[str]
other_json: Optional[Json] other_json: Optional[Json]
priority: Optional[int] priority: Optional[bool]
sort: Optional[int] sort: Optional[int]
group: Optional[str] group: Optional[str]

View File

@@ -32,24 +32,33 @@ class Event_Badge_Base(BaseModel):
person_id_random: Optional[str] person_id_random: Optional[str]
person_id: Optional[int] person_id: Optional[int]
pronoun: Optional[str] pronouns: Optional[str] # Preferred pronouns
informal_name: Optional[str] informal_name: Optional[str]
title_names: Optional[str] # Title for generation, official position, or professional or academic qualification, other honorific, or other name prefix
given_name: Optional[str] given_name: Optional[str]
middle_name: Optional[str]
family_name: Optional[str] family_name: Optional[str]
full_name: Optional[str] designations: Optional[str] # Temporary or long-term designations related to family, relationships, person differentiation (Junior/Senior), location, social status, professional qualifications, legal status, or other name suffix
degree: Optional[str] # NOTE: Phasing out! Use *designations* instead.
degrees: Optional[str] # NOTE: Phasing out! Use *designations* instead.
credentials: Optional[str] # NOTE: Phasing out! Use *designations* instead.
professional_title: Optional[str] # Professional title
title: Optional[str] # NOTE: Phasing out! Use *professional_title* instead.
display_name: Optional[str] # Actual name shown on badge and other "public" areas display_name: Optional[str] # Actual name shown on badge and other "public" areas
# BEGIN # Auto created name variations
full_name: Optional[str] # title_names given_name middle_name family_name designations
affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
affiliation: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
affiliation_name: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
email: Optional[str] email: Optional[str]
degree: Optional[str]
degrees: Optional[str] # Do we want this?
credentials: Optional[str]
title: Optional[str]
affiliation: Optional[str]
affiliations: Optional[str] # Do we want this?
affiliation_name: Optional[str] # Actual affiliation name(s) shown on badge and other "public" areas
city: Optional[str] city: Optional[str]
county: Optional[str] # NOTE: This is for a county within a state or province county: Optional[str] # NOTE: This is for a county within a state or province
state_province: Optional[str] state_province: Optional[str]

View File

@@ -4,7 +4,7 @@ import datetime, hashlib, logging, os, pytz, redis, secrets
from typing import Dict, List, Optional, Set, Union from typing import Dict, List, Optional, Set, Union
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
from app.db_sql import redis_lookup_id_random, get_id_random from app.db_sql import get_id_random, redis_lookup_id_random
from app.lib_general import log, logging from app.lib_general import log, logging
from app.models.common_field_schema import base_fields, default_num_bytes from app.models.common_field_schema import base_fields, default_num_bytes
@@ -27,11 +27,12 @@ class Event_File_Base(BaseModel):
hosted_file_id_random: Optional[str] hosted_file_id_random: Optional[str]
hosted_file_id: Optional[int] hosted_file_id: Optional[int]
# NOTE: Handeling this outside of the Pydantic model and model validation. See below as well. -STI 2021-09-10
for_type: Optional[str] for_type: Optional[str]
# for_id: Optional[int] # NOTE: This is reversed with for_id_random I HAVE NO IDEA 2021-08-26 4:05 AM for_id: Optional[int] # NOTE: This is reversed with for_id_random
# for_id_random: Optional[str] # NOTE: This is reversed with for_id I HAVE NO IDEA 2021-08-26 4:05 AM for_id_random: Optional[str] # NOTE: This is reversed with for_id
for_id_random: Optional[str] # for_id_random: Optional[str] = None # Need to override value from common_field_schema.py
for_id: Optional[int] # for_id: Optional[int]
event_id_random: Optional[str] event_id_random: Optional[str]
event_id: Optional[int] event_id: Optional[int]
@@ -64,7 +65,7 @@ class Event_File_Base(BaseModel):
priority: Optional[bool] priority: Optional[bool]
sort: Optional[int] sort: Optional[int]
group: Optional[str] group: Optional[str] # Same or similar as file_purpose?
# notes: Optional[str] # notes: Optional[str]
created_on: Optional[datetime.datetime] = None created_on: Optional[datetime.datetime] = None
@@ -166,23 +167,26 @@ class Event_File_Base(BaseModel):
return redis_lookup_id_random(record_id_random=values['event_track_id_random'], table_name='event_track') return redis_lookup_id_random(record_id_random=values['event_track_id_random'], table_name='event_track')
return None return None
# NOTE: I kind of give up on this. Handeling this outside of Pydantic and before the data is even attempted to be loaded into the Event_File_Base model. -STI 2021-09-10
# NOTE: This validator will try to find and "set" the for_id_random value. However, The value is not really "set" in Pydantic. To get this value, exclude_unset=True when returning a dict from the model.
# @validator('for_id_random', always=True) # @validator('for_id_random', always=True)
# def for_id_random_lookup(cls, v, values, **kwargs): # def for_id_random_lookup(cls, v, values, **kwargs):
# log.setLevel(logging.DEBUG) # log.setLevel(logging.WARNING)
# log.debug(locals()) # log.debug(locals())
# if values['for_id'] and values['for_type']: # if values.get('for_id') and values['for_type']:
# return get_id_random(record_id=values['for_id'], table_name=values['for_type']) # return get_id_random(record_id=values['for_id'], table_name=values['for_type'])
# return None # return None
@validator('for_id', always=True) # @validator('for_id', always=True)
def for_id_lookup(cls, v, values, **kwargs): # def for_id_lookup(cls, v, values, **kwargs):
log.setLevel(logging.DEBUG) # log.setLevel(logging.DEBUG)
log.debug(locals()) # log.debug(locals())
if values['for_id_random'] and values['for_type']: # if values.get('for_id_random', None) and values['for_type']:
return redis_lookup_id_random(record_id_random=values['for_id_random'], table_name=values['for_type']) # return redis_lookup_id_random(record_id_random=values['for_id_random'], table_name=values['for_type'])
return None # # return None
# else: return v
class Config: class Config:
underscore_attrs_are_private = True underscore_attrs_are_private = True

View File

@@ -212,7 +212,7 @@ class Event_Person_New_Base(BaseModel):
person_full_name: Optional[str] person_full_name: Optional[str]
person_display_name: Optional[str] person_display_name: Optional[str]
organization_name: Optional[str] affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
email: Optional[str] email: Optional[str]

View File

@@ -41,18 +41,23 @@ class Event_Person_Profile_Base(BaseModel):
organization_id_random: Optional[str] organization_id_random: Optional[str]
organization_id: Optional[int] organization_id: Optional[int]
pronoun: Optional[str] pronouns: Optional[str] # Preferred pronouns
informal_name: Optional[str] informal_name: Optional[str]
title_names: Optional[str] # Title for generation, official position, or professional or academic qualification, other honorific, or other name prefix
given_name: Optional[str] given_name: Optional[str]
middle_name: Optional[str]
family_name: Optional[str] family_name: Optional[str]
full_name: Optional[str] designations: Optional[str] # Temporary or long-term designations related to family, relationships, person differentiation (Junior/Senior), location, social status, professional qualifications, legal status, or other name suffix
display_name: Optional[str] # Actual name shown in "public" areas. Maybe overridden by event_badge or event_presenter.
title: Optional[str] professional_title: Optional[str] # Professional title
affiliation: Optional[str] display_name: Optional[str] # Actual name shown in the directory and other "public" areas
degrees: Optional[str]
credentials: Optional[str] # BEGIN # Auto created name variations
full_name: Optional[str] # title_names given_name middle_name family_name designations
affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
tagline: Optional[str] tagline: Optional[str]
biography: Optional[str] biography: Optional[str]

View File

@@ -139,5 +139,3 @@ class Event_Presentation_Base(BaseModel):
underscore_attrs_are_private = True underscore_attrs_are_private = True
allow_population_by_field_name = True allow_population_by_field_name = True
fields = base_fields fields = base_fields
#Event_Presentation_Base.update_forward_refs()

View File

@@ -61,26 +61,37 @@ class Event_Presenter_Base(BaseModel):
code: Optional[str] code: Optional[str]
pronouns: Optional[str] # Preferred pronouns
informal_name: Optional[str] # Informal or nick name they commonly go by
title_names: Optional[str] # Title for generation, official position, or professional or academic qualification, other honorific, or other name prefix
prefix: Optional[str] # NOTE: Phasing out! Use *title_names* instead.
given_name: Optional[str] given_name: Optional[str]
family_name: Optional[str]
middle_name: Optional[str] middle_name: Optional[str]
prefix: Optional[str] family_name: Optional[str]
suffix: Optional[str] designations: Optional[str] # Temporary or long-term designations related to family, relationships, person differentiation (Junior/Senior), location, social status, professional qualifications, legal status, or other name suffix
suffix: Optional[str] # NOTE: Phasing out! Use *designations* instead.
professional_title: Optional[str] # Professional title
title: Optional[str] # NOTE: Phasing out! Use *professional_title* instead.
display_name: Optional[str] # Custom what they want for public display
full_name: Optional[str] full_name: Optional[str]
informal_name: Optional[str]
title: Optional[str] degree: Optional[str] # NOTE: Phasing out! Use *designations* instead.
degrees: Optional[str] # NOTE: Phasing out! Use *designations* instead.
credentials: Optional[str] # NOTE: Phasing out! Use *designations* instead.
affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
affiliation: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
email: Optional[str] email: Optional[str]
degree: Optional[str]
degrees: Optional[str] # Do we want this?
credentials: Optional[str]
affiliation: Optional[str]
affiliations: Optional[str] # Do we want this?
website_url: Optional[str] website_url: Optional[str]
tagline: Optional[str]
biography: Optional[str] biography: Optional[str]
picture_path: Optional[str] picture_path: Optional[str]
picture_bg_color: Optional[str] picture_bg_color: Optional[str]
@@ -112,8 +123,12 @@ class Event_Presenter_Base(BaseModel):
event_file_list: Optional[list] # Optional[Event_File_Base] event_file_list: Optional[list] # Optional[Event_File_Base]
# event_location: Optional[Event_Location_Base] # event_location: Optional[Event_Location_Base]
event_person: Optional[Event_Person_Base] event_person: Optional[Event_Person_Base]
# event_presentation: Optional[Event_Presentation_Base] if __name__ == '__main__':
event_presentation: Optional[dict] from app.models.event_presentation_models import Event_Presentation_Base
event_presentation: Optional[Event_Presentation_Base]
else:
event_presentation: Optional[dict]
# event_presentation: Optional[dict]
# event_session: Optional[Event_Session_Base] # event_session: Optional[Event_Session_Base]
event_session: Optional[dict] event_session: Optional[dict]
# event_track: Optional[Event_Track_Base] # event_track: Optional[Event_Track_Base]
@@ -190,5 +205,3 @@ class Event_Presenter_Base(BaseModel):
underscore_attrs_are_private = True underscore_attrs_are_private = True
allow_population_by_field_name = True allow_population_by_field_name = True
fields = base_fields fields = base_fields
#Event_Presenter_Base.update_forward_refs()

View File

@@ -39,14 +39,16 @@ class Log_Client_Viewing_Base(BaseModel):
name: Optional[str] name: Optional[str]
given_name: Optional[str]
family_name: Optional[str]
middle_name: Optional[str]
prefix: Optional[str]
suffix: Optional[str]
full_name: Optional[str]
informal_name: Optional[str] informal_name: Optional[str]
title_names: Optional[str]
given_name: Optional[str]
middle_name: Optional[str]
family_name: Optional[str]
designations: Optional[str]
full_name: Optional[str]
source: Optional[str] source: Optional[str]
url_root: Optional[str] url_root: Optional[str]
url_full_path: Optional[str] url_full_path: Optional[str]

View File

@@ -35,7 +35,27 @@ class Membership_Person_Profile_Base(BaseModel):
organization_id_random: Optional[str] organization_id_random: Optional[str]
organization_id: Optional[int] organization_id: Optional[int]
display_name: Optional[str] # pronouns: Optional[str] # Preferred pronouns
# informal_name: Optional[str]
# title_names: Optional[str] # Title for generation, official position, or professional or academic qualification, other honorific, or other name prefix
# given_name: Optional[str]
# middle_name: Optional[str]
# family_name: Optional[str]
# designations: Optional[str] # Temporary or long-term designations related to family, relationships, person differentiation (Junior/Senior), location, social status, professional qualifications, legal status, or other name suffix
professional_title: Optional[str] # Professional title
display_name: Optional[str] # Actual name shown in the directory and other "public" areas
# BEGIN # Auto created name variations
full_name: Optional[str] # title_names given_name middle_name family_name designations
affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
tagline: Optional[str]
biography: Optional[str]
email: Optional[str] email: Optional[str]
email_allowed: Optional[bool] email_allowed: Optional[bool]

View File

@@ -42,22 +42,40 @@ class Person_Base(BaseModel):
membership_person_id_random: Optional[str] # Linked from membership_person using the v_person view membership_person_id_random: Optional[str] # Linked from membership_person using the v_person view
membership_person_id: Optional[int] # Linked from membership_person using the v_person view membership_person_id: Optional[int] # Linked from membership_person using the v_person view
informal_name: Optional[str] pronouns: Optional[str] # Preferred pronouns
informal_name: Optional[str] # Informal or nick name they commonly go by
title_names: Optional[str] # Title for generation, official position, or professional or academic qualification, other honorific, or other name prefix
prefix: Optional[str] # NOTE: Phasing out! Use *title_names* instead.
given_name: Optional[str] given_name: Optional[str]
family_name: Optional[str]
middle_name: Optional[str] middle_name: Optional[str]
prefix: Optional[str] family_name: Optional[str]
suffix: Optional[str] designations: Optional[str] # Temporary or long-term designations related to family, relationships, person differentiation (Junior/Senior), location, social status, professional qualifications, legal status, or other name suffix
designation: Optional[str] # NOTE: Phasing out! Use *designations* instead.
suffix: Optional[str] # NOTE: Phasing out! Use *designations* instead.
full_name: Optional[str] # May be auto created from informal, given, family, etc if not given professional_title: Optional[str] # Professional title
informal_full_name: Optional[str] # Auto created title: Optional[str] # NOTE: Phasing out! Use *professional_title* instead.
last_first_name: Optional[str] # Auto created
display_name: Optional[str] # Custom whatever they want for public display
title: Optional[str] display_name: Optional[str] # Custom what they want for public display
designation: Optional[str] informal_display_name: Optional[str] # Custom what they want for informal public display
professional_display_name: Optional[str] # Custom what they want for professional public display. This should include professional title.
organization_name: Optional[str] preferred_display_name: Optional[str] # '', 'informal', 'professional'
# BEGIN # Auto created name variations
first_last_name: Optional[str] # With SQL view?
first_middle_last_name: Optional[str] # With SQL view?
last_first_name: Optional[str] # With SQL view?
last_first_middle_name: Optional[str] # With SQL view?
full_name: Optional[str] # title_names given_name middle_name family_name designations
informal_full_name: Optional[str] # informal_name family_name May be auto created from informal, given, family, etc if not given
professional_full_name: Optional[str] # title_names given_name middle_name family_name designations professional_title
# END # Auto created name variations
affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
affiliation: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
organization_name: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
tagline: Optional[str] tagline: Optional[str]

View File

@@ -192,7 +192,7 @@ async def v2_post_event_person_new(
else: else:
new_password = secrets.token_urlsafe(default_num_bytes) new_password = secrets.token_urlsafe(default_num_bytes)
organization_name = event_person_new_init.organization_name affiliations = event_person_new_init.affiliations
# New person # New person
person_new = {} person_new = {}
@@ -201,7 +201,7 @@ async def v2_post_event_person_new(
person_new['family_name'] = family_name person_new['family_name'] = family_name
person_new['full_name'] = full_name person_new['full_name'] = full_name
person_new['display_name'] = display_name person_new['display_name'] = display_name
person_new['organization_name'] = organization_name person_new['affiliations'] = affiliations
# New person contact # New person contact
person_new['contact'] = {} person_new['contact'] = {}

View File

@@ -249,7 +249,7 @@ async def get_event_presenter_obj(
# inc_event_presentation_list: bool = False, # NOTE: Placehold for future? # inc_event_presentation_list: bool = False, # NOTE: Placehold for future?
# inc_event_presenter_list: bool = False, # NOTE: Placehold for future? # inc_event_presenter_list: bool = False, # NOTE: Placehold for future?
inc_event_registration: bool = False, # Under event_person obj inc_event_registration: bool = False, # Under event_person obj
# inc_event_session: bool = False, # NOTE: Placehold for future? inc_event_session: bool = False, # NOTE: Placehold for future?
# inc_event_session_list: bool = False, # NOTE: Placehold for future? # inc_event_session_list: bool = False, # NOTE: Placehold for future?
inc_person: bool = False, # Under event_person obj inc_person: bool = False, # Under event_person obj
inc_user: bool = False, # Under event_person obj inc_user: bool = False, # Under event_person obj
@@ -279,7 +279,7 @@ async def get_event_presenter_obj(
inc_event_person_profile = inc_event_person_profile, inc_event_person_profile = inc_event_person_profile,
inc_event_presentation = inc_event_presentation, inc_event_presentation = inc_event_presentation,
inc_event_registration = inc_event_registration, inc_event_registration = inc_event_registration,
# inc_event_session = inc_event_session, inc_event_session = inc_event_session,
inc_person = inc_person, inc_person = inc_person,
inc_user = inc_user, inc_user = inc_user,
): ):

View File

@@ -166,8 +166,8 @@ async def importing_person_data_v2(
person_data['family_name'] = record['family_name'] person_data['family_name'] = record['family_name']
else: else:
person_data['family_name'] = None person_data['family_name'] = None
if name_prefix := record.get('name_prefix', None): person_data['prefix'] = name_prefix if name_prefix := record.get('name_prefix', None): person_data['title_names'] = name_prefix
if name_suffix := record.get('name_suffix', None): person_data['suffix'] = name_suffix if name_suffix := record.get('name_suffix', None): person_data['designations'] = name_suffix
if person_data['given_name'] and person_data['middle_name'] and person_data['family_name']: if person_data['given_name'] and person_data['middle_name'] and person_data['family_name']:
person_data['full_name'] = person_data['given_name']+' '+person_data['middle_name']+' '+person_data['family_name'] person_data['full_name'] = person_data['given_name']+' '+person_data['middle_name']+' '+person_data['family_name']
elif person_data['given_name'] and person_data['family_name']: elif person_data['given_name'] and person_data['family_name']:
@@ -187,9 +187,15 @@ async def importing_person_data_v2(
person_data['last_first_name'] = record.get('last_first_name', None) person_data['last_first_name'] = record.get('last_first_name', None)
if designation := record.get('designation', None): if designation := record.get('designation', None):
person_data['designation'] = designation # professional designation if person_data['designations']:
person_data['designations'] = person_data['designations'] + ' ' + designation # professional designation
else:
person_data['designations'] = designation # professional designation
elif designation := record.get('professional_designations', None): elif designation := record.get('professional_designations', None):
person_data['designation'] = designation if person_data['designations']:
person_data['designations'] = person_data['designations'] + ' ' + designation # professional designation
else:
person_data['designations'] = designation # professional designation
if birth_date := record.get('date_of_birth', None): if birth_date := record.get('date_of_birth', None):
person_data['birth_date'] = birth_date person_data['birth_date'] = birth_date
@@ -775,8 +781,8 @@ async def importing_person_data(
person_data['family_name'] = record['family_name'] person_data['family_name'] = record['family_name']
else: else:
person_data['family_name'] = None person_data['family_name'] = None
# person_data['prefix'] = record['prefix'] # person_data['designations'] = record['prefix']
person_data['suffix'] = record['suffix'] person_data['designations'] = record['suffix']
if person_data['given_name'] and person_data['middle_name'] and person_data['family_name']: if person_data['given_name'] and person_data['middle_name'] and person_data['family_name']:
person_data['full_name'] = person_data['given_name']+' '+person_data['middle_name']+' '+person_data['family_name'] person_data['full_name'] = person_data['given_name']+' '+person_data['middle_name']+' '+person_data['family_name']
elif person_data['given_name'] and person_data['family_name']: elif person_data['given_name'] and person_data['family_name']: