Skip to content

Data model

The system uses 25 PostgreSQL tables (PostGIS-enabled). Each is defined in lib/db/src/schema/ and generated below directly from that schema.

alerts

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
asset_iduuidyesFK→ assets.id
user_iduuidyesFK→ users.id
hotspot_idtextyes
levelalert_levelno
titletextno
bodytextno
sourcealert_sourceno
statusalert_statusno
issued_attimestamp with time zoneno
expires_attimestamp with time zoneyes
acked_attimestamp with time zoneyes
metadatajsonbyes

Indexes: alerts_org_idx, alerts_asset_idx, alerts_user_idx, alerts_hotspot_idx, alerts_status_idx, alerts_issued_at_idx, alerts_active_dedup_uniq

assets

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
owner_user_iduuidnoFK→ users.id
nametextno
addresstextno
locationgeometry(Point, 4326)no
areageometry(Geometry, 4326)yes
property_typeproperty_typeno
structurestructure_kindno
balbal_ratingno
statusrisk_levelno
metadatajsonbyes
created_attimestamp with time zoneno
updated_attimestamp with time zoneno

Indexes: assets_org_idx, assets_owner_idx, assets_location_gist, assets_area_gist

audit_log

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidyesFK→ organizations.id
user_iduuidyesFK→ users.id
actiontextno
resourcetextyes
metadatajsonbyes
tstimestamp with time zoneno

Indexes: audit_log_ts_idx, audit_log_action_idx, audit_log_user_idx

checkin_sessions

ColumnTypeNullableKeyReferences
iduuidnoPK
owner_user_iduuidnoFK→ users.id
started_attimestamp with time zoneno
closed_attimestamp with time zoneyes

Indexes: checkin_sessions_owner_idx

checkin_statuses

ColumnTypeNullableKeyReferences
iduuidnoPK
session_iduuidnoFK→ checkin_sessions.id
contact_iduuidnoFK→ family_contacts.id
statuscheckin_statusno
responded_attimestamp with time zoneyes

Indexes: checkin_statuses_session_idx, checkin_statuses_contact_idx

device_tokens

ColumnTypeNullableKeyReferences
iduuidnoPK
user_iduuidnoFK→ users.id
tokentextno
platformtextno
app_versiontextyes
registered_attimestamp with time zoneno
last_used_attimestamp with time zoneyes
revoked_attimestamp with time zoneyes

Indexes: device_tokens_user_idx, device_tokens_token_unique

email_verifications

ColumnTypeNullableKeyReferences
iduuidnoPK
user_iduuidnoFK→ users.id
token_hashtextno
purposetextno
expires_attimestamp with time zoneno
used_attimestamp with time zoneyes
created_attimestamp with time zoneno

Indexes: email_verifications_token_hash_unique, email_verifications_user_purpose_idx

evacuation_routes

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
asset_iduuidnoFK→ assets.id
primary_nametextno
backup_nametextno
destinationtextno
distance_kmdouble precisionno
eta_minutesintegerno
hazard_countintegerno
water_stopsintegerno
refugesintegerno
notesjsonbno
primary_pathjsonbno
backup_pathjsonbno
poisjsonbno
cached_attimestamp with time zoneno

Indexes: evacuation_routes_org_idx, evacuation_routes_asset_idx

family_contacts

ColumnTypeNullableKeyReferences
iduuidnoPK
owner_user_iduuidnoFK→ users.id
nametextno
roletextno
mobiletextno
initialstextno
tinttextno
created_attimestamp with time zoneno

Indexes: family_contacts_owner_idx

fire_spread_snapshots

ColumnTypeNullableKeyReferences
iduuidnoPK
fire_iduuidnoFK→ fires.id
org_iduuidnoFK→ organizations.id
sourcetextno
wind_dir_degintegeryes
wind_kmhdouble precisionno
ffdidouble precisionyes
valid_fromtimestamp with time zoneno
valid_totimestamp with time zoneno
payloadjsonbno
computed_attimestamp with time zoneno
expires_attimestamp with time zoneno

Indexes: fire_spread_snapshots_fire_uq, fire_spread_snapshots_org_idx, fire_spread_snapshots_expires_idx

fire_threats

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
asset_iduuidnoFK→ assets.id
owner_user_iduuidnoFK→ users.id
fire_iduuidnoFK→ fires.id
hotspot_external_idtextyes
statustextno
current_severitytextno
current_leveltextyes
eta_minutesintegeryes
eta_minutes_lowintegeryes
eta_minutes_highintegeryes
distance_kmdouble precisionno
bearing_degdouble precisionyes
ros_kmhdouble precisionyes
prediction_sourcetextno
predicted_worstjsonbyes
first_detected_attimestamp with time zoneno
last_evaluated_attimestamp with time zoneno
last_notified_severitytextyes
last_notified_leveltextyes
last_notified_attimestamp with time zoneyes
quiet_cyclesintegerno
resolved_attimestamp with time zoneyes
trajectoryjsonbno
metadatajsonbyes

Indexes: fire_threats_asset_fire_uq, fire_threats_org_idx, fire_threats_owner_idx, fire_threats_fire_idx, fire_threats_status_idx, fire_threats_last_eval_idx

fires

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
sourcetextno
external_idtextyes
satellite_codetextyes
sensor_versiontextyes
observed_attimestamp with time zoneno
confidencetextyes
frp_mwdouble precisionyes
nametextyes
regiontextyes
intensityfire_intensityno
locationgeometry(Point, 4326)no
wind_kmhintegeryes
wind_directiontextyes
risk_scoreintegeryes
distance_kmdouble precisionyes
bearingtextyes
eta_minutesintegeryes
detected_attimestamp with time zoneno
updated_attimestamp with time zoneno

Indexes: fires_org_idx, fires_location_gist, fires_intensity_idx, fires_observed_at_idx, fires_source_external_unique

forecast_points

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
locationgeometry(Point, 4326)yes
sourcetextno
observed_attimestamp with time zoneyes
hour_labeltextno
valid_attimestamp with time zoneno
risk_scoreintegerno
wind_kmhintegerno
wind_direction_degdouble precisionyes
temp_cdouble precisionno
relative_humiditydouble precisionyes
ffdidouble precisionyes
danger_leveltextyes
notetextyes
created_attimestamp with time zoneno

Indexes: forecast_points_org_idx, forecast_points_location_gist, forecast_points_valid_at_idx, forecast_points_source_idx

ingest_cycles

ColumnTypeNullableKeyReferences
iduuidnoPK
sourcetextno
statustextno
started_attimestamp with time zoneno
finished_attimestamp with time zoneno
duration_msintegerno
fetchedintegeryes
insertedintegeryes
updatedintegeryes
deletedintegeryes
metadatajsonbyes
error_texttextyes

Indexes: ingest_cycles_source_idx, ingest_cycles_finished_at_idx

memberships

ColumnTypeNullableKeyReferences
iduuidnoPK
user_iduuidnoFK→ users.id
org_iduuidnoFK→ organizations.id
role_iduuidnoFK→ roles.id
created_attimestamp with time zoneno

Indexes: memberships_user_org_role_unique, memberships_user_idx, memberships_org_idx

notification_deliveries

ColumnTypeNullableKeyReferences
iduuidnoPK
alert_iduuidnoFK→ alerts.id
user_iduuidnoFK→ users.id
channeltextno
statustextno
reasontextyes
device_countintegerno
attempted_attimestamp with time zoneno
delivered_attimestamp with time zoneyes
metadatajsonbyes

Indexes: notification_deliveries_alert_idx, notification_deliveries_user_idx, notification_deliveries_attempted_idx, notification_deliveries_channel_status_idx

notification_preferences

ColumnTypeNullableKeyReferences
user_iduuidnoPK→ users.id
alerts_enabledbooleanno
quiet_hours_start_utcintegeryes
quiet_hours_end_utcintegeryes
min_severitytextno
web_push_enabledbooleanno
updated_attimestamp with time zoneno

organizations

ColumnTypeNullableKeyReferences
iduuidnoPK
slugtextno
nametextno
kindorg_kindno
created_attimestamp with time zoneno

Indexes: organizations_slug_unique

places

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
kindplace_kindno
nametextno
locationgeometry(Point, 4326)no
statustextno
openplace_openno
capacitytextyes
phonetextyes
notestextyes
distance_kmdouble precisionyes
bearingbearing_diryes

Indexes: places_org_idx, places_kind_idx, places_location_gist

prediction_costs

ColumnTypeNullableKeyReferences
iduuidnoPK
prediction_iduuidnoFK→ predictions.id
org_iduuidnoFK→ organizations.id
user_iduuidyesFK→ users.id
sourcetextno
cpu_secondsintegerno
s3_putsintegerno
cost_auddouble precisionno
created_attimestamp with time zoneno

Indexes: prediction_costs_prediction_idx, prediction_costs_org_idx, prediction_costs_user_idx, prediction_costs_created_idx

prediction_etas

ColumnTypeNullableKeyReferences
iduuidnoPK
prediction_iduuidnoFK→ predictions.id
asset_iduuidnoFK→ assets.id
org_iduuidnoFK→ organizations.id
distance_kmdouble precisionno
bearing_degintegerno
rate_of_spread_kmhdouble precisionno
alignment_factordouble precisionno
slope_multiplierdouble precisionno
eta_minutesintegerno
eta_minutes_lowintegerno
eta_minutes_highintegerno
severitytextno
confidencedouble precisionno
methodtextno
computed_attimestamp with time zoneno

Indexes: prediction_etas_prediction_idx, prediction_etas_asset_idx, prediction_etas_org_idx, prediction_etas_prediction_asset_uq

predictions

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
owner_user_iduuidyesFK→ users.id
kindprediction_kindno
bboxgeometry(Polygon, 4326)no
valid_fromtimestamp with time zoneno
valid_totimestamp with time zoneno
params_hashtextno
statusprediction_statusno
output_uritextyes
metadatajsonbyes
expires_attimestamp with time zoneno
created_attimestamp with time zoneno

Indexes: predictions_kind_hash_unique, predictions_org_idx, predictions_owner_idx, predictions_bbox_gist, predictions_valid_idx, predictions_expires_idx

roles

ColumnTypeNullableKeyReferences
iduuidnoPK
slugrole_slugno
descriptiontextyes

Indexes: roles_slug_unique

simulation_jobs

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
prediction_iduuidyesFK→ predictions.id
owner_user_iduuidyesFK→ users.id
paramsjsonbno
params_hashtextno
statusjob_statusno
priorityintegerno
attemptsintegerno
errortextyes
started_attimestamp with time zoneyes
finished_attimestamp with time zoneyes
created_attimestamp with time zoneno

Indexes: simulation_jobs_org_idx, simulation_jobs_owner_idx, simulation_jobs_status_idx, simulation_jobs_params_hash_idx

users

ColumnTypeNullableKeyReferences
iduuidnoPK
org_iduuidnoFK→ organizations.id
emailcitextno
display_nametextyes
external_idtextyes
auth_providerauth_providerno
auth_provider_user_idtextyes
is_service_accountbooleanno
password_hashtextyes
email_verified_attimestamp with time zoneyes
phonetextyes
phone_verified_attimestamp with time zoneyes
created_attimestamp with time zoneno
last_login_attimestamp with time zoneyes
token_revoked_beforetimestamp with time zoneyes

Indexes: users_email_unique, users_phone_unique, users_provider_subject_unique, users_org_idx