calendar
Handles recurring events, timezone-aware occurrence expansion, conflict detection, iCal export/import, and admin UI components for scheduling applications.
Key namespaces
| Namespace | Layer | Responsibility |
|---|---|---|
|
shared |
Malli schemas: |
|
shared |
|
|
core |
|
|
core |
RRULE parsing, |
|
core |
|
|
core |
Pure Hiccup: |
|
shell |
ical4j adapter ( |
|
shell |
Public API: |
Defining event types
(require '[boundary.calendar.core.event :as event])
(event/defevent appointment-event
{:id :appointment
:label "Appointment"
:schema [:map
[:patient-id :uuid]
[:room :string]]})
(event/get-event-type :appointment) ;=> {:id :appointment ...}
(event/list-event-types) ;=> [:appointment ...]
Recurring events (RRULE)
(require '[boundary.calendar.core.recurrence :as recurrence])
;; Expand weekly recurring event
(recurrence/occurrences event-data start-dt end-dt)
;; Next occurrence from an explicit reference instant
(recurrence/next-occurrence* event-data after-dt)
;; Full expansion with metadata
(recurrence/expand-event event-data range-start range-end)
Conflict detection
(require '[boundary.calendar.core.conflict :as conflict])
(conflict/overlaps? event-a event-b) ;=> true/false
(conflict/find-conflicts new-event existing-events)
;=> [{:event existing-event :overlap-start ... :overlap-end ...}]
iCal export / import
(require '[boundary.calendar.shell.service :as cal])
;; Export to iCal string
(cal/export-ical events)
;; Import from iCal string
(cal/import-ical ical-string)
;; HTTP response for iCal feed (subscription URL)
(cal/ical-feed-response events {:filename "appointments.ics"})
Dependencies
Uses org.mnode.ical4j/ical4j {:mvn/version "4.0.3"} (note: group ID is org.mnode.ical4j, Java packages are still net.fortuna.ical4j.*).
Testing
clojure -M:test:db/h2 :calendar