Skip to content

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

Referenced by

Uses types

NationalIdentifierType, Telephone

Subtypes

6.2.2.2.6 Rules & constraints