Generated by npm run db:docs:generate — DO NOT EDIT BY HAND. Change the schema via a migration, then regenerate.
Core: gr_ · Tables: 82 · Source generated: 2026-06-10T02:55:32.169Z
Entity relationships
Tables
gr_accreditation_audit_links
RLS: ✅ enabled (4 policies)
Foreign keys:
audit_id→gr_audits(id)linked_by→pf_profiles(id)organization_id→pf_organizations(id)survey_id→gr_accreditation_surveys(id)
gr_accreditation_audit_links_delete(DELETE)gr_accreditation_audit_links_insert(INSERT)gr_accreditation_audit_links_select(SELECT)gr_accreditation_audit_links_update(UPDATE)
gr_accreditation_caps
GR-16: Corrective Action Plans linked to accreditation findings
RLS: ✅ enabled (4 policies)
Foreign keys:
accreditation_id→gr_accreditations(id)closure_evidence_id→pf_documents(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)responsible_party_id→pf_profiles(id)standard_id→gr_accreditation_standards(id)updated_by→pf_profiles(id)
gr_caps_delete(DELETE)gr_caps_insert(INSERT)gr_caps_select(SELECT)gr_caps_update(UPDATE)
gr_accreditation_compliance_links
RLS: ✅ enabled (4 policies)
Foreign keys:
linked_by→pf_profiles(id)organization_id→pf_organizations(id)requirement_id→gr_regulatory_requirements(id)standard_id→gr_accreditation_standards(id)
gr_accreditation_compliance_links_delete(DELETE)gr_accreditation_compliance_links_insert(INSERT)gr_accreditation_compliance_links_select(SELECT)gr_accreditation_compliance_links_update(UPDATE)
gr_accreditation_evidence
GR-08: Evidence documents linked to accreditation standards and surveys
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)document_id→pf_documents(id)organization_id→pf_organizations(id)standard_id→gr_accreditation_standards(id)survey_id→gr_accreditation_surveys(id)updated_by→pf_profiles(id)verified_by→pf_profiles(id)
gr_accreditation_evidence_delete(DELETE)gr_accreditation_evidence_insert(INSERT)gr_accreditation_evidence_select(SELECT)gr_accreditation_evidence_update(UPDATE)
gr_accreditation_mock_surveys
GR-16: Mock survey results for accreditation readiness tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
accreditation_id→gr_accreditations(id)conducted_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_mock_surveys_delete(DELETE)gr_mock_surveys_insert(INSERT)gr_mock_surveys_select(SELECT)gr_mock_surveys_update(UPDATE)
gr_accreditation_standards
GR-08: Accreditation standards with compliance tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
accreditation_id→gr_accreditations(id)created_by→pf_profiles(id)last_verified_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_accreditation_standards_delete(DELETE)gr_accreditation_standards_insert(INSERT)gr_accreditation_standards_select(SELECT)gr_accreditation_standards_update(UPDATE)
gr_accreditation_surveys
GR-08: Accreditation survey planning and tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
accreditation_id→gr_accreditations(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_accreditation_surveys_delete(DELETE)gr_accreditation_surveys_insert(INSERT)gr_accreditation_surveys_select(SELECT)gr_accreditation_surveys_update(UPDATE)
gr_accreditation_tracer_packs
GR-16: Tracer packs grouping evidence by accreditation standard domain/category
RLS: ✅ enabled (4 policies)
Foreign keys:
accreditation_id→gr_accreditations(id)created_by→pf_profiles(id)document_id→pf_documents(id)generated_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_tracer_packs_delete(DELETE)gr_tracer_packs_insert(INSERT)gr_tracer_packs_select(SELECT)gr_tracer_packs_update(UPDATE)
gr_accreditations
GR-08: Accreditation tracking for regulatory bodies (CARF, state licensing, NARR)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_accreditations_delete(DELETE)gr_accreditations_insert(INSERT)gr_accreditations_select(SELECT)gr_accreditations_update(UPDATE)
gr_ai_audit_prep
RLS: ✅ enabled (4 policies)
Foreign keys:
audit_id→gr_audits(id)organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)
gr_ai_audit_prep_delete(DELETE)gr_ai_audit_prep_insert(INSERT)gr_ai_audit_prep_select(SELECT)gr_ai_audit_prep_update(UPDATE)
gr_ai_compliance_suggestions
RLS: ✅ enabled (4 policies)
Foreign keys:
check_id→gr_compliance_checks(id)finding_id→gr_audit_findings(id)organization_id→pf_organizations(id)requirement_id→gr_regulatory_requirements(id)reviewed_by→pf_profiles(id)
gr_ai_suggestions_delete(DELETE)gr_ai_suggestions_insert(INSERT)gr_ai_suggestions_select(SELECT)gr_ai_suggestions_update(UPDATE)
gr_ai_gap_analyses
RLS: ✅ enabled (4 policies)
Foreign keys:
addressed_by→pf_profiles(id)organization_id→pf_organizations(id)requirement_id→gr_regulatory_requirements(id)
gr_ai_gap_delete(DELETE)gr_ai_gap_insert(INSERT)gr_ai_gap_select(SELECT)gr_ai_gap_update(UPDATE)
gr_ai_risk_assessments
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)risk_id→gr_risks(id)
gr_ai_risk_delete(DELETE)gr_ai_risk_insert(INSERT)gr_ai_risk_select(SELECT)gr_ai_risk_update(UPDATE)
gr_audit_checklists
RLS: ✅ enabled (4 policies)
Foreign keys:
audit_id→gr_audits(id)requirement_id→gr_regulatory_requirements(id)reviewed_by→pf_profiles(id)
gr_audit_checklists_delete(DELETE)gr_audit_checklists_insert(INSERT)gr_audit_checklists_select(SELECT)gr_audit_checklists_update(UPDATE)
gr_audit_corrective_actions
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→pf_profiles(id)completion_evidence_id→gr_audit_evidence(id)created_by→pf_profiles(id)finding_id→gr_audit_findings(id)organization_id→pf_organizations(id)responsible_party_id→pf_profiles(id)updated_by→pf_profiles(id)
gr_audit_corrective_actions_delete(DELETE)gr_audit_corrective_actions_insert(INSERT)gr_audit_corrective_actions_select(SELECT)gr_audit_corrective_actions_update(UPDATE)
gr_audit_evidence
RLS: ✅ enabled (3 policies)
Foreign keys:
audit_id→gr_audits(id)checklist_item_id→gr_audit_checklists(id)created_by→pf_profiles(id)document_id→pf_documents(id)finding_id→gr_audit_findings(id)organization_id→pf_organizations(id)updated_by→users(id)
gr_audit_evidence_delete(DELETE)gr_audit_evidence_insert(INSERT)gr_audit_evidence_select(SELECT)
gr_audit_findings
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_to→pf_profiles(id)audit_id→gr_audits(id)closed_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)requirement_id→gr_regulatory_requirements(id)resolved_by→pf_profiles(id)updated_by→pf_profiles(id)
gr_audit_findings_delete(DELETE)gr_audit_findings_insert(INSERT)gr_audit_findings_select(SELECT)gr_audit_findings_update(UPDATE)
gr_audit_team_assignments
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_by→pf_profiles(id)audit_id→gr_audits(id)employee_id→hr_employees(id)
gr_audit_team_assignments_delete(DELETE)gr_audit_team_assignments_insert(INSERT)gr_audit_team_assignments_select(SELECT)gr_audit_team_assignments_update(UPDATE)
gr_audits
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)lead_auditor_id→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_audits_delete(DELETE)gr_audits_insert(INSERT)gr_audits_select(SELECT)gr_audits_update(UPDATE)
gr_benchmarking_aggregates
RLS: ✅ enabled (1 policies)
Policies:
gr_benchmarking_aggregates_select(SELECT)
gr_benchmarking_consents
RLS: ✅ enabled (3 policies)
Foreign keys:
organization_id→pf_organizations(id)
gr_benchmarking_consents_insert(INSERT)gr_benchmarking_consents_select(SELECT)gr_benchmarking_consents_update(UPDATE)
gr_board_minutes
GR-15: Board meeting minutes with approval workflow
RLS: ✅ enabled (4 policies)
Foreign keys:
approved_by→pf_profiles(id)created_by→pf_profiles(id)document_id→pf_documents(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_board_minutes_delete(DELETE)gr_board_minutes_insert(INSERT)gr_board_minutes_select(SELECT)gr_board_minutes_update(UPDATE)
gr_board_resolutions
GR-15: Board resolutions with motion, vote, and outcome tracking
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)minutes_id→gr_board_minutes(id)motion_by→pf_profiles(id)organization_id→pf_organizations(id)seconded_by→pf_profiles(id)updated_by→pf_profiles(id)
gr_board_resolutions_insert(INSERT)gr_board_resolutions_select(SELECT)gr_board_resolutions_update(UPDATE)
gr_ceu_credits
RLS: ✅ enabled (6 policies)
Foreign keys:
completion_id→gr_training_completions(id)created_by→pf_profiles(id)document_id→pf_documents(id)employee_id→hr_employees(id)organization_id→pf_organizations(id)verified_by→pf_profiles(id)
gr_ceu_credits_delete(DELETE)gr_ceu_credits_insert_admin(INSERT)gr_ceu_credits_insert_own(INSERT)gr_ceu_credits_select_admin(SELECT)gr_ceu_credits_select_own(SELECT)gr_ceu_credits_update(UPDATE)
gr_coi_attestations
GR-15: Annual conflict-of-interest attestations for board members, executives, and staff
RLS: ✅ enabled (3 policies)
Foreign keys:
acknowledged_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)profile_id→pf_profiles(id)updated_by→pf_profiles(id)
gr_coi_attestations_insert(INSERT)gr_coi_attestations_select(SELECT)gr_coi_attestations_update(UPDATE)
gr_compliance_checks
RLS: ✅ enabled (4 policies)
Foreign keys:
checked_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)requirement_id→gr_regulatory_requirements(id)site_id→pf_sites(id)updated_by→pf_profiles(id)verified_by→pf_profiles(id)
gr_compliance_checks_delete(DELETE)gr_compliance_checks_insert(INSERT)gr_compliance_checks_select(SELECT)gr_compliance_checks_update(UPDATE)
gr_compliance_evidence
RLS: ✅ enabled (4 policies)
Foreign keys:
check_id→gr_compliance_checks(id)created_by→pf_profiles(id)document_id→pf_documents(id)organization_id→pf_organizations(id)requirement_id→gr_regulatory_requirements(id)updated_by→users(id)verified_by→pf_profiles(id)
gr_compliance_evidence_delete(DELETE)gr_compliance_evidence_insert(INSERT)gr_compliance_evidence_select(SELECT)gr_compliance_evidence_update(UPDATE)
gr_compliance_remediation
RLS: ✅ enabled (4 policies)
Foreign keys:
check_id→gr_compliance_checks(id)closed_by→pf_profiles(id)created_by→pf_profiles(id)escalated_to→pf_profiles(id)organization_id→pf_organizations(id)requirement_id→gr_regulatory_requirements(id)resolution_evidence_id→gr_compliance_evidence(id)resolved_by→pf_profiles(id)responsible_party_id→pf_profiles(id)updated_by→pf_profiles(id)
gr_compliance_remediation_delete(DELETE)gr_compliance_remediation_insert(INSERT)gr_compliance_remediation_select(SELECT)gr_compliance_remediation_update(UPDATE)
gr_compliance_submissions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)regulatory_body_id→gr_regulatory_bodies(id)requirement_id→gr_regulatory_requirements(id)response_document_id→pf_documents(id)submission_document_id→pf_documents(id)updated_by→pf_profiles(id)
gr_compliance_submissions_delete(DELETE)gr_compliance_submissions_insert(INSERT)gr_compliance_submissions_select(SELECT)gr_compliance_submissions_update(UPDATE)
gr_contract_alerts
GR-10: Contract alert history and notification tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
acknowledged_by→pf_profiles(id)contract_id→gr_contracts(id)notification_id→pf_notifications(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_contract_alerts_delete(DELETE)gr_contract_alerts_insert(INSERT)gr_contract_alerts_select(SELECT)gr_contract_alerts_update(UPDATE)
gr_contract_amendments
GR-10: Contract amendments and change history
RLS: ✅ enabled (4 policies)
Foreign keys:
approved_by→pf_profiles(id)contract_id→gr_contracts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)rejected_by→pf_profiles(id)updated_by→pf_profiles(id)
gr_contract_amendments_delete(DELETE)gr_contract_amendments_insert(INSERT)gr_contract_amendments_select(SELECT)gr_contract_amendments_update(UPDATE)
gr_contract_milestones
GR-10: Contract milestones and key dates
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→pf_profiles(id)contract_id→gr_contracts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_contract_milestones_delete(DELETE)gr_contract_milestones_insert(INSERT)gr_contract_milestones_select(SELECT)gr_contract_milestones_update(UPDATE)
gr_contract_obligations
GR-10: Contract obligations and deliverables tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_to→pf_profiles(id)completed_by→pf_profiles(id)contract_id→gr_contracts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_contract_obligations_delete(DELETE)gr_contract_obligations_insert(INSERT)gr_contract_obligations_select(SELECT)gr_contract_obligations_update(UPDATE)
gr_contract_types
GR-10: Contract type definitions with org-specific configuration
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)
gr_contract_types_delete(DELETE)gr_contract_types_insert(INSERT)gr_contract_types_select(SELECT)gr_contract_types_update(UPDATE)
gr_contracts
GR-10: Main contract records with full lifecycle tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
approved_by→pf_profiles(id)contract_type_id→gr_contract_types(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_contracts_delete(DELETE)gr_contracts_insert(INSERT)gr_contracts_select(SELECT)gr_contracts_update(UPDATE)
gr_holiday_calendar
GR-14: Holiday calendar for business-day deadline calculation. NULL organization_id = system-wide (ARS 1-301).
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
gr_hc_delete(DELETE)gr_hc_insert(INSERT)gr_hc_select(SELECT)gr_hc_update(UPDATE)
gr_incident_corrective_actions
GR-09: Corrective action plans linked to incidents, investigations, and findings.
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→pf_profiles(id)completion_evidence_id→gr_compliance_evidence(id)created_by→pf_profiles(id)finding_id→gr_incident_findings(id)incident_id→gr_incidents(id)investigation_id→gr_incident_investigations(id)organization_id→pf_organizations(id)responsible_party_id→pf_profiles(id)updated_by→pf_profiles(id)
incident_coordinators_manage_corrective_actions(INSERT)incident_coordinators_update_corrective_actions(UPDATE)incident_corrective_actions_update(UPDATE)org_members_view_corrective_actions(SELECT)
gr_incident_findings
GR-09: Investigation finding records linked to investigations.
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)investigation_id→gr_incident_investigations(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
incident_coordinators_manage_findings(INSERT)org_members_view_findings(SELECT)
gr_incident_investigations
GR-09: Incident investigation records with root cause analysis.
RLS: ✅ enabled (3 policies)
Foreign keys:
completed_by→pf_profiles(id)created_by→pf_profiles(id)incident_id→gr_incidents(id)investigation_evidence_id→pf_documents(id)investigator_id→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
incident_coordinators_manage_investigations(INSERT)incident_coordinators_update_investigations(UPDATE)org_members_view_investigations(SELECT)
gr_incident_regulatory_reports
GR-14: Tracks regulatory reporting obligations per incident per regulatory body.
RLS: ✅ enabled (4 policies)
Foreign keys:
acknowledgment_document_id→pf_documents(id)created_by→pf_profiles(id)incident_id→gr_incidents(id)organization_id→pf_organizations(id)report_document_id→pf_documents(id)submitted_by→pf_profiles(id)updated_by→pf_profiles(id)
gr_irr_delete(DELETE)gr_irr_insert(INSERT)gr_irr_select(SELECT)gr_irr_update(UPDATE)
gr_incident_risk_links
GR-09: Links between incidents and GR-05 risk records.
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)incident_id→gr_incidents(id)organization_id→pf_organizations(id)risk_id→gr_risks(id)updated_by→pf_profiles(id)
incident_coordinators_delete_incident_risk_links(DELETE)incident_coordinators_manage_incident_risk_links(INSERT)org_members_view_incident_risk_links(SELECT)
gr_incidents
GR-09: Incident records including safety, compliance, operational, and clinical incidents.
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_to→pf_profiles(id)closed_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)reported_by→pf_profiles(id)resolved_by→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
compliance_officers_delete_incidents(DELETE)incident_coordinators_manage_incidents(UPDATE)org_members_report_incidents(INSERT)org_members_view_incidents(SELECT)
gr_inservice_reminder_log
GR-19: Append-only audit ledger of in-service compliance reminders & escalations. DELETEs are blocked at the RLS layer.
RLS: ✅ enabled (4 policies)
Foreign keys:
course_id→gr_training_courses(id)organization_id→pf_organizations(id)site_id→pf_sites(id)
gr_inservice_reminder_log_insert(INSERT)gr_inservice_reminder_log_no_delete(DELETE)gr_inservice_reminder_log_select(SELECT)gr_inservice_reminder_log_update(UPDATE)
gr_module_settings
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_module_settings_delete(DELETE)gr_module_settings_insert(INSERT)gr_module_settings_select(SELECT)gr_module_settings_update(UPDATE)
gr_policies
RLS: ✅ enabled (4 policies)
Foreign keys:
approved_by→pf_profiles(id)created_by→pf_profiles(id)deprecated_by→pf_profiles(id)document_id→pf_documents(id)organization_id→pf_organizations(id)owner_id→pf_profiles(id)replacement_policy_id→gr_policies(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_policies_delete(DELETE)gr_policies_insert(INSERT)gr_policies_select(SELECT)gr_policies_update(UPDATE)
gr_policy_acknowledgments
RLS: ✅ enabled (4 policies)
Foreign keys:
acknowledged_by→pf_profiles(id)acknowledgment_form_id→fw_form_submissions(id)assigned_by→pf_profiles(id)employee_id→hr_employees(id)organization_id→pf_organizations(id)policy_id→gr_policies(id)policy_version_id→gr_policy_versions(id)
gr_policy_acks_delete(DELETE)gr_policy_acks_insert(INSERT)gr_policy_acks_select(SELECT)gr_policy_acks_update(UPDATE)
gr_policy_assignments
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)department_id→pf_departments(id)employee_id→hr_employees(id)organization_id→pf_organizations(id)policy_id→gr_policies(id)site_id→pf_sites(id)updated_by→users(id)
gr_policy_assignments_delete(DELETE)gr_policy_assignments_insert(INSERT)gr_policy_assignments_select(SELECT)gr_policy_assignments_update(UPDATE)
gr_policy_regulatory_links
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)policy_id→gr_policies(id)updated_by→users(id)
gr_policy_reg_links_delete(DELETE)gr_policy_reg_links_insert(INSERT)gr_policy_reg_links_select(SELECT)gr_policy_reg_links_update(UPDATE)
gr_policy_versions
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)document_id→pf_documents(id)organization_id→pf_organizations(id)policy_id→gr_policies(id)updated_by→users(id)
gr_policy_versions_delete(DELETE)gr_policy_versions_insert(INSERT)gr_policy_versions_select(SELECT)
gr_procedure_compliance_score_snapshots
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
gr_compliance_snapshots_delete(DELETE)gr_compliance_snapshots_insert(INSERT)gr_compliance_snapshots_select(SELECT)gr_compliance_snapshots_update(UPDATE)
gr_procedure_executions
Tracks individual executions of procedures with step-by-step progress
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)executed_by→pf_profiles(id)organization_id→pf_organizations(id)procedure_id→gr_procedures(id)procedure_version_id→gr_procedure_versions(id)updated_by→pf_profiles(id)
gr_procedure_executions_insert(INSERT)gr_procedure_executions_select(SELECT)gr_procedure_executions_update(UPDATE)
gr_procedure_policy_links
Links procedures to policies they implement or support
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)policy_id→gr_policies(id)procedure_id→gr_procedures(id)
gr_procedure_policy_links_delete(DELETE)gr_procedure_policy_links_insert(INSERT)gr_procedure_policy_links_select(SELECT)
gr_procedure_steps
Denormalized procedure steps for efficient querying and execution tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)procedure_id→gr_procedures(id)updated_by→pf_profiles(id)
gr_procedure_steps_delete(DELETE)gr_procedure_steps_insert(INSERT)gr_procedure_steps_select(SELECT)gr_procedure_steps_update(UPDATE)
gr_procedure_template_regulatory_bodies
GR-12: M:N link from procedure templates to gr_regulatory_bodies (replaces legacy TEXT[]).
RLS: ✅ enabled (3 policies)
Foreign keys:
regulatory_body_id→gr_regulatory_bodies(id)template_id→gr_procedure_templates(id)
gr_procedure_template_regulatory_bodies_delete(DELETE)gr_procedure_template_regulatory_bodies_insert(INSERT)gr_procedure_template_regulatory_bodies_select(SELECT)
gr_procedure_templates
GR-12: Global and org-level procedure templates. NULL organization_id = global/system template visible to all orgs.
RLS: ✅ enabled (5 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)source_procedure_id→gr_procedures(id)updated_by→users(id)
gr_procedure_templates_admin_select(SELECT)gr_procedure_templates_delete(DELETE)gr_procedure_templates_insert(INSERT)gr_procedure_templates_select(SELECT)gr_procedure_templates_update(UPDATE)
gr_procedure_versions
Immutable version history for procedures
RLS: ✅ enabled (2 policies)
Foreign keys:
approved_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)procedure_id→gr_procedures(id)
gr_procedure_versions_insert(INSERT)gr_procedure_versions_select(SELECT)
gr_procedures
Standard operating procedures with visual workflow definitions
RLS: ✅ enabled (4 policies)
Foreign keys:
approved_by→pf_profiles(id)created_by→pf_profiles(id)implements_policy_id→gr_policies(id)organization_id→pf_organizations(id)owner_id→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_procedures_delete(DELETE)gr_procedures_insert(INSERT)gr_procedures_select(SELECT)gr_procedures_update(UPDATE)
gr_qi_improvements
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→pf_profiles(id)completion_evidence_id→gr_compliance_evidence(id)created_by→pf_profiles(id)metric_id→gr_qi_metrics(id)organization_id→pf_organizations(id)pdsa_cycle_id→gr_qi_pdsa_cycles(id)project_id→gr_qi_projects(id)responsible_party_id→pf_profiles(id)updated_by→pf_profiles(id)
gr_qi_improvements_delete_policy(DELETE)gr_qi_improvements_insert_policy(INSERT)gr_qi_improvements_select_policy(SELECT)gr_qi_improvements_update_policy(UPDATE)
gr_qi_metric_measurements
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)metric_id→gr_qi_metrics(id)organization_id→pf_organizations(id)updated_by→users(id)
gr_qi_metric_measurements_delete(DELETE)gr_qi_metric_measurements_insert(INSERT)gr_qi_metric_measurements_select(SELECT)gr_qi_metric_measurements_update(UPDATE)
gr_qi_metrics
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)project_id→gr_qi_projects(id)updated_by→pf_profiles(id)
gr_qi_metrics_delete_policy(DELETE)gr_qi_metrics_insert_policy(INSERT)gr_qi_metrics_select_policy(SELECT)gr_qi_metrics_update_policy(UPDATE)
gr_qi_pdsa_cycles
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→pf_profiles(id)created_by→pf_profiles(id)do_evidence_id→pf_documents(id)organization_id→pf_organizations(id)project_id→gr_qi_projects(id)updated_by→pf_profiles(id)
gr_qi_pdsa_cycles_delete_policy(DELETE)gr_qi_pdsa_cycles_insert_policy(INSERT)gr_qi_pdsa_cycles_select_policy(SELECT)gr_qi_pdsa_cycles_update_policy(UPDATE)
gr_qi_project_templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_qi_project_templates_delete(DELETE)gr_qi_project_templates_insert(INSERT)gr_qi_project_templates_select(SELECT)gr_qi_project_templates_update(UPDATE)
gr_qi_projects
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)owner_id→pf_profiles(id)site_id→pf_sites(id)source_event_id→fw_domain_events(id)updated_by→pf_profiles(id)
gr_qi_projects_delete_policy(DELETE)gr_qi_projects_insert_policy(INSERT)gr_qi_projects_select_policy(SELECT)gr_qi_projects_update_policy(UPDATE)
gr_regulatory_bodies
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)
gr_regulatory_bodies_delete(DELETE)gr_regulatory_bodies_insert(INSERT)gr_regulatory_bodies_select(SELECT)gr_regulatory_bodies_update(UPDATE)
gr_regulatory_change_events
GR-17: Detected regulatory changes per source, with severity classification and approval workflow.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)reviewed_by→users(id)source_id→gr_regulatory_sources(id)updated_by→users(id)
gr_reg_change_events_delete(DELETE)gr_reg_change_events_insert(INSERT)gr_reg_change_events_select(SELECT)gr_reg_change_events_update(UPDATE)
gr_regulatory_change_impacts
GR-17: Per-event impact rows linking a regulatory change to affected requirements/policies/KB.
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_to→users(id)change_event_id→gr_regulatory_change_events(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
gr_reg_change_impacts_delete(DELETE)gr_reg_change_impacts_insert(INSERT)gr_reg_change_impacts_select(SELECT)gr_reg_change_impacts_update(UPDATE)
gr_regulatory_change_snapshots
GR-17: Append-only content snapshots from regulatory sources for diff history.
RLS: ✅ enabled (2 policies)
Foreign keys:
change_event_id→gr_regulatory_change_events(id)created_by→users(id)organization_id→pf_organizations(id)source_id→gr_regulatory_sources(id)
gr_reg_change_snapshots_insert(INSERT)gr_reg_change_snapshots_select(SELECT)
gr_regulatory_reporting_rules
GR-14: Configuration rules defining which incident types trigger regulatory reporting obligations.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
gr_rrr_delete(DELETE)gr_rrr_insert(INSERT)gr_rrr_select(SELECT)gr_rrr_update(UPDATE)
gr_regulatory_requirements
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)last_verified_by→pf_profiles(id)organization_id→pf_organizations(id)regulatory_body_id→gr_regulatory_bodies(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_regulatory_requirements_delete(DELETE)gr_regulatory_requirements_insert(INSERT)gr_regulatory_requirements_select(SELECT)gr_regulatory_requirements_update(UPDATE)
gr_regulatory_sources
GR-17: External regulator endpoints (AHCCCS AMPM, DHCS, accreditors) the watcher polls.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
gr_regulatory_sources_delete(DELETE)gr_regulatory_sources_insert(INSERT)gr_regulatory_sources_select(SELECT)gr_regulatory_sources_update(UPDATE)
gr_risk_assessments
Risk assessment history tracking likelihood, impact, and scores over time
RLS: ✅ enabled (4 policies)
Foreign keys:
assessed_by→pf_profiles(id)organization_id→pf_organizations(id)risk_id→gr_risks(id)
gr_risk_assessments_delete(DELETE)gr_risk_assessments_insert(INSERT)gr_risk_assessments_select(SELECT)gr_risk_assessments_update(UPDATE)
gr_risk_links
Links risks to compliance requirements, audit findings, incidents, and policies
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)finding_id→gr_audit_findings(id)organization_id→pf_organizations(id)policy_id→gr_policies(id)requirement_id→gr_regulatory_requirements(id)risk_id→gr_risks(id)updated_by→users(id)
gr_risk_links_delete(DELETE)gr_risk_links_insert(INSERT)gr_risk_links_select(SELECT)gr_risk_links_update(UPDATE)
gr_risk_mitigations
Mitigation action plans for addressing identified risks
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→pf_profiles(id)completion_evidence_id→gr_compliance_evidence(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)responsible_party_id→pf_profiles(id)risk_id→gr_risks(id)updated_by→pf_profiles(id)
gr_risk_mitigations_delete(DELETE)gr_risk_mitigations_insert(INSERT)gr_risk_mitigations_select(SELECT)gr_risk_mitigations_update(UPDATE)
gr_risks
Core risk register storing all identified organizational risks
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)last_assessed_by→pf_profiles(id)organization_id→pf_organizations(id)owner_id→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_risks_delete(DELETE)gr_risks_insert(INSERT)gr_risks_select(SELECT)gr_risks_update(UPDATE)
gr_state_kb_collections
GR-06-EN-01: Platform-global catalog of state regulatory knowledge base collections (public regulatory text, e.g. AHCCCS AMPM, ARS statutes). Shared across all tenants by design; keyed by (state_code, jurisdiction_program, collection_name). Tenant-specific overrides belong in PF-96 jurisdiction profiles, not here. Writes restricted to platform_admin or pf.jurisdiction.profiles.manage.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)updated_by→pf_profiles(id)
gr_state_kb_collections_delete(DELETE)gr_state_kb_collections_insert(INSERT)gr_state_kb_collections_select(SELECT)gr_state_kb_collections_update(UPDATE)
gr_state_kb_documents
GR-06-EN-01: Platform-global regulatory documents (public state Medicaid manuals, AHCCCS policies, statutes) used as RAG context by the AI Compliance Advisor. Shared across all tenants by design; scoped by collection -> (state_code, jurisdiction_program). Writes restricted to platform_admin or pf.jurisdiction.profiles.manage.
RLS: ✅ enabled (4 policies)
Foreign keys:
collection_id→gr_state_kb_collections(id)created_by→pf_profiles(id)updated_by→pf_profiles(id)
gr_state_kb_documents_delete(DELETE)gr_state_kb_documents_insert(INSERT)gr_state_kb_documents_select(SELECT)gr_state_kb_documents_update(UPDATE)
gr_training_completions
RLS: ✅ enabled (4 policies)
Foreign keys:
certificate_document_id→pf_documents(id)course_id→gr_training_courses(id)created_by→pf_profiles(id)employee_id→hr_employees(id)enrollment_id→gr_training_enrollments(id)organization_id→pf_organizations(id)updated_by→users(id)verified_by→pf_profiles(id)
gr_training_completions_insert(INSERT)gr_training_completions_select_admin(SELECT)gr_training_completions_select_own(SELECT)gr_training_completions_update(UPDATE)
gr_training_courses
RLS: ✅ enabled (5 policies)
Foreign keys:
created_by→pf_profiles(id)document_id→pf_documents(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
gr_training_courses_delete(DELETE)gr_training_courses_insert(INSERT)gr_training_courses_select_admin(SELECT)gr_training_courses_select_org(SELECT)gr_training_courses_update(UPDATE)
gr_training_enrollments
RLS: ✅ enabled (6 policies)
Foreign keys:
assigned_by→pf_profiles(id)course_id→gr_training_courses(id)employee_id→hr_employees(id)organization_id→pf_organizations(id)waived_by→pf_profiles(id)
gr_training_enrollments_delete(DELETE)gr_training_enrollments_insert(INSERT)gr_training_enrollments_select_admin(SELECT)gr_training_enrollments_select_own(SELECT)gr_training_enrollments_update_admin(UPDATE)gr_training_enrollments_update_own(UPDATE)
gr_training_policy_links
RLS: ✅ enabled (3 policies)
Foreign keys:
course_id→gr_training_courses(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)policy_id→gr_policies(id)updated_by→users(id)
gr_training_policy_links_delete(DELETE)gr_training_policy_links_insert(INSERT)gr_training_policy_links_select(SELECT)
gr_training_requirement_links
GR-02-EN-01: Maps training courses to regulatory requirements they satisfy. Used by training_completed event consumers to auto-create compliance evidence.
RLS: ✅ enabled (4 policies)
Foreign keys:
course_id→gr_training_courses(id)organization_id→pf_organizations(id)regulatory_requirement_id→gr_regulatory_requirements(id)
gr_training_requirement_links_delete(DELETE)gr_training_requirement_links_insert(INSERT)gr_training_requirement_links_select(SELECT)gr_training_requirement_links_update(UPDATE)
gr_whistleblower_reports
GR-15: Whistleblower intake records — access restricted to compliance officer + org_admin; HR excluded
RLS: ✅ enabled (3 policies)
Foreign keys:
assigned_to→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)reporter_profile_id→pf_profiles(id)updated_by→pf_profiles(id)
gr_whistleblower_insert(INSERT)gr_whistleblower_select(SELECT)gr_whistleblower_update(UPDATE)