Skip to content

Data Diagram

jcadam14 edited this page Mar 18, 2024 · 6 revisions
---
title: Filing API Database Classes
---
classDiagram
    %%class `FilingTaskDAO(Base):`{
    %%  __tablename__ = "filing_task"
    %%  name: Mapped[str] = mapped_column#40;primary_key=True#41;
    %%  task_order: Mapped[int]
   %%}

    %%class `FilingTaskStateDAO(Base):`{
    %% __tablename__ = "filing_task_state"
    %%  id: Mapped[int] = mapped_column#40;primary_key=True, autoincrement=True#41;
    %%  filing: Mapped[int] = mapped_column#40;ForeignKey#40;"filing.id"#41;#41;
    %%  task_name: Mapped[str] = mapped_column#40;ForeignKey#40;"filing_task.name"#41;#41;
    %%  user: Mapped[str] = mapped_column#40;nullable=True#41;
    %%  state: Mapped[enum] = mapped_column#40;server_default=TaskStateEnum.STARTED#41;
    %%  change_timestamp: Mapped[datetime] = mapped_column#40;server_default=datetime.now#40;#41;#41;
   %%}

   %%class `FilingTaskStateEnum:`{
    %%   NOT_STARTED,
    %%   IN_PROGRESS,
    %%   COMPLETED
  %% }

    class `FilingDAO(AuditMixin, Base):`{
      __tablename__ = "filing"
    id: Mapped[int] = mapped_column#40;primary_key=True, autoincrement=True#41;
    filing_period: Mapped[str] = mapped_column#40;ForeignKey#40;"filing_period.code"#41;#41;
    lei: Mapped[str]
    tasks: Mapped[List[FilingTaskProgressDAO] | None] = relationship#40;lazy="selectin", cascade="all, delete-orphan"#41;
    institution_snapshot_id: Mapped[str]
    contact_info: Mapped[ContactInfoDAO] = relationship#40;"ContactInfoDAO", lazy="joined"#41;
    confirmation_id: Mapped[str] = mapped_column#40;nullable=True#41;
   }

class `FilingPeriodDAO(AuditMixin, Base):`{
    __tablename__ = "filing_period"
    code: Mapped[str] = mapped_column#40;primary_key=True#41;
    description: Mapped[str]
    start_period: Mapped[datetime]
    end_period: Mapped[datetime]
    due: Mapped[datetime]
    filing_type: Mapped[FilingType] = mapped_column#40;Enum#40;FilingType#41;#41;
}

class `SubmissionDAO(AuditMixin, Base):`{
    __tablename__ = "submission"
    id: Mapped[int] = mapped_column#40;index=True, primary_key=True, autoincrement=True#41;
    filing: Mapped[int] = mapped_column#40;ForeignKey#40;"filing.id"#41;#41;
    submitter: Mapped[str]
    state: Mapped[SubmissionState] = mapped_column#40;SAEnum#40;SubmissionState#41;#41;
    validation_ruleset_version: Mapped[str] = mapped_column#40;nullable=True#41;
    validation_json: Mapped[dict[str, Any]] = mapped_column#40;JSON, nullable=True#41;
    submission_time: Mapped[datetime] = mapped_column#40;server_default=func.now#40;#41;#41;
    filename: Mapped[str]
    accepter: Mapped[str] = mapped_column#40;nullable=True#41;
}

class `ContactInfoDAO(Base):`{
    __tablename__ = "contact_info"
    id: Mapped[int] = mapped_column#40;primary_key=True, autoincrement=True#41;
    filing: Mapped[int] = mapped_column#40;ForeignKey#40;"filing.id"#41;#41;
    first_name: Mapped[str]
    last_name: Mapped[str]
    hq_address_street_1: Mapped[str]
    hq_address_street_2: Mapped[str] = mapped_column#40;nullable=True#41;
    hq_address_city: Mapped[str]
    hq_address_state: Mapped[str]
    hq_address_zip: Mapped[str] = mapped_column#40;String#40;5#41;#41;
    email: Mapped[str]
    phone: Mapped[str]
}
class `SubmissionState(str, Enum):`{
    SUBMISSION_UPLOADED = "SUBMISSION_UPLOADED"
    VALIDATION_IN_PROGRESS = "VALIDATION_IN_PROGRESS"
    VALIDATION_WITH_ERRORS = "VALIDATION_WITH_ERRORS"
    VALIDATION_WITH_WARNINGS = "VALIDATION_WITH_WARNINGS"
    VALIDATION_SUCCESSFUL = "VALIDATION_SUCCESSFUL"
    SUBMISSION_ACCEPTED = "SUBMISSION_ACCEPTED"
    SUBMISSION_STARTED = "SUBMISSION_STARTED"
}
`FilingPeriodDAO(AuditMixin, Base):` *-- `FilingDAO(AuditMixin, Base):`
`FilingDAO(AuditMixin, Base):` *-- `SubmissionDAO(AuditMixin, Base):`
`FilingDAO(AuditMixin, Base):` *-- `ContactInfoDAO(Base):`
`SubmissionDAO(AuditMixin, Base):` *-- `SubmissionState(str, Enum):`
%%`FilingTaskStateDAO(Base):` *-- `FilingTaskDAO(Base):`
%%`FilingTaskStateDAO(Base):` *-- `FilingTaskStateEnum:`
Loading
Clone this wiki locally