/home/techb158/cosmic.abdallabala.com/docs
Edit: /home/techb158/cosmic.abdallabala.com/docs/04-database-entity-model.mmd (7051B)
erDiagram
PROJECTS ||--o{ LIFECYCLE_PHASES : has
PROJECTS ||--o{ RISKS : contains
PROJECTS ||--o{ INDICATORS : defines
PROJECTS ||--o{ MEASUREMENT_RECORDS : records
PROJECTS ||--o{ EXPERIMENTS : tracks
PROJECTS ||--o{ DEPLOYMENT_GATES : evaluates
PROJECTS ||--o{ EVIDENCE_ARTIFACTS : stores
PROJECTS ||--o{ AUDIT_EVENTS : logs
PROJECTS ||--o{ TRELLO_MAPPINGS : maps
PROJECTS ||--o{ REPORT_EXPORTS : exports
USERS ||--o{ RISKS : owns
USERS ||--o{ MITIGATION_ACTIONS : owns
ROLES ||--o{ USERS : grants
RISKS ||--o{ RISK_SCORES : has
RISKS ||--o{ MITIGATION_ACTIONS : mitigated_by
RISKS ||--o{ EVIDENCE_ARTIFACTS : supported_by
INDICATORS ||--o{ MEASUREMENT_RECORDS : measured_by
EVIDENCE_ARTIFACTS ||--o{ MEASUREMENT_RECORDS : supports
EXPERIMENTS ||--o{ MODEL_METRICS : has
DEPLOYMENT_GATES ||--o{ GATE_CRITERIA : contains
DEPLOYMENT_GATES ||--o{ GATE_DECISIONS : results_in
PROJECTS {
string id PK
string name
string subtitle
string project_type
string current_lifecycle_phase
number risk_appetite
date assessment_date
string status
datetime created_at
datetime updated_at
}
LIFECYCLE_PHASES {
string id PK
string project_id FK
string name
string status
number readiness_score
datetime updated_at
}
RISKS {
string id PK
string project_id FK
string owner_user_id FK
string title
string description
string dimension
string domain
string lifecycle_phase
number probability
number impact
number detectability
string status
string approval_status
date due_date
datetime created_at
datetime updated_at
}
RISK_SCORES {
string id PK
string risk_id FK
number raw_score
number normalized_score
number residual_score
string risk_level
datetime calculated_at
}
MITIGATION_ACTIONS {
string id PK
string risk_id FK
string owner_user_id FK
string title
string description
string status
number progress_percent
number effectiveness_percent
date due_date
datetime created_at
datetime updated_at
}
INDICATORS {
string id PK
string project_id FK
string name
string measurand
string unit
number threshold_min
number threshold_max
string interpretation_rule
string dimension
datetime created_at
}
MEASUREMENT_RECORDS {
string id PK
string project_id FK
string indicator_id FK
string evidence_id FK
string value_text
number numeric_value
string status
datetime measured_at
}
EXPERIMENTS {
string id PK
string project_id FK
string name
string model_name
string dataset_version
boolean selected
string reproducibility_status
datetime created_at
}
MODEL_METRICS {
string id PK
string experiment_id FK
string metric_name
number metric_value
number threshold_value
string status
datetime measured_at
}
DEPLOYMENT_GATES {
string id PK
string project_id FK
string status
string review_status
string summary
string evaluated_by_user_id FK
datetime evaluated_at
string reviewed_by_display_name
datetime reviewed_at
}
GATE_CRITERIA {
string id PK
string gate_id FK
string name
string actual_value
string expected_rule
string status
boolean blocking
string evidence
string evidence_uri
string reviewer_status
string reviewer_note
}
GATE_DECISIONS {
string id PK
string gate_id FK
string decision
string reason
string approved_by_user_id FK
string reviewer_display_name
datetime approved_at
datetime created_at
}
EVIDENCE_ARTIFACTS {
string id PK
string project_id FK
string risk_id FK
string type
string title
string uri
string created_by_user_id FK
datetime created_at
}
USERS {
string id PK
string display_name
string email
string role_id FK
boolean active
datetime created_at
}
ROLES {
string id PK
string name
string permissions_json
}
AUDIT_EVENTS {
string id PK
string project_id FK
string actor_user_id FK
string entity_type
string entity_id
string action
string before_json
string after_json
datetime created_at
}
PROJECT_MANAGEMENT_INTEGRATIONS {
string id PK
string project_id FK
string provider
string workspace_name
string external_project_key
string base_url
string auth_mode
string connection_status
string sync_direction
datetime last_sync_at
}
EXTERNAL_WORK_ITEM_MAPPINGS {
string id PK
string project_id FK
string integration_id FK
string local_entity_type
string local_entity_id
string external_item_type
string external_item_id
string external_status
string sync_status
datetime last_synced_at
}
PROJECT_MANAGEMENT_SYNC_RUNS {
string id PK
string project_id FK
string integration_id FK
string provider
string status
int created_count
int updated_count
int failed_count
string summary
}
TRELLO_MAPPINGS {
string id PK
string project_id FK
string trello_board_id
string trello_list_id
string trello_card_id
string local_entity_type
string local_entity_id
string sync_status
datetime last_synced_at
}
REPORT_EXPORTS {
string id PK
string project_id FK
string report_type
string format
string generated_by_user_id FK
datetime generated_at
string file_name
}
%% Step 7.1 extension
%% OAUTH_STATES ||--o{ OAUTH_TOKENS : authorizes
%% PROJECT_MANAGEMENT_INTEGRATIONS ||--o{ OAUTH_TOKENS : stores_token_for
%% PROJECT_MANAGEMENT_INTEGRATIONS ||--o{ PROJECT_MANAGEMENT_SYNC_RUNS : runs_live_sync
%% ACCESS_CONTROL_NOTES: Step 8 enforces permissions through users.role_id -> roles.permissions_json and the X-Cosmic-User-Id actor header.
%% Step 9 extension
%% BACKUP_MANIFESTS are currently file-based operational artifacts stored beside database backups.
%% Runtime configuration is environment-based and not persisted as database state.