Animal tracking
This is an Animal Tracking Business Network based on UK DEFRA government regulations (https://www.gov.uk/animal-movement-england). Farmers can move animals between farms/fields and the UK government farming regulator has visibility into the locations of all animals and all animal movements between farms.
This business network defines:
Participants Farmer Regulator
Assets Animal Business Field
Transactions AnimalMovementDeparture AnimalMovementArrival SetupDemo
Each Farmer owns a Business that is identified by a Single Business Identifier (SBI). A Farmer owns a set of Animals. A Business owns a set of Fields. A Field contains a set of Animals owned by the Farmer. Animals can be transferred between Farmers or between Fields.
composer-sample-networks/packages/animaltracking-network at master · hyperledger-archives/composer-sample-networks
GitHub
1
archetype animal_tracking
2
3
enum animal_e =
4
| Sheep
5
| Cattle
6
| Pig
7
| Other
8
9
enum movement_e =
10
| In_field initial
11
| In_transit
12
13
asset animal_a identified by ida {
14
ida : string;
15
typ : animal_e;
16
location : pkey<field_a>;
17
} with states movement_e
18
19
asset business_a identified by id {
20
id : string;
21
incomings : aggregate<animal_a>;
22
}
23
24
asset field_a identified by name {
25
name : string;
26
business : pkey<business_a>;
27
}
28
29
transition transit (fk : string) on (ak : pkey<animal_a>) {
30
from In_field
31
to In_transit
32
with effect {
33
business_a[field_a[fk].business].incomings.add(ak)
34
}
35
}
36
37
transition arrival (toField : pkey<field_a>) on (ak : pkey<animal_a>) {
38
from In_transit
39
to In_field
40
with effect {
41
animal_a[ak].location := toField;
42
business_a[field_a[toField].business].incomings.remove(ak)
43
}
44
}
45
Copied!
Last modified 1yr ago
Export as PDF
Copy link
Edit on GitHub