Danvas
Danvas
DashboardSupportWelcome

👤 USER DOCS

User Guides

Getting Started

Getting StartedDashboard & OnboardingApp Settings

Tutorials

Tutorial: Setting Up Shift Tasks & ClosersTutorial: Managing Incidents in the InboxTutorial: Tracking Compliance & Sync StatusTutorial: Operational Workflows with the AI AssistantTutorial: Building & Deploying Custom Checklists

Daily Operations (Staff)

Shift Workspace & TasksService Day SetupDaily Line-UpStaff Service Day ReportsForms

Communication & Chat

Messages & AnnouncementsUnified Operations InboxAI Assistant

Manager & Admin Guides

Daily Line-Up SetupStaff SchedulingManaging LocationsNPS and Guest FeedbackCouponsContacts and Guest HistoryManager CloseoutsDaily Line-Up & ComplianceAnalyticsIncident ReportingWhistleblower Concerns & FeedbackAdmin Tools

⚙️ DEVELOPER DOCS

Getting Started

Getting StartedDevelopmentDeployment Guide

Architecture

Architecture OverviewExplanation: AI Integration & Tenant SecurityExplanation: Dynamic Forms Engine DesignExplanation: Compliance Ledger DesignExplanation: Live Sync & Data FreshnessData FlowArchitecture Decision Records

Core Domain

Core DomainDatabase ReferenceLocations DomainAuth & RBACScheduling DomainReports DomainIncidents DomainUnified Operations InboxLive Sync Data FreshnessToast Sync PipelineNotifications DomainCoupons and Guest NPSAudit Log & Compliance ArchitectureDesign Audit FindingsAI Chat IntegrationAnalytics & Tips Integration

Frontend

Frontend ArchitectureFormsLoading SkeletonsComponentsPWA & Offline ShellScreenshots

API Reference

API Reference

Endpoints

POS Sales APIOptimization Data APISchedule Shifts APIEmployee Export APIReports APIIncidents APIAI Chat APIPush Notifications APIWebhooks APICron API

Contributing

ContributingCode Examples

Security

Security & Compliance

Release Notes

What's New

Explanation: Compliance Ledger Design

Architectural explanation of the decoupled compliance ledger, service week boundaries, and dual filing obligations

The Compliance Ledger is the scheduled-expectation compatibility projection; the authoritative worked-shift fact is report_obligations. This document explains their boundary, service-day keys, deadline/certification states, and dual-obligation behavior.


Why a Decoupled Ledger?

In earlier iterations of Danvas, compliance was evaluated on the fly by joining schedules (management_shifts) and submissions (server_reports). While simple, this approach introduced significant issues:

  1. Schedule Mutability: Reopening or modifying a schedule after a shift had already occurred would retroactively delete or alter compliance records, destroying the historical audit trail.
  2. Line-Up Mismatches: Staff shift expectations are driven by a mix of published schedules (for Front-of-House) and Daily Line-Up assignments (for floor roles). On-the-fly calculations became too complex and error-prone.

The compliance table remains a transaction-secured compatibility ledger whose rows are generated at discrete lifecycle moments. Authoritative expected obligations are reconciled separately from canonical worked labor:

  • Schedule finalization → manager compatibility rows and provisional manager-obligation candidates (one row per employee/service day)
  • Lineup publish → staff compatibility rows and provisional shift-obligation candidates (service-day grain — one row per employee per service date)
  • Worked-shift reconciliation → authoritative report_obligations rows from canonical f_time_entries, with source digest and certification state
  • Draft lineup saves do not seed staff compliance

Once expectations are filed, historical rows remain even if schedules are reopened.


Staff service-day grain (ADR-0070)

Staff shift reports use one compliance row per employee per service date per location, not one row per daypart. A bartender on Lunch and Dinner lineups files one shift report. The report's shift field stores the primary daypart (longest scheduled segment); goals sum across daypart assignments.


Saturday–Friday Service Week Rationale

Weekly compliance percentages are calculated strictly on a Saturday–Friday service week boundary. This matches the payroll and scheduling configuration of our primary integration anchors (7shifts and Toast POS).

Using a standard calendar week (Monday–Sunday) would cause:

  • Double-counting: Weekend shifts would span across payroll periods.
  • Goal mismatch: Sales targets set for the weekend would split across two different compliance cycles.

Worked-shift authority and filing

report_obligations is unique on (teamId, locationId, serviceDate, subjectType, subjectId, reportType) via uniq_report_obligation. Reconciliation is partition replacement for one exact team/location/service-date scope. It records canonical time-entry and job lineage, computes a next-day 4:00 a.m. deadline in the location timezone, and uses certificationStatus (provisional or certified) separately from status (unfiled, draft, filed, late, excused, cancelled, superseded, quarantined, or provisional).

Report submission is fail-closed: fileReportObligation matches an existing applicable obligation and returns no_applicable_obligation when one is absent; it never creates the expected row. A provisional submission is retained until reconciliation can certify it. A certified submission links the exact report and becomes filed or late. The legacy compliance projection is updated only after this match.

Dual Obligations Design

A key design challenge was how to handle managers who also work floor shifts. In restaurants, a Salaried Manager may be scheduled for a MOD (Manager on Duty) shift but also assigned to a floor section (e.g., Bartender) on the Daily Line-Up card.

To handle this, the ledger decouples report types:

  • type: manager rows are seeded from schedule finalization (one per employee/service day).
  • type: staff rows are seeded from published Daily Line-Up assignments (service-day grain).

A single user can have one manager row and one staff row for the same service day when scheduled and assigned on a published lineup. The compatibility shift value remains for primary-daypart attribution and legacy readers; it is not the accountability key.

Explanation: Dynamic Forms Engine Design

Architectural explanation of JSONB schemas, dynamic runtime Zod validation, and local draft persistence in the forms engine

Explanation: Live Sync & Data Freshness

Deep dive into the Toast POS / 7shifts sync pipeline, FastAPI bridging, and cacheLife performance optimizations

On this page

Why a Decoupled Ledger?Staff service-day grain (ADR-0070)Saturday–Friday Service Week RationaleWorked-shift authority and filingDual Obligations Design