Skip to content

Commit

Permalink
Merge pull request #3 from adewg/master
Browse files Browse the repository at this point in the history
Merge from master
  • Loading branch information
cookeac authored Dec 6, 2019
2 parents a3fba2e + f03c189 commit 1e234ed
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ValidateWithSpeccy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: validate JSON URL scheme
run: |
docker run wework/speccy lint -v -j https://raw.githubusercontent.com/${{github.repository}}/master/Release%20Candidate%20Messages/exampleUrlScheme.json
docker run wework/speccy lint -v -j https://raw.githubusercontent.com/${{github.repository}}/${GITHUB_REF##*/}/Release%20Candidate%20Messages/exampleUrlScheme.json
13 changes: 13 additions & 0 deletions .github/workflows/ValidateWithSpectral.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spectral JSON Validation CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: validate JSON URL scheme
run: |
docker run stoplight/spectral lint https://raw.githubusercontent.com/${{github.repository}}/${GITHUB_REF##*/}/Release%20Candidate%20Messages/exampleUrlScheme.json -v
152 changes: 149 additions & 3 deletions Release Candidate Messages/exampleUrlScheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"servers": [
{
"url": "http://example.com"
"url": "https://icar-ade.standard.com"
}
],
"tags": [
Expand All @@ -38,7 +38,7 @@
"get": {
"operationId": "get-milking-visits",
"summary": "Get the data for milking visits",
"description": "# Purpose\nProvides data from visits of animals to a milking parlour\n",
"description": "# Purpose\nProvides data from visits of animals to a milking parlour.\n \nThis comprises all posible data. Anybody can choose to define API's that return less information in the response.\n",
"tags": [
"release-candidate-milk"
],
Expand Down Expand Up @@ -124,7 +124,151 @@
"milkingDeviceId": "101",
"measureDeviceId": "101",
"eventOffset": "2019-11-01T23:58:31",
"eventDeviceId": "101"
"eventDeviceId": "101",
"quarterMilkings": [ {
"icarQuarterId": "LF",
"milkingDuration": {
"value": "210",
"unitCode": "SEC"
},
"milkingMilkWeight": {
"value": 3.5,
"unitCode": "KGM"
}
} ],
"animalMilkingSample": [ {
"bottleIdentifierType": "BRC",
"rackNumber": "3",
"bottlePosition": "7"
} ],
"icarMilkCharacteristics": [ {
"characteristic": "FAT",
"value": "3.74",
"unit": "VP",
"icarMeasuringDevice": "to_be_defined_by_ICAR-sensor_group"
},
{
"characteristic": "PROTEIN",
"value": "3.54",
"unit": "VP"
} ]
}
}
}
}
}
},
"default": {
"description": "An error has occured while handling the request. Check the content of the message for the error details.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"$ref": "#/components/schemas/error"
}
}
},
"description": "A default response containing only a list of errors"
}
}
}
}
}
}
},
"/locations/{location-scheme}/{location-id}/test-day-results": {
"get": {
"operationId": "get-test-day-results",
"summary": "Get the data for test days",
"description": "# Purpose\nProvides data from the test day for animals on a farm\n",
"tags": [
"release-candidate-milk"
],
"parameters": [
{
"name": "location-scheme",
"in": "path",
"description": "The scheme id for the location identifier.",
"required": true,
"schema": {
"type": "string",
"enum": [
"nl.ubn",
"de.farmid",
"be.pen"
]
}
},
{
"name": "location-id",
"in": "path",
"description": "The unique identifier for the location.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "start-date-time",
"in": "query",
"description": "The start of the date-time range for the data to get in the request.",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "end-date-time",
"in": "query",
"description": "The end of the date-time range for the data to get in the request.",
"schema": {
"type": "string",
"format": "date-time"
}
}
],
"responses": {
"200": {
"description": "Successful. The response contains the test day results for the given location",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "icarTestDayResource.json"
}
},
"examples": {
"response": {
"value": {
"id": "706250",
"animal": {
"id": "NL 877034232",
"scheme": "nl-v1"
},
"EventDateTime": "2019-11-01T23:58:31",
"milkWeight24Hours": {
"value": "21.7",
"unitCode": "KGM"
},
"testDayCode": "0",
"icarMilkCharacteristics": [
{
"characteristic": "FAT",
"value": "3.74",
"unit": "VP",
"icarMeasuringDevice": "to_be_defined_by_ICAR-sensor_group"
},
{
"characteristic": "PROTEIN",
"value": "3.54",
"unit": "VP"
}
]
}
}
}
Expand Down Expand Up @@ -987,8 +1131,10 @@
"schemas": {
"error": {
"type": "object",
"description": "Error information",
"properties": {
"data": {
"description": "Error information",
"$ref": "exampleErrorResource.json"
}
}
Expand Down
28 changes: 25 additions & 3 deletions Release Candidate Messages/icarMilkCharacteristicsType.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{
"type": "string",
"description": "ICAR Milk Characteristics Codes and values - we have at this moment SCC, FAT, PROTEIN, LAC, UREA, BLOOD, ACETONE, BHB, LDH, PRO, AVGCOND, MAXCOND, AVGFLWR, MAXFLWR, WEIGHT. E.g. SCC:123"
}
"description": "Characteristics of the milk produced.",
"required": [
"characteristic",
"value"
],
"type": "object",
"properties": {
"characteristic": {
"type": "string",
"description": "ICAR Milk Characteristics Codes and values - we have at this moment SCC, FAT, PROTEIN, LAC, UREA, BLOOD, ACETONE, BHB, LDH, PRO, AVGCOND, MAXCOND, AVGFLWR, MAXFLWR, WEIGHT.\nThe following units have to be applied:\n\n|SCC|Somatic cell count|x1000 cells/ml|NCL\n|FAT|Fat|%|VP\n|PROTEIN|Protein|%|VP\n|LAC|Lactose|%|VP\n|UREA|Urea|mg/l|M1\n|BLOOD|Blood|true/false|A99\n|ACETONE|Acetone|mmol/l|M33\n|BHB|Beta hydroxybutyrate|mmol/l|M33\n|LDH|Lactate dehydrogenase|IU/l|\n|PRO|Progesteron|mmol/l|M33\n|AVGCOND|Average conductivity value of the milk at 25 ° C|mS/cm|H61\n|MAXCOND|Maximum conductivity value of the milk at 25 ° C|mS/cm|H61\n|AVGFLWR|Average flow rate|Kg/min|F31\n|MAXFLWR|Max flow rate|Kg/min|F31\n|WEIGHT|Weight of animal|Kg|KGM\n|PAG|Pregnancy associated glycoprotein|mmol/l|M33"
},
"value": {
"type": "string",
"description": "the value of the characteristic measured"
},
"unit": {
"type": "string",
"description": "the defaults are described above, only use this field when differed from the default. Use UN/CEFACT codes."
},
"icarMeasuringDevice": {
"type": "string",
"description": "a more readable device class ID that contains manufacturer, device, hardware and software versions in a way that is similar to the USB specification. This will need more investigation."
}
}
}
2 changes: 1 addition & 1 deletion Release Candidate Messages/icarMilkingVisitResource.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"$ref": "icarAnimalMilkingSampleType.json"
}
},
"icarMilkCharacteristicsTypes": {
"icarMilkCharacteristics": {
"type": "array",
"items": {
"$ref": "icarMilkCharacteristicsType.json"
Expand Down
9 changes: 9 additions & 0 deletions Release Candidate Messages/icarTestDayCodeType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "string",
"description": "The test day code, indicating a status of the cow on the test day.",
"enum": [
"Dry",
"Sampling impossible",
"Sick"
]
}
31 changes: 31 additions & 0 deletions Release Candidate Messages/icarTestDayResource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"required": [
"id",
"animal",
"EventDateTime"
],

"type": "object",

"allOf": [
{
"$ref": "icarEventCoreResource.json"
},
{
"properties": {
"MilkWeight24Hours": {
"$ref": "icarMilkingMilkWeightType.json"
},
"TestDayCode": {
"$ref": "icarTestDayCodeType.json"
},
"icarMilkCharacteristics": {
"type": "array",
"items": {
"$ref": "icarMilkCharacteristicsType.json"
}
}
}
}
]
}
6 changes: 3 additions & 3 deletions location-scheme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ These schemes point to a specific animal.

| id | name | example| region & issuing party | RegEx |
|---|---|---|---|---|
| eu-animal-id | LOM | 276000312312345 | EU wide scheme with a country prefix, combining multiple national schemes. | |
| nl-v1 (rename to eu-??) | animal life number |NL 6802 *5082* 9 | EU wide scheme with a countryprefix, but different than the one above? [RVO on levensnummers](http://www.rvo.nl/onderwerpen/agrarisch-ondernemen/dieren/dieren-registreren/runderen/oormerken-voor-runderen) | |
| eu-animal-id | LOM | 276000312312345 | EU wide scheme with a country prefix, combining multiple national schemes. Is used by transponders. First 3 positions is country code , e.g. 276=DE, is numeric, 15 digits. | |
| nl-v1 (rename to eu-??) | animal life number |NL 6802 *5082* 9 | EU wide scheme with a countryprefix, but different than the one above? [RVO on levensnummers](http://www.rvo.nl/onderwerpen/agrarisch-ondernemen/dieren/dieren-registreren/runderen/oormerken-voor-runderen) | |

## Legal entities / companies

Expand All @@ -53,5 +53,5 @@ These schemes point to a legal entity. One that can be authenticated and is auth
| id | name | example| region & issuing party | RegEx |
|---|---|---|---|---|
| nl-kvk | Chamber of commerce number (Kamer van Koophandel nummer) |64039641 | Used in the Netherlands. Issued by the 'Kamer van Koophandel', can be checked at e.g. [OpenKVK](www.openkvk.nl) | |
| be0onn | Chamber of commerce number (Ondernemersnummer) | | Used in Belgium. Issued by the 'Kruispuntbank voor Ondernemingen', can be checked at e.g. [fgov](https://kbopub.economie.fgov.be/kbopub/zoeknummerform.html?lang=nl) | |
| be-onn | Chamber of commerce number (Ondernemersnummer) | | Used in Belgium. Issued by the 'Kruispuntbank voor Ondernemingen', can be checked at e.g. [fgov](https://kbopub.economie.fgov.be/kbopub/zoeknummerform.html?lang=nl) | |

0 comments on commit 1e234ed

Please sign in to comment.