rssd-init.surveilr-service-erd.auto.puml (Text Asset (.puml))

@startuml surveilr-state
  hide circle
  skinparam linetype ortho
  skinparam roundcorner 20
  skinparam class {
    BackgroundColor White
    ArrowColor Silver
    BorderColor Silver
    FontColor Black
    FontSize 12
  }

  entity "party_type" as party_type {
    * **party_type_id**: ULID
    --
    * code: TEXT
    * value: TEXT
  }

  entity "party" as party {
    * **party_id**: VARCHAR
    --
    * party_type_id: ULID
    * party_name: TEXT
      elaboration: TEXT
  }

  entity "party_relation_type" as party_relation_type {
    * **party_relation_type_id**: ULID
    --
    * code: TEXT
    * value: TEXT
  }

  entity "party_relation" as party_relation {
    * **party_relation_id**: VARCHAR
    --
    * party_id: VARCHAR
    * related_party_id: VARCHAR
    * relation_type_id: ULID
      elaboration: TEXT
  }

  entity "gender_type" as gender_type {
    * **gender_type_id**: ULID
    --
    * code: TEXT
    * value: TEXT
  }

  entity "sex_type" as sex_type {
    * **sex_type_id**: ULID
    --
    * code: TEXT
    * value: TEXT
  }

  entity "person_type" as person_type {
    * **person_type_id**: ULID
    --
    * code: TEXT
    * value: TEXT
  }

  entity "person" as person {
    * **person_id**: ULID
    --
    * party_id: VARCHAR
    * person_type_id: ULID
    * person_first_name: TEXT
      person_middle_name: TEXT
    * person_last_name: TEXT
      previous_name: TEXT
      honorific_prefix: TEXT
      honorific_suffix: TEXT
    * gender_id: ULID
    * sex_id: ULID
      elaboration: TEXT
  }

  entity "organization" as organization {
    * **organization_id**: ULID
    --
    * party_id: VARCHAR
    * name: TEXT
      alias: TEXT
      description: TEXT
    * license: TEXT
      federal_tax_id_num: TEXT
    * registration_date: DATE
      elaboration: TEXT
  }

  entity "organization_role_type" as organization_role_type {
    * **organization_role_type_id**: ULID
    --
    * code: TEXT
    * value: TEXT
  }

  entity "organization_role" as organization_role {
    * **organization_role_id**: VARCHAR
    --
    * person_id: VARCHAR
    * organization_id: VARCHAR
    * organization_role_type_id: ULID
      elaboration: TEXT
  }

  entity "device" as device {
    * **device_id**: VARCHAR
    --
    * name: TEXT
    * state: TEXT
    * boundary: TEXT
      segmentation: TEXT
      state_sysinfo: TEXT
      elaboration: TEXT
    --
    behaviors: Behavior[]
    urIngestSessions: UrIngestSession[]
    uniformResources: UniformResource[]
    orchestrationSessions: OrchestrationSession[]
  }

  entity "device_party_relationship" as device_party_relationship {
    * **device_party_relationship_id**: VARCHAR
    --
    * device_id: VARCHAR
    * party_id: VARCHAR
      elaboration: TEXT
  }

  entity "behavior" as behavior {
    * **behavior_id**: VARCHAR
    --
    * device_id: VARCHAR
    * behavior_name: TEXT
    * behavior_conf_json: TEXT
      assurance_schema_id: VARCHAR
      governance: TEXT
    --
    urIngestSessions: UrIngestSession[]
  }

  entity "ur_ingest_resource_path_match_rule" as ur_ingest_resource_path_match_rule {
    * **ur_ingest_resource_path_match_rule_id**: VARCHAR
    --
    * namespace: TEXT
    * regex: TEXT
    * flags: TEXT
      nature: TEXT
      priority: TEXT
      description: TEXT
      elaboration: TEXT
  }

  entity "ur_ingest_resource_path_rewrite_rule" as ur_ingest_resource_path_rewrite_rule {
    * **ur_ingest_resource_path_rewrite_rule_id**: VARCHAR
    --
    * namespace: TEXT
    * regex: TEXT
    * replace: TEXT
      priority: TEXT
      description: TEXT
      elaboration: TEXT
  }

  entity "ur_ingest_session" as ur_ingest_session {
    * **ur_ingest_session_id**: VARCHAR
    --
    * device_id: VARCHAR
      behavior_id: VARCHAR
      behavior_json: TEXT
    * ingest_started_at: TIMESTAMPTZ
      ingest_finished_at: TIMESTAMPTZ
    * session_agent: TEXT
      elaboration: TEXT
    --
    urIngestSessionFsPaths: UrIngestSessionFsPath[]
    uniformResources: UniformResource[]
    urIngestSessionFsPathEntrys: UrIngestSessionFsPathEntry[]
    urIngestSessionImapAccounts: UrIngestSessionImapAccount[]
    urIngestSessionImapAcctFolders: UrIngestSessionImapAcctFolder[]
    urIngestSessionImapAcctFolderMessages: UrIngestSessionImapAcctFolderMessage[]
    urIngestSessionPlmAccounts: UrIngestSessionPlmAccount[]
    urIngestSessionPlmAcctProjects: UrIngestSessionPlmAcctProject[]
    urIngestSessionPlmAcctProjectIssues: UrIngestSessionPlmAcctProjectIssue[]
    urIngestSessionUdiPgpSqls: UrIngestSessionUdiPgpSql[]
  }

  entity "ur_ingest_session_fs_path" as ur_ingest_session_fs_path {
    * **ur_ingest_session_fs_path_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
    * root_path: TEXT
      elaboration: TEXT
    --
    urIngestSessionFsPathEntrys: UrIngestSessionFsPathEntry[]
  }

  entity "uniform_resource" as uniform_resource {
    * **uniform_resource_id**: VARCHAR
    --
    * device_id: VARCHAR
    * ingest_session_id: VARCHAR
      ingest_fs_path_id: VARCHAR
      ingest_session_imap_acct_folder_message: VARCHAR
      ingest_issue_acct_project_id: VARCHAR
    * uri: TEXT
    * content_digest: TEXT
      content: BLOB
      nature: TEXT
      size_bytes: INTEGER
      last_modified_at: TIMESTAMPTZ
      content_fm_body_attrs: TEXT
      frontmatter: TEXT
      elaboration: TEXT
    --
    uniformResourceTransforms: UniformResourceTransform[]
    urIngestSessionAttachments: UrIngestSessionAttachment[]
    uniformResourceEdges: UniformResourceEdge[]
  }

  entity "uniform_resource_transform" as uniform_resource_transform {
    * **uniform_resource_transform_id**: VARCHAR
    --
    * uniform_resource_id: VARCHAR
    * uri: TEXT
    * content_digest: TEXT
      content: BLOB
      nature: TEXT
      size_bytes: INTEGER
      elaboration: TEXT
  }

  entity "ur_ingest_session_fs_path_entry" as ur_ingest_session_fs_path_entry {
    * **ur_ingest_session_fs_path_entry_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
    * ingest_fs_path_id: VARCHAR
      uniform_resource_id: VARCHAR
    * file_path_abs: TEXT
    * file_path_rel_parent: TEXT
    * file_path_rel: TEXT
    * file_basename: TEXT
      file_extn: TEXT
      captured_executable: TEXT
      ur_status: TEXT
      ur_diagnostics: TEXT
      ur_transformations: TEXT
      elaboration: TEXT
  }

  entity "ur_ingest_session_task" as ur_ingest_session_task {
    * **ur_ingest_session_task_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
      uniform_resource_id: VARCHAR
    * captured_executable: TEXT
      ur_status: TEXT
      ur_diagnostics: TEXT
      ur_transformations: TEXT
      elaboration: TEXT
  }

  entity "ur_ingest_session_imap_account" as ur_ingest_session_imap_account {
    * **ur_ingest_session_imap_account_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
      email: TEXT
      password: TEXT
      host: TEXT
      elaboration: TEXT
    --
    urIngestSessionImapAcctFolders: UrIngestSessionImapAcctFolder[]
  }

  entity "ur_ingest_session_imap_acct_folder" as ur_ingest_session_imap_acct_folder {
    * **ur_ingest_session_imap_acct_folder_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
    * ingest_account_id: VARCHAR
    * folder_name: TEXT
      elaboration: TEXT
    --
    urIngestSessionImapAcctFolderMessages: UrIngestSessionImapAcctFolderMessage[]
  }

  entity "ur_ingest_session_imap_acct_folder_message" as ur_ingest_session_imap_acct_folder_message {
    * **ur_ingest_session_imap_acct_folder_message_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
    * ingest_imap_acct_folder_id: VARCHAR
    * message: TEXT
    * message_id: TEXT
    * subject: TEXT
    * from: TEXT
    * cc: TEXT
    * bcc: TEXT
    * status: TEXT[]
      date: DATE
    * email_references: TEXT
  }

  entity "ur_ingest_session_plm_account" as ur_ingest_session_plm_account {
    * **ur_ingest_session_plm_account_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
    * provider: TEXT
    * org_name: TEXT
      elaboration: TEXT
    --
    urIngestSessionPlmAcctProjects: UrIngestSessionPlmAcctProject[]
  }

  entity "ur_ingest_session_plm_acct_project" as ur_ingest_session_plm_acct_project {
    * **ur_ingest_session_plm_acct_project_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
    * ingest_account_id: VARCHAR
      parent_project_id: TEXT
    * name: TEXT
      description: TEXT
      id: TEXT
      key: TEXT
      elaboration: TEXT
    --
    urIngestSessionPlmAcctProjectIssues: UrIngestSessionPlmAcctProjectIssue[]
    urIngestSessionPlmAcctLabels: UrIngestSessionPlmAcctLabel[]
    urIngestSessionPlmMilestones: UrIngestSessionPlmMilestone[]
    urIngestSessionPlmAcctRelationships: UrIngestSessionPlmAcctRelationship[]
  }

  entity "ur_ingest_session_plm_acct_project_issue" as ur_ingest_session_plm_acct_project_issue {
    * **ur_ingest_session_plm_acct_project_issue_id**: VARCHAR
    --
    * ingest_session_id: VARCHAR
    * ur_ingest_session_plm_acct_project_id: VARCHAR
      uniform_resource_id: VARCHAR
    * issue_id: TEXT
      issue_number: INTEGER
      parent_issue_id: TEXT
    * title: TEXT
      body: TEXT
      body_text: TEXT
      body_html: TEXT
    * state: TEXT
      assigned_to: TEXT
    * user: VARCHAR
    * url: TEXT
      closed_at: TEXT
      issue_type_id: VARCHAR
      time_estimate: INTEGER
      aggregate_time_estimate: INTEGER
      time_original_estimate: INTEGER
      time_spent: INTEGER
      aggregate_time_spent: INTEGER
      aggregate_time_original_estimate: INTEGER
      workratio: INTEGER
      current_progress: INTEGER
      total_progress: INTEGER
      resolution_name: TEXT
      resolution_date: TEXT
      elaboration: TEXT
    --
    urIngestSessionPlmAcctLabels: UrIngestSessionPlmAcctLabel[]
    urIngestSessionPlmAcctRelationships: UrIngestSessionPlmAcctRelationship[]
    urIngestSessionPlmComments: UrIngestSessionPlmComment[]
    urIngestSessionPlmIssueReactions: UrIngestSessionPlmIssueReaction[]
  }

  entity "ur_ingest_session_plm_acct_label" as ur_ingest_session_plm_acct_label {
    * **ur_ingest_session_plm_acct_label_id**: VARCHAR
    --
    * ur_ingest_session_plm_acct_project_id: VARCHAR
    * ur_ingest_session_plm_acct_project_issue_id: VARCHAR
    * label: TEXT
      elaboration: TEXT
  }

  entity "ur_ingest_session_plm_milestone" as ur_ingest_session_plm_milestone {
    * **ur_ingest_session_plm_milestone_id**: VARCHAR
    --
    * ur_ingest_session_plm_acct_project_id: VARCHAR
    * title: TEXT
    * milestone_id: TEXT
    * url: TEXT
    * html_url: TEXT
      open_issues: INTEGER
      closed_issues: INTEGER
      due_on: TIMESTAMPTZ
      closed_at: TIMESTAMPTZ
      elaboration: TEXT
  }

  entity "ur_ingest_session_plm_acct_relationship" as ur_ingest_session_plm_acct_relationship {
    * **ur_ingest_session_plm_acct_relationship_id**: VARCHAR
    --
    * ur_ingest_session_plm_acct_project_id_prime: VARCHAR
    * ur_ingest_session_plm_acct_project_id_related: TEXT
    * ur_ingest_session_plm_acct_project_issue_id_prime: VARCHAR
    * ur_ingest_session_plm_acct_project_issue_id_related: TEXT
      relationship: TEXT
      elaboration: TEXT
  }

  entity "ur_ingest_session_plm_user" as ur_ingest_session_plm_user {
    * **ur_ingest_session_plm_user_id**: VARCHAR
    --
    * user_id: TEXT
    * login: TEXT
      email: TEXT
      name: TEXT
    * url: TEXT
      elaboration: TEXT
    --
    urIngestSessionPlmAcctProjectIssues: UrIngestSessionPlmAcctProjectIssue[]
    urIngestSessionPlmComments: UrIngestSessionPlmComment[]
  }

  entity "ur_ingest_session_plm_comment" as ur_ingest_session_plm_comment {
    * **ur_ingest_session_plm_comment_id**: VARCHAR
    --
    * ur_ingest_session_plm_acct_project_issue_id: VARCHAR
    * comment_id: TEXT
    * node_id: TEXT
    * url: TEXT
      body: TEXT
      body_text: TEXT
      body_html: TEXT
    * user: VARCHAR
      elaboration: TEXT
  }

  entity "ur_ingest_session_plm_reaction" as ur_ingest_session_plm_reaction {
    * **ur_ingest_session_plm_reaction_id**: VARCHAR
    --
    * reaction_id: TEXT
    * reaction_type: TEXT
      elaboration: TEXT
    --
    urIngestSessionPlmIssueReactions: UrIngestSessionPlmIssueReaction[]
  }

  entity "ur_ingest_session_plm_issue_reaction" as ur_ingest_session_plm_issue_reaction {
    * **ur_ingest_session_plm_issue_reaction_id**: VARCHAR
    --
    * ur_ingest_plm_reaction_id: VARCHAR
    * ur_ingest_plm_issue_id: VARCHAR
    * count: INTEGER
      elaboration: TEXT
  }

  entity "ur_ingest_session_plm_issue_type" as ur_ingest_session_plm_issue_type {
    * **ur_ingest_session_plm_issue_type_id**: VARCHAR
    --
      avatar_id: TEXT
    * description: TEXT
    * icon_url: TEXT
    * id: TEXT
    * name: TEXT
    * subtask: BOOLEAN
    * url: TEXT
      elaboration: TEXT
    --
    urIngestSessionPlmAcctProjectIssues: UrIngestSessionPlmAcctProjectIssue[]
  }

  entity "ur_ingest_session_attachment" as ur_ingest_session_attachment {
    * **ur_ingest_session_attachment_id**: VARCHAR
    --
      uniform_resource_id: VARCHAR
      name: TEXT
    * uri: TEXT
      content: BLOB
      nature: TEXT
      size: INTEGER
      checksum: TEXT
      elaboration: TEXT
  }

  entity "ur_ingest_session_udi_pgp_sql" as ur_ingest_session_udi_pgp_sql {
    * **ur_ingest_session_udi_pgp_sql_id**: VARCHAR
    --
    * sql: TEXT
    * nature: TEXT
      content: BLOB
      behaviour: TEXT
      query_error: TEXT
      uniform_resource_id: VARCHAR
      ingest_session_id: VARCHAR
  }

  entity "orchestration_nature" as orchestration_nature {
    * **orchestration_nature_id**: TEXT
    --
    * nature: TEXT
      elaboration: TEXT
    --
    orchestrationSessions: OrchestrationSession[]
  }

  entity "orchestration_session" as orchestration_session {
    * **orchestration_session_id**: VARCHAR
    --
    * device_id: VARCHAR
    * orchestration_nature_id: TEXT
    * version: TEXT
      orch_started_at: TIMESTAMPTZ
      orch_finished_at: TIMESTAMPTZ
      elaboration: TEXT
      args_json: TEXT
      diagnostics_json: TEXT
      diagnostics_md: TEXT
    --
    orchestrationSessionEntrys: OrchestrationSessionEntry[]
    orchestrationSessionStates: OrchestrationSessionState[]
    orchestrationSessionExecs: OrchestrationSessionExec[]
    orchestrationSessionIssues: OrchestrationSessionIssue[]
  }

  entity "orchestration_session_entry" as orchestration_session_entry {
    * **orchestration_session_entry_id**: VARCHAR
    --
    * session_id: VARCHAR
    * ingest_src: TEXT
      ingest_table_name: TEXT
      elaboration: TEXT
    --
    orchestrationSessionStates: OrchestrationSessionState[]
    orchestrationSessionExecs: OrchestrationSessionExec[]
    orchestrationSessionIssues: OrchestrationSessionIssue[]
  }

  entity "orchestration_session_state" as orchestration_session_state {
    * **orchestration_session_state_id**: VARCHAR
    --
    * session_id: VARCHAR
      session_entry_id: VARCHAR
    * from_state: TEXT
    * to_state: TEXT
      transition_result: TEXT
      transition_reason: TEXT
      transitioned_at: TIMESTAMPTZ
      elaboration: TEXT
  }

  entity "orchestration_session_exec" as orchestration_session_exec {
    * **orchestration_session_exec_id**: VARCHAR
    --
    * exec_nature: TEXT
    * session_id: VARCHAR
      session_entry_id: VARCHAR
      parent_exec_id: VARCHAR
      namespace: TEXT
      exec_identity: TEXT
    * exec_code: TEXT
    * exec_status: INTEGER
      input_text: TEXT
      exec_error_text: TEXT
      output_text: TEXT
      output_nature: TEXT
      narrative_md: TEXT
      elaboration: TEXT
  }

  entity "orchestration_session_issue" as orchestration_session_issue {
    * **orchestration_session_issue_id**: UUID
    --
    * session_id: VARCHAR
      session_entry_id: VARCHAR
    * issue_type: TEXT
    * issue_message: TEXT
      issue_row: INTEGER
      issue_column: TEXT
      invalid_value: TEXT
      remediation: TEXT
      elaboration: TEXT
    --
    orchestrationSessionIssueRelations: OrchestrationSessionIssueRelation[]
  }

  entity "orchestration_session_issue_relation" as orchestration_session_issue_relation {
    * **orchestration_session_issue_relation_id**: UUID
    --
    * issue_id_prime: UUID
    * issue_id_rel: TEXT
    * relationship_nature: TEXT
      elaboration: TEXT
  }

  entity "orchestration_session_log" as orchestration_session_log {
    * **orchestration_session_log_id**: UUID
    --
      category: TEXT
      parent_exec_id: UUID
    * content: TEXT
      sibling_order: INTEGER
      elaboration: TEXT
  }

  entity "uniform_resource_graph" as uniform_resource_graph {
    * **name**: VARCHAR
    --
      elaboration: TEXT
    --
    uniformResourceEdges: UniformResourceEdge[]
  }

  entity "uniform_resource_edge" as uniform_resource_edge {
    * graph_name: VARCHAR
    * nature: TEXT
    * node_id: TEXT
    * uniform_resource_id: VARCHAR
      elaboration: TEXT
  }

  party_type |o..o{ party
  party |o..o{ party_relation
  party |o..o{ party_relation
  party_relation_type |o..o{ party_relation
  party |o..o{ person
  person_type |o..o{ person
  gender_type |o..o{ person
  sex_type |o..o{ person
  party |o..o{ organization
  party |o..o{ organization_role
  party |o..o{ organization_role
  organization_role_type |o..o{ organization_role
  device |o..o{ device_party_relationship
  party |o..o{ device_party_relationship
  device |o..o{ behavior
  device |o..o{ ur_ingest_session
  behavior |o..o{ ur_ingest_session
  ur_ingest_session |o..o{ ur_ingest_session_fs_path
  device |o..o{ uniform_resource
  ur_ingest_session |o..o{ uniform_resource
  ur_ingest_session_fs_path |o..o{ uniform_resource
  ur_ingest_session_imap_acct_folder_message |o..o{ uniform_resource
  ur_ingest_session_plm_acct_project |o..o{ uniform_resource
  uniform_resource |o..o{ uniform_resource_transform
  ur_ingest_session |o..o{ ur_ingest_session_fs_path_entry
  ur_ingest_session_fs_path |o..o{ ur_ingest_session_fs_path_entry
  uniform_resource |o..o{ ur_ingest_session_fs_path_entry
  ur_ingest_session |o..o{ ur_ingest_session_task
  uniform_resource |o..o{ ur_ingest_session_task
  ur_ingest_session |o..o{ ur_ingest_session_imap_account
  ur_ingest_session |o..o{ ur_ingest_session_imap_acct_folder
  ur_ingest_session_imap_account |o..o{ ur_ingest_session_imap_acct_folder
  ur_ingest_session |o..o{ ur_ingest_session_imap_acct_folder_message
  ur_ingest_session_imap_acct_folder |o..o{ ur_ingest_session_imap_acct_folder_message
  ur_ingest_session |o..o{ ur_ingest_session_plm_account
  ur_ingest_session |o..o{ ur_ingest_session_plm_acct_project
  ur_ingest_session_plm_account |o..o{ ur_ingest_session_plm_acct_project
  ur_ingest_session |o..o{ ur_ingest_session_plm_acct_project_issue
  ur_ingest_session_plm_acct_project |o..o{ ur_ingest_session_plm_acct_project_issue
  uniform_resource |o..o{ ur_ingest_session_plm_acct_project_issue
  ur_ingest_session_plm_user |o..o{ ur_ingest_session_plm_acct_project_issue
  ur_ingest_session_plm_issue_type |o..o{ ur_ingest_session_plm_acct_project_issue
  ur_ingest_session_plm_acct_project |o..o{ ur_ingest_session_plm_acct_label
  ur_ingest_session_plm_acct_project_issue |o..o{ ur_ingest_session_plm_acct_label
  ur_ingest_session_plm_acct_project |o..o{ ur_ingest_session_plm_milestone
  ur_ingest_session_plm_acct_project |o..o{ ur_ingest_session_plm_acct_relationship
  ur_ingest_session_plm_acct_project_issue |o..o{ ur_ingest_session_plm_acct_relationship
  ur_ingest_session_plm_acct_project_issue |o..o{ ur_ingest_session_plm_comment
  ur_ingest_session_plm_user |o..o{ ur_ingest_session_plm_comment
  ur_ingest_session_plm_reaction |o..o{ ur_ingest_session_plm_issue_reaction
  ur_ingest_session_plm_acct_project_issue |o..o{ ur_ingest_session_plm_issue_reaction
  uniform_resource |o..o{ ur_ingest_session_attachment
  uniform_resource |o..o{ ur_ingest_session_udi_pgp_sql
  ur_ingest_session |o..o{ ur_ingest_session_udi_pgp_sql
  device |o..o{ orchestration_session
  orchestration_nature |o..o{ orchestration_session
  orchestration_session |o..o{ orchestration_session_entry
  orchestration_session |o..o{ orchestration_session_state
  orchestration_session_entry |o..o{ orchestration_session_state
  orchestration_session |o..o{ orchestration_session_exec
  orchestration_session_entry |o..o{ orchestration_session_exec
  orchestration_session_exec |o..o{ orchestration_session_exec
  orchestration_session |o..o{ orchestration_session_issue
  orchestration_session_entry |o..o{ orchestration_session_issue
  orchestration_session_issue |o..o{ orchestration_session_issue_relation
  orchestration_session_log |o..o{ orchestration_session_log
  uniform_resource_graph |o..o{ uniform_resource_edge
  uniform_resource |o..o{ uniform_resource_edge
@enduml