Glossary: treetracker-api
Generated by .github/scripts/build-glossary.mjs from domain-graph.json (source commit 85258c8). Do not edit by hand.
This glossary lists the business terms of treetracker-api. Each term links to its domain, which says what the domain does, its rules, and its flows. The estate glossary shows which other repos use the same terms.
Terms
- Capture: Capture Management
- CaptureTag: Capture Management, Tagging
- DomainEvent: Capture Management, Domain Events & Messaging
- GrowerAccount: Grower Account Management
- GrowerAccountImage: Grower Account Management
- Tag: Tagging
- Tree: Tree Management
- TreeTag: Tree Management, Tagging
Domains
Capture Management
Handles ingestion and lifecycle of captures, the field photos submitted when a grower plants a tree. Validates and persists capture records, then raises capture-created domain events for downstream matching and verification.
Terms: Capture, CaptureTag, DomainEvent
Rules:
- A capture must pass Joi validation before persistence
- Capture writes run inside a DB transaction
- Creating a capture raises a capture-created domain event
Flows:
- Capture Ingestion (
POST /captures): Validates and persists a new capture, then raises and publishes a capture-created domain event within a transaction. - Capture Query (
GET /captures): Lists captures with filtering, pagination, and next/prev navigation links.
Tree Management
Manages verified trees (matched plantings) including CRUD, spatial potential-match resolution between captures and trees via PostGIS, and legacy-tree approval against the legacy TreeTracker API.
Terms: Tree, TreeTag
Rules:
- Potential matches resolve captures to trees using spatial (PostGIS) queries
- Tree creation raises a tree-created domain event
- Legacy trees are approved through an authenticated external API call
Flows:
- Tree Registration (
POST /trees): Validates and creates a tree, then publishes a tree-created domain event. - Capture-to-Tree Matching (
GET /trees/potential_matches): Resolves potential matching trees for a given capture using spatial PostGIS queries. - Legacy Tree Approval (
event/service): Approves a legacy tree by issuing an authenticated PATCH to the legacy TreeTracker API.
Grower Account Management
Manages grower accounts, the people who plant and photograph trees, including list, create, update, and upsert operations. Also handles grower profile images stored in S3 object storage.
Terms: GrowerAccount, GrowerAccountImage
Rules:
- Grower accounts support idempotent upsert
- Grower images are stored in S3, not the database
- Image upload and record persistence are transactional with rollback and temp-file cleanup on failure
Flows:
- Grower Account Upsert (
POST /grower_accounts): Creates or updates a grower account idempotently. - Grower Account Image Upload (
POST /grower_accounts/{id}/image): Uploads a grower profile image to S3 and persists the image record transactionally.
Tagging
Maintains the shared tag vocabulary and associates tags with both captures and trees. Provides tag CRUD and the association endpoints used to classify field data.
Terms: Tag, CaptureTag, TreeTag
Rules:
- Tags are shared across captures and trees
- A tag association links exactly one tag to one capture or tree
Flows:
- Tag Management (
POST /tags): Provides CRUD for the shared tag vocabulary. - Capture Tag Assignment (
POST /captures/{id}/tags): Attaches tags to a capture. - Tree Tag Assignment (
POST /trees/{id}/tags): Attaches tags to a tree.
Domain Events & Messaging
Owns the asynchronous domain event backbone: an event store plus a RabbitMQ (rascal) broker that publishes and subscribes to domain events such as capture-created, tree-created, and raw-capture rejection. Dispatches consumed messages to registered handlers.
Terms: DomainEvent
Rules:
- Domain events are persisted before publication and marked sent on publish
- Consumed messages are dispatched to a registered handler within a DB session
- Rejected raw captures produce a rejection event
Flows:
- Event Publication (
domain event raised): Persists a domain event and publishes it to the RabbitMQ broker. - Event Consumption (
queue subscription): Subscribes to the queue, receives messages, and dispatches them to registered handlers.