6.2.2.2 Organization
6.2.2.2.1 Purpose¶
An Organization is a customer body that uses Moonitoring, and always exactly one of four types: a farm that keeps animals, a cooperative that groups farms, an insurer that covers them, or a professional, such as a veterinary practice, an advisor or a laboratory, that farms share data with. Only a farm holds animal data; the other types reach it through the delegations farms give them, and each type offers its own set of predefined roles. It holds members, roles and data feeds, and it is the boundary of access: users see animals and records through the Organizations they belong to. A farm also carries the timezone used to read local times that sources send without an offset.
6.2.2.2.2 Questions it answers¶
- Is it a farm, a cooperative, an insurer or a professional, and which roles does it offer?
- Which farms belong to a cooperative?
- Who owns the Organization, and who are its members?
- Which timezone applies to times a farm's sources report without an offset?
- What is the Organization's fiscal identity and contact number?
6.2.2.2.3 Fields¶
| Field | Type | Cardinality | Description |
|---|---|---|---|
id |
string (uuid) |
1..1 |
Key. |
name |
string |
1..1 |
|
fiscal_national_identifier |
NationalIdentifierType (regex) | 1..1 |
Unique. Regex depends on the Organization's nation. |
telephone_number |
Telephone | 1..1 |
Unique. |
owner |
Person | 1..1 |
The only Person who holds the Owner role (owner) in the Organization. They get it by creating the Organization or by a transfer of ownership, which only the owner can make; never through an invitation, a join link, a group or a delegation. |
members |
DirectMembership | 0..* |
|
status |
enum | 1..1 |
Values: pending, active, suspended, closing, closed. Default: pending.pending: created by its owner through self-service and waiting for a staff approval; its members can sign in but do nothing else until it is active. suspended: by staff; like pending, and its data stays. The event organization.created is published when it becomes active.closing: a closure was requested and its grace period runs (see OrganizationClosure); closed: the closure ran. A closed Organization is a tombstone: its row and id stay so that history stays consistent, everything that identifies it is removed, and it can never be reopened. |
created_at |
datetime |
1..1 |
|
updated_at |
datetime |
1..1 |
6.2.2.2.4 Subtypes¶
Discriminator type: every Organization is exactly one of the subtypes below (disjoint and complete).
Cooperative¶
Groups farms (Farm.cooperative) and imposes constraints on them (CooperativeConstraint). It reads the data of its farms only through the delegations they give it (OrganizationDelegationMembership).
Offers the predefined roles Owner, Manager and Advisor (OrganizationRoleAccessControl.organization_types); receives by delegation Technician, Veterinarian and Advisor (OrganizationRoleAccessControl.delegatee_types), Advisor being the usual one.
Its Owner and Manager see its member farms with access.cooperative_members.read.
No fields beyond those of the parent.
Farm¶
Keeps animals: the farm data of the model belongs to a Farm, and only a Farm delegates (OrganizationDelegationMembership.delegator).
Offers every predefined role but Analyst: Owner, Manager, Technician, Veterinarian, Advisor and Sync Client (OrganizationRoleAccessControl.organization_types). It never receives a delegation: there is no delegation from one farm to another.
| Field | Type | Cardinality | Description |
|---|---|---|---|
cooperative |
Cooperative | 0..1 |
Set by a link request the farm makes and the cooperative accepts, never by the farm alone; either side can end the link. The request itself is transient and is not an entity of this model. |
timezone |
string (IANA) |
1..1 |
e.g. Europe/Rome. Sources often send local times without offset; they are converted with this timezone. |
Insurer¶
An insurance company that covers farms. It reopens interface decision D11 and reaches farm data only through the delegations farms give it, as a cooperative does.
Offers the predefined roles Owner, Manager and Analyst (OrganizationRoleAccessControl.organization_types); receives by delegation Analyst only (OrganizationRoleAccessControl.delegatee_types), which reads and never writes.
No fields beyond those of the parent.
Professional¶
A veterinary practice, an advisor, a consultant or a laboratory that farms share data with; it reaches farm data only through the delegations farms give it.
Offers the predefined roles Owner, Manager, Veterinarian and Advisor (OrganizationRoleAccessControl.organization_types); receives by delegation Technician, Veterinarian and Advisor (OrganizationRoleAccessControl.delegatee_types).
No fields beyond those of the parent.
6.2.2.2.5 Relationships¶
References
Organization.owner→ Person (1..1)Organization.members→ DirectMembership (0..*)Farm.cooperative→ Cooperative (0..1)
Referenced by
ServiceAccount.organization(1..1)DirectMembership.organization(1..1)OrganizationDelegationMembership.delegatee(1..1)OrganizationDelegationMembership.delegator(1..1)CooperativeConstraint.cooperative(as Cooperative) (1..1)UserGroup.organization(1..1)Entitlement.organization(1..1)OrganizationClosure.organization(1..1)OrganizationInvitation.organization(1..1)RefreshToken.organization(0..1)OrganizationJoinLink.organization(1..1)WebhookSubscription.organization(1..1)PlatformAuditEvent.organization(0..1)PlatformAuditEvent.acting_organization(0..1)FeatureUsage.organization(0..1)AnimalProfileEvidence.farm(as Farm) (1..1)ExternalIdentifier.organization(0..1)FarmIdentifier.farm(as Farm) (1..1)Ownership.legal_organization(0..1)Ownership.manager_farm(as Farm) (1..1)SourceOrigin.organization(0..1)SourceChannel.organization(0..1)Device.farm(as Farm) (1..1)SourceFeed.farm(as Farm) (1..1)SourceFeed.owner_organization(1..1)AdapterMapping.organization(0..1)IntegrationGapOccurrence.farm(as Farm) (1..1)CanonicalObservation.farm(as Farm) (1..1)ObservationSession.farm(as Farm) (1..1)CanonicalEvent.farm(as Farm) (1..1)CanonicalPeriod.farm(as Farm) (1..1)FarmConfiguration.farm(as Farm) (1..1)DataIssue.farm(as Farm) (1..1)SourceReliability.farm_exception(as Farm) (0..1)ProductMaterial.organization(0..1)SyncClient.farm(as Farm) (1..1)OfficialSubmission.farm(as Farm) (1..1)ErasureRequest.farm(as Farm) (1..1)ReleaseChannelAccess.organization(1..1)ReleaseInstallation.organization(0..1)AgentConversation.organization(0..1)AgentConnectorInstance.organization(1..1)MlDatasetSelection.organizations(0..*)Farm.cooperative(as Cooperative) (0..1)
Uses types
NationalIdentifierType, Telephone
Subtypes
- by
type: Cooperative, Farm, Insurer, Professional
6.2.2.2.6 Rules & constraints¶
- Every Organization is exactly one type, Farm, Cooperative, Insurer or Professional: it is chosen when the Organization is created and no operation changes it. The type tells every app what to show (
RefreshToken.organization), and which roles the Organization offers and receives (OrganizationRoleAccessControl.organization_types,OrganizationRoleAccessControl.delegatee_types).