Work on a lot of things. Mainly cleaning up person and profile related fields in multiple tables.
This commit is contained in:
@@ -89,7 +89,7 @@ base_fields['obj_id'] = {}
|
||||
base_fields['obj_name'] = {}
|
||||
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'
|
||||
#base_fields['id_random'] = xxx_id_random_field_schema_default
|
||||
|
||||
@@ -40,20 +40,27 @@ class Cont_Edu_Cert_Person_Base(BaseModel):
|
||||
|
||||
external_id: 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]
|
||||
family_name: Optional[str]
|
||||
middle_name: Optional[str]
|
||||
# prefix: Optional[str]
|
||||
# suffix: Optional[str]
|
||||
full_name: Optional[str]
|
||||
informal_full_name: Optional[str]
|
||||
last_first_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
|
||||
# title: Optional[str] # NOTE: Phasing out! Use *professional_title* instead.
|
||||
|
||||
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]
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class Contact_Base(BaseModel):
|
||||
other_text: Optional[str]
|
||||
other_json: Optional[Json]
|
||||
|
||||
priority: Optional[int]
|
||||
priority: Optional[bool]
|
||||
sort: Optional[int]
|
||||
group: Optional[str]
|
||||
|
||||
|
||||
@@ -32,24 +32,33 @@ class Event_Badge_Base(BaseModel):
|
||||
person_id_random: Optional[str]
|
||||
person_id: Optional[int]
|
||||
|
||||
pronoun: 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]
|
||||
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
|
||||
|
||||
# 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]
|
||||
|
||||
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]
|
||||
county: Optional[str] # NOTE: This is for a county within a state or province
|
||||
state_province: Optional[str]
|
||||
|
||||
@@ -4,7 +4,7 @@ import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
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.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: 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_id: Optional[int] # NOTE: This is reversed with for_id_random I HAVE NO IDEA 2021-08-26 4:05 AM
|
||||
# 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]
|
||||
for_id: Optional[int]
|
||||
for_id: Optional[int] # NOTE: This is reversed with for_id_random
|
||||
for_id_random: Optional[str] # NOTE: This is reversed with for_id
|
||||
# for_id_random: Optional[str] = None # Need to override value from common_field_schema.py
|
||||
# for_id: Optional[int]
|
||||
|
||||
event_id_random: Optional[str]
|
||||
event_id: Optional[int]
|
||||
@@ -64,7 +65,7 @@ class Event_File_Base(BaseModel):
|
||||
|
||||
priority: Optional[bool]
|
||||
sort: Optional[int]
|
||||
group: Optional[str]
|
||||
group: Optional[str] # Same or similar as file_purpose?
|
||||
|
||||
# notes: Optional[str]
|
||||
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 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)
|
||||
# def for_id_random_lookup(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.DEBUG)
|
||||
# log.setLevel(logging.WARNING)
|
||||
# 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 None
|
||||
|
||||
@validator('for_id', always=True)
|
||||
def for_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.DEBUG)
|
||||
log.debug(locals())
|
||||
# @validator('for_id', always=True)
|
||||
# def for_id_lookup(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.DEBUG)
|
||||
# log.debug(locals())
|
||||
|
||||
if values['for_id_random'] and values['for_type']:
|
||||
return redis_lookup_id_random(record_id_random=values['for_id_random'], table_name=values['for_type'])
|
||||
return None
|
||||
# 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 None
|
||||
# else: return v
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
|
||||
@@ -212,7 +212,7 @@ class Event_Person_New_Base(BaseModel):
|
||||
person_full_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]
|
||||
|
||||
@@ -275,4 +275,4 @@ class Event_Person_New_Base(BaseModel):
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
fields = base_fields
|
||||
|
||||
@@ -41,18 +41,23 @@ class Event_Person_Profile_Base(BaseModel):
|
||||
organization_id_random: Optional[str]
|
||||
organization_id: Optional[int]
|
||||
|
||||
pronoun: 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]
|
||||
full_name: Optional[str]
|
||||
display_name: Optional[str] # Actual name shown in "public" areas. Maybe overridden by event_badge or event_presenter.
|
||||
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
|
||||
|
||||
title: Optional[str]
|
||||
professional_title: Optional[str] # Professional title
|
||||
|
||||
affiliation: Optional[str]
|
||||
degrees: Optional[str]
|
||||
credentials: Optional[str]
|
||||
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]
|
||||
|
||||
@@ -139,5 +139,3 @@ class Event_Presentation_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Event_Presentation_Base.update_forward_refs()
|
||||
|
||||
@@ -61,26 +61,37 @@ class Event_Presenter_Base(BaseModel):
|
||||
|
||||
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]
|
||||
family_name: Optional[str]
|
||||
middle_name: Optional[str]
|
||||
prefix: Optional[str]
|
||||
suffix: 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
|
||||
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]
|
||||
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]
|
||||
|
||||
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]
|
||||
|
||||
tagline: Optional[str]
|
||||
biography: Optional[str]
|
||||
|
||||
picture_path: 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_location: Optional[Event_Location_Base]
|
||||
event_person: Optional[Event_Person_Base]
|
||||
# event_presentation: Optional[Event_Presentation_Base]
|
||||
event_presentation: Optional[dict]
|
||||
if __name__ == '__main__':
|
||||
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[dict]
|
||||
# event_track: Optional[Event_Track_Base]
|
||||
@@ -190,5 +205,3 @@ class Event_Presenter_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Event_Presenter_Base.update_forward_refs()
|
||||
|
||||
@@ -39,14 +39,16 @@ class Log_Client_Viewing_Base(BaseModel):
|
||||
|
||||
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]
|
||||
|
||||
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]
|
||||
url_root: Optional[str]
|
||||
url_full_path: Optional[str]
|
||||
|
||||
@@ -35,7 +35,27 @@ class Membership_Person_Profile_Base(BaseModel):
|
||||
organization_id_random: Optional[str]
|
||||
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_allowed: Optional[bool]
|
||||
|
||||
@@ -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: 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]
|
||||
family_name: Optional[str]
|
||||
middle_name: Optional[str]
|
||||
prefix: Optional[str]
|
||||
suffix: 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
|
||||
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
|
||||
informal_full_name: Optional[str] # Auto created
|
||||
last_first_name: Optional[str] # Auto created
|
||||
display_name: Optional[str] # Custom whatever they want for public display
|
||||
professional_title: Optional[str] # Professional title
|
||||
title: Optional[str] # NOTE: Phasing out! Use *professional_title* instead.
|
||||
|
||||
title: Optional[str]
|
||||
designation: Optional[str]
|
||||
display_name: Optional[str] # Custom what they want for public display
|
||||
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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user