Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Commit 5541028

Browse files
Create cog.md
1 parent 7f30acf commit 5541028

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

  • sphinx/technical_decisions

sphinx/technical_decisions/cog.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Technical Justification: Collection Object Groups (COG) Design & Implementation
2+
3+
## Purpose and Context
4+
5+
In Specify, individual specimens and samples are stored as **Collection Objects (COs)**, each with a unique GUID and catalog record. However, when COs share a physical or contextual connection—such as being part of the same organism, mounted on a common medium, or co-located they can be grouped logically using **Collection Object Groups (COGs)**.
6+
See [Collection Object Groups Discourse Post](https://discourse.specifysoftware.org/t/collection-object-groups/2226) for background.
7+
8+
## Flexibility in Abstraction
9+
10+
COGs allow collections to balance granularity versus simplicity. Collections may choose not to designate separate COs for closely related specimens, instead grouping them in a single record to reflect resource constraints or specific cataloging protocols. Conversely, COGs become essential when multi-component relationships are meaningful—for example, minerals embedded in a slab or multiple specimens on a herbarium sheet—improving efficiency in cataloging, querying, data exports, and managing loans or transactions.
11+
12+
## Types of COGs and Business Logic
13+
14+
COGs can be categorized into three **super types**, each with distinct behaviors:
15+
16+
| Super Type | Description | Key Behavior |
17+
|------------------|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
18+
| **Consolidated** | Physically joined objects (e.g., a rock slab, microscope slide) | Requires a **primary CO**; transactions treat group as a unit |
19+
| **Discrete** | Related but separate objects (e.g., multiple plant species collected together) | No primary CO required; each CO remains equally independent |
20+
| **Drill Core** | Segmented cores ordered by depth/age | Linear grouping with no primary CO required |
21+
22+
## Implementation Details
23+
24+
- COGs are defined via a *COG Type* record, setting both a user-friendly name and the super type.
25+
- Relationships are managed in the `collectionobjectgroupjoin` (COJO) table, which stores the children (COs or other COGs); primary and substrate roles are also supported.
26+
- For **Consolidated** COGs, marking a CO as **primary** ensures proper handling in reporting and transactional processes—such as loans, where including a preparation of a CO within a COG triggers inclusion of all related COG components.
27+
28+
---

0 commit comments

Comments
 (0)