Sort and Deduplicate Meetings
Hard · Dataclasses
@dataclass(frozen=True, order=True) gives a class __init__, __eq__ and __hash__ (frozen instances cannot change, so they can live in sets and be dict keys), plus <, > and friends that compare fields in the order they are declared. A field declared with field(compare=False) is ignored by comparisons and hashing.
1. Turn Meeting into a frozen, ordered dataclass with the fields day (a string like "2026-03-02"), priority (an int, lower comes first), title (str) and note (str, default "", not used in comparisons).
2. Write schedule(rows). Each row is a dict with the keys day, priority, title and optionally note. Build Meeting objects, drop duplicates (same day, priority and title: keep the first one, with its note), sort them, and return one line per meeting: "<day> P<priority> <title>", followed by " (<note>)" when the note is not empty.
The driver run_schedule(rows) is already written. It also checks that meetings are frozen, that they are ordered by priority as a number, and that two meetings that only differ in their note are equal.
Next: Inventory Reconciliation