Event planning: tasks/checklists with due dates relative to event start
| Tier | operations |
| Role | unclassified (baselined) |
| Path | crates/operations/planning |
| Edition | 2021 |
| Targets | operations_planning, integration |
| Public items | 9 across 1 module |
| Tests | 27 |
What it is for
# operations-planning
Event planning library crate: tasks/checklists with due dates relative to event start.
Architecture
This crate provides planning items (tasks/checklists) that can be linked to:
- A single encounter (for one-time events)
- A recurring series (for recurring events)
Key Design Decisions
1. FK XOR Constraint: Each planning item must link to exactly one of:
encounter_id(for single events)series_id(for recurring events)
This prevents polymorphic linking while maintaining referential integrity.
2. Relative Due Dates: Items can have:
- Absolute due date (
due_at) - Relative offset (
due_offset_days- negative = before event)
3. Task Dependencies: Items can depend on other items for simple task graphs.
Example
use operations_planning::{PlanningItem, compute_due_date};
use chrono::{Duration, Utc};
// Create a task due 2 weeks before event start
let item = PlanningItem::for_encounter(encounter_id, "Book venue")
.with_description("Reserve the meeting room")
.due_offset(-14);
// Compute actual due date based on event start
let event_start = Utc::now() + Duration::days(30);
let due_date = compute_due_date(&item, event_start);
Capabilities
postgres (other)
PostgreSQL storage for planning items.
| Item |
|---|
async fn create_item(pool : & PgPool, item : & PlanningItem) -> Result <(), PlanningError> |
async fn get_item(pool : & PgPool, id : PlanningItemId) -> Result <PlanningItem, PlanningError> |
async fn update_item(pool : & PgPool, item : & PlanningItem) -> Result <(), PlanningError> |
async fn update_status(pool : & PgPool, id : PlanningItemId, status : PlanningStatus,) -> Result <(), PlanningError> |
async fn delete_item(pool : & PgPool, id : PlanningItemId) -> Result <(), PlanningError> |
async fn list_items_for_encounter(pool : & PgPool, encounter_id : EncounterId,) -> Result <Vec <PlanningItem>, PlanningError> |
async fn list_items_for_series(pool : & PgPool, series_id : SeriesId,) -> Result <Vec <PlanningItem>, PlanningError> |
async fn list_items_for_assignee(pool : & PgPool, party_id : identity_parties::PartyId,) -> Result <Vec <PlanningItem>, PlanningError> |
async fn list_incomplete_items(pool : & PgPool) -> Result <Vec <PlanningItem>, PlanningError> |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
operations_planning
postgres
Public surface
`postgres`
| Item | What it is |
|---|---|
async fn create_item(pool : & PgPool, item : & PlanningItem) -> Result <(), PlanningError> | Create a new planning item. |
async fn get_item(pool : & PgPool, id : PlanningItemId) -> Result <PlanningItem, PlanningError> | Get a planning item by ID. |
async fn update_item(pool : & PgPool, item : & PlanningItem) -> Result <(), PlanningError> | Update a planning item. |
async fn update_status(pool : & PgPool, id : PlanningItemId, status : PlanningStatus,) -> Result <(), PlanningError> | Update the status of a planning item. |
async fn delete_item(pool : & PgPool, id : PlanningItemId) -> Result <(), PlanningError> | Delete a planning item. |
async fn list_items_for_encounter(pool : & PgPool, encounter_id : EncounterId,) -> Result <Vec <PlanningItem>, PlanningError> | List planning items for an encounter. |
async fn list_items_for_series(pool : & PgPool, series_id : SeriesId,) -> Result <Vec <PlanningItem>, PlanningError> | List planning items for a series. |
async fn list_items_for_assignee(pool : & PgPool, party_id : identity_parties::PartyId,) -> Result <Vec <PlanningItem>, PlanningError> | List all items assigned to a party. |
async fn list_incomplete_items(pool : & PgPool) -> Result <Vec <PlanningItem>, PlanningError> | List all incomplete items (for dashboard). |
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
PartyId | identity_parties::PartyId |
PlanningError | error::PlanningError |
{compute_due_date,EncounterId,PlanningItem,PlanningItemId,PlanningLink,PlanningStatus,SeriesId,} | models::{compute_due_date,EncounterId,PlanningItem,PlanningItemId,PlanningLink,PlanningStatus,SeriesId,} |
{create_item,delete_item,get_item,list_incomplete_items,list_items_for_assignee,list_items_for_encounter,list_items_for_series,update_item,update_status,} | postgres::{create_item,delete_item,get_item,list_incomplete_items,list_items_for_assignee,list_items_for_encounter,list_items_for_series,update_item,update_status,} |
Boundary
Reaches into foundation, identity.
Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | operations |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/operations/planning |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_operations["operations"] --> n_foundation["foundation"] n_operations["operations"] --> n_identity["identity"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-basemodels` | foundation | no | always |
| `identity-parties` | identity | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | yes | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, serde | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
dotenvy | ^0.15 | — | no | always |
tokio | ^1 | full | no | always |
tokio-test | ^0.4 | — | no | always |
Build. None.
Depended on by. 2 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_planning["application-planning"] -->|uses| SELF n_foundation_test_support["foundation-test-support"] -->|uses| SELF SELF["operations-planning"] SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"] SELF -->|runtime| n_identity_parties["identity-parties"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
| Feature | Enables | On by default |
|---|---|---|
default | — | yes |
postgres | dep:sqlx | no |
flowchart LR n_default["default"] n_postgres["postgres"] --> n_dep_sqlx["dep:sqlx"]
Targets
| Kind | Name | Source |
|---|---|---|
| lib | operations_planning | `src/lib.rs` |
| test | integration | `tests/integration.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | none detected |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
2 workspace crates depend on this one: application-planning, foundation-test-support.
Verification
| Kind | Count |
|---|---|
| Unit tests | 9 |
| Integration tests | 18 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
postgres | 9 | 0 | 0 |
What the tests establish, by name:
test_cascade_delete_from_encounter—tests/integration.rstest_cascade_delete_from_series—tests/integration.rstest_compute_due_date_with_absolute—tests/integration.rstest_compute_due_date_with_offset—tests/integration.rstest_create_item_for_encounter—tests/integration.rstest_create_item_for_series—tests/integration.rstest_delete_item—tests/integration.rstest_get_item_not_found—tests/integration.rstest_item_with_dependency—tests/integration.rstest_items_sorted_by_order—tests/integration.rstest_list_incomplete_items—tests/integration.rstest_list_items_for_assignee—tests/integration.rstest_list_items_for_encounter—tests/integration.rstest_list_items_for_series—tests/integration.rstest_update_item—tests/integration.rstest_update_status—tests/integration.rstest_xor_constraint_both_null_fails—tests/integration.rstest_xor_constraint_both_set_fails—tests/integration.rstest_exports—src/lib.rstest_compute_due_date_absolute—src/models.rstest_compute_due_date_none—src/models.rstest_compute_due_date_offset—src/models.rstest_planning_item_for_encounter—src/models.rstest_planning_item_for_series—src/models.rstest_planning_status_parsing—src/models.rstest_planning_status_terminal—src/models.rstest_status_roundtrip—src/postgres.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 9 | 9 |
Public modules with a //! block | 1 | 1 |
pie showData
title Public items with rustdoc
"Documented" : 9
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 4 |
| Source lines | 716 |
| Code lines | 520 |
| Public API items | 9 |
| Public modules | 1 |
| Tests | 27 |
| Examples | 0 |
| Cargo features | 2 |
| Direct runtime dependencies | 9 |
| Workspace reverse dependencies | 2 |
pie showData
title Public API by kind
"function" : 9
pie showData
title Rust source composition
"Code" : 520
"Blank or comment" : 196
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.