Database Models¶
Our RDBMS layer is very interesting: obviously it incorporates all of the traditional elements - all SQLAlchemy, but in order to be resiliant, we’ve a lot of JSON fields. These all have Pydantic models associated with them, so everything is deeply Pythonic.
- class lbn.aidoc.models.Application¶
Bases:
BaseModelStructured JSON layout for a complete job application document set.
- class CVProfile¶
Bases:
BaseModel- model_config = {'arbitrary_types_allowed': True, 'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class LetterProfile¶
Bases:
BaseModel- model_config = {'arbitrary_types_allowed': True, 'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- __init__(**data: Any)¶
Surgical Constructor: Seamlessly intercepts input shapes, converting raw nested dictionaries into deep, dot-notation queryable sub-objects.
- model_config = {'arbitrary_types_allowed': True, 'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.Comment¶
Bases:
SQLModel- __init__(**data)¶
- as_str()¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property parent¶
Automatically extracts the database session from itself to find the parent model.
- property parent_class¶
- class lbn.aidoc.models.Company¶
Bases:
BaseEntity- __init__(**data)¶
- as_str()¶
Abstract string serialization method.
Must be explicitly overridden by every child model to pass system tests.
- id¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- state: EntityStatus¶
- stints: Mapped[List[EmploymentHistory]]¶
- class lbn.aidoc.models.CompanyAlias¶
Bases:
SQLModel- __init__(**data)¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.EmploymentHistory¶
Bases:
SQLModelThe Ledger: Tracks who works (or worked) where.
- __init__(**data)¶
- archetype: Archetype¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod validate_styled_enums(v, info)¶
The ‘Inhale Handshake’: Forces Pydantic to use the StyledEnum constructor. This re-attaches the .style metadata lost during AI extraction.
- class lbn.aidoc.models.Financials¶
Bases:
SQLModelFinancial information, and state/processing of said information
- __init__(**data)¶
- data: FinancialData¶
- initiative: Mapped[Initiative | None]¶
- model_config = {'from_attributes': True, 'ignored_types': (<class 'sqlalchemy.ext.hybrid.hybrid_property'>,), 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- state: FinancialsStatus¶
- class lbn.aidoc.models.History¶
Bases:
SQLModelfor state machine transition histories
- __init__(**data)¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.Initiative¶
Bases:
SQLModelA project/initiative - bucket of financials, people, tasks
- __init__(**data)¶
- as_str()¶
- financials: Mapped[List[Financials]]¶
- get_financial_record(name: str) Financials | None¶
Safely extracts a specific financial variant row matching the lookup name.
- initiative_type: InitiativeType¶
- model_config = {'from_attributes': True, 'ignored_types': (<class 'sqlalchemy.ext.hybrid.hybrid_property'>,), 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- priority: Priority¶
- state: InitiativeStatus¶
- classmethod validate_styled_enums(v, info)¶
The ‘Inhale Handshake’: Forces Pydantic to use the StyledEnum constructor. Re-attaches the color metadata attributes during extraction swaps.
- class lbn.aidoc.models.Interview¶
Bases:
BaseEntity- __init__(**data)¶
- as_ical() str¶
Surgical Export: Generates a valid iCalendar byte string using the icalendar library.
- as_str()¶
Abstract string serialization method.
Must be explicitly overridden by every child model to pass system tests.
- property attendees: List[Person]¶
Surgical Lookahead: Direct session query to resolve the JSON list of IDs. Returns a list of Person objects matching the internal array registry.
- id¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- predecessors() List[Interview]¶
Walks backwards up the chain of predecessor links. Returns a list of all prior interview objects, sorted chronologically.
- state: MeetingStatus¶
- classmethod validate_styled_enums(v, info)¶
The ‘Inhale Handshake’: Forces Pydantic to use the StyledEnum constructor. This re-attaches the .style metadata lost during AI extraction.
- class lbn.aidoc.models.Job¶
Bases:
SQLModel- __init__(**data)¶
- annual_equivalent¶
- as_str()¶
- ingested¶
- job_style: JobStyle¶
- job_type: JobType¶
- model_config = {'from_attributes': True, 'ignored_types': (<class 'sqlalchemy.ext.hybrid.hybrid_property'>,), 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- priority: Priority¶
- salary_period: SalaryPeriod¶
- state: JobStatus¶
- classmethod validate_styled_enums(v, info)¶
The ‘Inhale Handshake’: Forces Pydantic to use the StyledEnum constructor. This re-attaches the .style metadata lost during AI extraction.
- class lbn.aidoc.models.Person¶
Bases:
BaseEntityThe Master Address Book: Purely digital presence. Independence: No relationships or back-links defined here.
- __init__(**data)¶
- as_str()¶
Abstract string serialization method.
Must be explicitly overridden by every child model to pass system tests.
- check_password(raw_password: str) bool¶
Verify an incoming password attempt against the database hash.
- colleagues(current_only: bool = True) List[Person]¶
Returns a list of all distinct people who work (or worked) at the same companies.
Executes a native SQL self-join on the ledger, completely bypassing in-memory loops.
- first_name()¶
- id¶
- last_name()¶
- property latest_stint: EmploymentHistory | None¶
Returns the newest stint based on primary key ID fallback.
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- set_password(raw_password: str) None¶
Hash a password securely using Python 3.13 standard libraries.
- state: EntityStatus¶
- stints: Mapped[List[EmploymentHistory]]¶
- class lbn.aidoc.models.PersonAlias¶
Bases:
SQLModel- __init__(**data)¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.Prompt¶
Bases:
SQLModelan LLM instruction, with well defined inputs and outputs
- __init__(**data)¶
- compile(**kwargs) List[Dict[str, str]]¶
The ‘Inhale’: Uses the input_model to resolve defaults and satisfy ‘required’ constraints before the slurp.
- input_model() Type[BaseModel]¶
The ‘Inhale Contractor’: Dynamic validation block for input parameters. Recursively compiles a genuine Pydantic model contract straight from the stored input_schema JSON dictionary.
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- output_model() Type[BaseModel]¶
The ‘Inhale Contractor’: High-fidelity type mapping. Recursively compiles a genuine, deeply nested Pydantic model contract straight from the stored output_schema JSON dictionary.
- weight: Weight¶
- class lbn.aidoc.models.RSTFile¶
Bases:
SQLModel- __init__(**data)¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.Source¶
Bases:
SQLModel- __init__(**data)¶
- classmethod get_by_url(session: Session, url: str) Source¶
The Discovery Drill: Resolves Source by domain or falls back to ‘General’. PRINCIPAL: Guaranteed to return a Source object.
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.Tag¶
Bases:
SQLModelSurgical Metadata: Dynamic labels with built-in style.
- __init__(**data)¶
- as_str()¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.TagLink¶
Bases:
SQLModelThe Glue: Polymorphic Many-to-Many link with a standard ID.
- __init__(**data)¶
- model_config = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lbn.aidoc.models.Task¶
Bases:
BaseEntityTODO/Task List
- __init__(**data)¶
- as_todoist_payload() dict¶
Surgical Export: Generates a clean Todoist payload schema mapping. Translates our StyledEnum priorities into Todoist’s 1-4 numeric envelope.
- id¶
- is_blocked¶
- model_config = {'from_attributes': True, 'ignored_types': (<class 'sqlalchemy.ext.hybrid.hybrid_property'>,), 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- priority: Priority¶
- state: TaskStatus¶
- classmethod validate_styled_enums(v, info)¶
The ‘Inhale Handshake’: Forces Pydantic to use the StyledEnum constructor. This re-attaches the .style metadata lost during database serialization.
- lbn.aidoc.models.find_person(session: Session, name: str = None, email: str = None)¶
The ‘Identity Drill’: Resolves Person via name/email or Name Alias. Surgically strikes only existing hardware columns. No redundant imports.
- lbn.aidoc.models.get_comments_for(session, item)¶
Retrieves all narrative notes for the parent item.
- lbn.aidoc.models.get_tags_for(session, item) List[Tag]¶
Surgical Retrieval: Reaches into the TagLink silo for any arbitrary model.
- lbn.aidoc.models.make_comment(item, content, category='note', timestamp=None)¶
Surgically injects a narrative comment against any hunting stakeholder model. Forces parent types to match get_comments_for extraction queries.