-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop JSON Schema for Event Profile 'Fishing Event' #7
Comments
Dear @RalphTro Just wanted to update you that @albert-verdeny and I are in contact and started to develop the JSON Schema based on your detailed description. We will keep you posted on the same and request for your feedback as we have the draft version of the same. Best regards, |
Dear @Aravinda93 and @albert-verdeny - MANY THANKS! |
Dear @RalphTro I have one small confusion associated with point Because the field key contains Can you please confirm if Example 1 with "cbvmda:vesselCatchInformationList": [
{
"cbvmda:vesselFlagState": "DE",
"cbvmda:vesselID": "1234"
}
] Example 2 with "cbvmda:vesselCatchInformationList": {
"cbvmda:vesselFlagState": "DE",
"cbvmda:vesselID": "1234"
} |
Dear @Aravinda93 , |
Thanks a lot for the quick clarification. Yes even I thought it should be an |
Dear @RalphTro, many thanks for the great profile! And thanks so much @Aravinda93 for driving the technical implementation! Just a minor clarification about the requirement 11: what do you mean exactly with "declaration"? |
Dear @albert-verdeny , |
Dear @albert-verdeny and @Aravinda93, |
Dear @RalphTro Surely we can provide you with the first draft of the JSON profile before Friday. It has gone through initial testing from @albert-verdeny and my side. There are some minor changes and final validation needs to be done from our end as soon as it's done we will provide you with the same. |
Super. Thanks for the heads-up and looking forward to testing it! |
Dear @RalphTro, Another point I would like to clarify: in your requirement
I understand the two fields are required, correct? Now, in the comments above we see that Do we want to ensure that there is at least one element on this array or any similar condition? If not, this means |
Dear @albert-verdeny , As to "I understand the two fields are required, correct?" --> Correct. Both fields need to be present. (For instance, to ensure that an event contains data that is legally required.) As to "Do we want to ensure that there is at least one element on this array or any similar condition?" --> I would like to see that the schema validates/ensures that both sub-fields are present, non-empty, and filled with a proper value (i.e. string + ISO 3166-1 alpha-2 code). Does this answer your question? |
Dear @RalphTro, Thanks for the reply and apologies I am not clear on the second point yet. I understand that the attribute I also understand that the items What I'm still unsure about: is there any restriction in the number of items that the array |
Basically I want to avoid the situation where we have an event with |
Ah, I see now what you meant. Yes, I think avoiding an empty array as you pointed out is a good idea/helpful further quality check! In this case, defining that this property needs to contain at least one sub-property would do the trick from my POV. |
Dear @RalphTro @albert-verdeny and I have created the initial version of the JSON Schema based on your requirements. Event Profile Issue#7 Schema.json ExampleJSON Schema{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "https://ref.gs1.org/standards/epcis/epcis-json-schema.json"
},
{
"type": "object",
"properties": {
"@context": {
"type": "array",
"items": {
"type": "string",
"const": "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld"
},
"minItems": 1,
"maxItems": 1
},
"type": {
"type": "string",
"enum": ["ObjectEvent"]
},
"action": {
"type": "string",
"enum": ["ADD"]
},
"bizStep": {
"type": "string",
"enum": ["commissioning"]
},
"readPoint": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/readPointId"
}
},
"required": ["id"]
},
"quantityList": {
"type": "array",
"items": {
"$ref": "#/definitions/quantityElement"
},
"minItems": 1,
"maxItems": 1
},
"ilmd": {
"type": "object",
"properties": {
"cbvmda:bestBeforeDate": {
"type": "string",
"format": "date"
},
"cbvmda:storageStateCode": {
"type": "string",
"enum": ["NOT_PREVIOUSLY_FROZEN", "PREVIOUSLY_FROZEN"]
},
"cbvmda:vesselCatchInformationList": {
"type": "array",
"items": {
"type": "object",
"properties": {
"cbvmda:vesselID": {
"type": "string"
},
"cbvmda:vesselFlagState": {
"$ref": "#/definitions/vesselFlagStateEnum",
}
},
"required": [
"cbvmda:vesselID",
"cbvmda:vesselFlagState"
],
"additionalProperties": false
},
"minItems": 1
}
},
"patternProperties": {
"^cbvmda:": {}
},
"required":[
"cbvmda:bestBeforeDate",
"cbvmda:storageStateCode",
"cbvmda:vesselCatchInformationList"
],
"additionalProperties": false
}
},
"required": [
"@context",
"type",
"action",
"bizStep",
"readPoint",
"quantityList",
"ilmd"
],
"additionalProperties": true
}
],
"definitions": {
"readPointId":{
"type": "string",
"format": "uri",
"pattern":"^urn:epc:id:sgln:((\\d{6}\\.\\d{6})|(\\d{7}\\.\\d{5})|(\\d{8}\\.\\d{4})|(\\d{9}\\.\\d{3})|(\\d{10}\\.\\d{2})|(\\d{11}\\.\\d{1})|(\\d{12}\\.))\\.(\\%2[125-9A-Fa-f]|\\%3[0-9A-Fa-f]|\\%4[1-9A-Fa-f]|\\%5[0-9AaFf]|\\%6[1-9A-Fa-f]|\\%7[0-9Aa]|[!\\')(*+,.0-9:;=A-Za-z_-]){1,20}$"
},
"quantityElement": {
"type": "object",
"properties": {
"epcClass": {
"$ref": "#/definitions/quantityElementURI"
},
"quantity": {
"$ref": "#/definitions/quantityElementDecimal"
},
"uom": {
"$ref": "#/definitions/quantityUOM"
}
},
"required": [
"epcClass",
"quantity",
"uom"
],
"additionalProperties": false
},
"quantityElementURI": {
"type": "string",
"format": "uri",
"pattern": "^urn:epc:class:lgtin:(([\\d]{6}\\.[\\d]{7})|([\\d]{7}\\.[\\d]{6})|([\\d]{8}\\.[\\d]{5})|([\\d]{9}\\.[\\d]{4})|([\\d]{10}\\.[\\d]{3})|([\\d]{11}\\.[\\d]{2})|([\\d]{12}\\.[\\d]{1}))\\.(\\%2[125-9A-Fa-f]|\\%3[0-9A-Fa-f]|\\%4[1-9A-Fa-f]|\\%5[0-9AaFf]|\\%6[1-9A-Fa-f]|\\%7[0-9Aa]|[!\\')(*+,.0-9:;=A-Za-z_-]){1,20}$"
},
"quantityElementDecimal": {
"type": "number",
"exclusiveMinimum": 0
},
"quantityUOM": {
"type": "string",
"enum": ["KGM", "GRM", "ONZ", "LBR", "MGM", "MC", "STI", "TNE"]
},
"vesselFlagStateEnum": {
"type": "string",
"enum": [
"AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ",
"BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ",
"CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ",
"DE", "DJ", "DK", "DM", "DO", "DZ",
"EC", "EE", "EG", "EH", "ER", "ES", "ET",
"FI", "FJ", "FK", "FM", "FO", "FR",
"GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GT", "GU", "GW", "GY",
"HK", "HM", "HN", "HR", "HT", "HU",
"ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT",
"JE", "JM", "JO", "JP",
"KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ",
"LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY",
"MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ",
"NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ",
"OM",
"PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PT", "PW", "PY",
"QA",
"RE", "RO", "RS", "RU", "RW",
"SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ",
"TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ",
"UA", "UG", "UM", "US", "UY", "UZ",
"VA", "VC", "VE", "VG", "VI", "VN", "VU",
"WF", "WS",
"YE", "YT",
"ZA", "ZM", "ZW"
]
}
}
} |
Dear @Aravinda93 and @albert-verdeny , MANY THANKS! And congratulations: happy to report that my first tests were successful. Great work! One observation: Initially, I tried an EPCIS document (not just the event itself), and the validation failed. So, the interesting question is: do we also want to support our tool to be able to validate EPCIS documents embedding one or several events? If the answer is yes (which I am inclined to advocate), the JSON schema needs to be tweaked a bit so that a document is not invalidated from my POV. FYC, I attached both of my test files. EPCISDocWithFishingEvent_valid.json Kind regards; PS: In case you are wondering about the file extension: GitHub does not seem to allow uploading JSON-LD files. ;-) |
Dear @RalphTro Thanks a lot for the quick testing and feedback. Yes, we have currently taken into consideration only the individual event but we will make the changes to the schema so it can be validated by both the event and the document. |
Dear @RalphTro, The intention of this exercise is to learn about real profiles from users. So at this stage, I feel it is okay to keep the schema validating the individual events. We are yet to discuss the API support we want to provide. Therefore, it will be good to come up with ideas at that time whether we want to support the whole document individual event, or both. My suggestion is to defer schema supporting the EPCIS document (with multiple events) for the time being and keep it limited to event JSON/JSON-LD only. What do you think? |
Dear @dakbhavesh , Happy to discuss/reach consensus on this subject in the group. |
Dear @RalphTro - in principle you are correct that the outcome also has to be used on an EPCISDocument. |
Dear @dakbhavesh and @sboeckelmann , |
Dear @Aravinda93 , dear @albert-verdeny ,
This is an event profile for fish traceability, loosely aligned with existing solutions and guidelines, but deliberately not a 1:1 copy to not overcomplicate things. It contains a couple of elements that, from my POV, our tool should be able to cover, incl. support for 'legacy' EPC URIs, quantities, specific unit codes, ILMD data (even though the latter is likely to be discouraged/deprecated in the upcoming future), hierarchical data structures in extensions, code values, etc. So, I think that developing the corresponding JSON schema for this is a valuable and important exercise.
Event Profile 'Fishing Event'
Set of rules
action
field is populated with the value "ADD".bizStep
field is populated with the value "commissioning".readPoint
is populated with an SGLN EPC URI (e.g. "urn:epc:id:sgln:4012345.00001.0")quantityList
includes exactly one ID.quantityList
is an LGTIN, expressed as an EPC Class URI (e.g. "urn:epc:class:lgtin:4012345.099914.LOT1").quantity
field as part of the QuantityElement must be populated with a positive decimal value.uom
field as part of the QuantityElement must be populated with a UN/CEFACT Rec 20 value for mass (FYC, see https://github.com/gs1/UnitConverterUNECERec20/blob/master/src/UnitConverterUNECERec20.js - type "mass"), e.g. "KGM"ilmd
field.The event contains a proper declaration for "cbvmda" ("urn:epcglobal:cbv:mda").cbvmda:bestBeforeDate
field.cbvmda:bestBeforeDate
field is filled with a proper date value.cbvmda:storageStateCode
field.cbvmda:storageStateCode
field is filled with a corresponding code value according to https://navigator.gs1.org/gdsn/class-details?name=StorageStateCode&version=12 (e.g. "PREVIOUSLY_FROZEN")cbvmda:vesselCatchInformationList
field.cbvmda:vesselCatchInformationList
field, there are two sub-fields:cbvmda:vesselID
andcbvmda:vesselFlagState
.cbvmda:vesselID
field is filled with a string value.cbvmda:vesselFlagState
field is filled with a ISO 3166-1 alpha-2 code value (e.g. "DE").Are all of the above rules understandable/make sense for you?
Very much looking forward to seeing the corresponding JSON schema come alive - many thanks in advance for your support in this!
Kind regards;
Ralph
@dakbhavesh: FYI.
The text was updated successfully, but these errors were encountered: