gs1 / gs1-syntax-dictionary

GS1 Syntax Dictionary and reference Linters
Apache License 2.0
13 stars 1 forks source link

AIs 254 and 7040 #3

Closed KDean-GS1 closed 2 years ago

KDean-GS1 commented 2 years ago

AIs 254 and 7040 are mutually exclusive. However, this restriction appears only in dlpkey, not in ex.

terryburton commented 2 years ago

Referring to my comment in #2:

Since these data relationship rules were defined after the fact (based on field experience with meaningless data) they are necessarily incomplete with "only situations that have proven to pose difficulties in practice are included." (§4.14.1 para. 1). So it boils down to "best efforts".

I couldn't find a reference to these being mutually exclusive in the AI data relationship tables, but I concur that if AI data containing both (254) and (7040) AIs is invalid and a problem in practise, then we should implement such an exclusivity rule and update the Invalid Pairings table to enforce such a restriction.

KDean-GS1 commented 2 years ago

Also bringing in a comment from #2:

If we end up where we have slightly different rules for AI strings vs. DLURI, then we have a situation where we can create a barcode that has no DLURI representation or vice versa. Add EPC tags into the mix and it can get worse. Again, very low concern because I can't really picture it happening in the real world, but it's the kind of thing that bugs me. :-)

mgh128 commented 2 years ago

According to GS1 Gen Specs v23, in §2.1.14.4 , AI (7040) is used in combination with the GIAI to identify a machine of production in §2.1.14.5, AI (7040) is used in combination with physical location GLN (414) to identify a facility in §2.1.14.6, AI (7040) is used in combination with party GLN (417) to identify an economic operator

I can't see anything in GS1 GenSpecs to suggest that (7040) is mutually exclusive with (254), the GLN extension.

GS1 Digital Link v1.2 URI Syntax states in its §4.9 that

eoid-path = partyGln-comp uic-ext-comp fid-path = gln-comp uic-ext-comp mid-path = giai-comp uic-ext-comp

However, these are considered as alternatives within gs1path and in GS1 Digital Link v1.2 URI Syntax §4.11, we see:

uncompressedGS1webURIPattern = gs1path [queryStringComp]

Currently queryStringComp appears not to include anything related to (254)

I'm not sure that we should go as far as using the GS1 Digital Link URI patterns to infer forbidden associations of AIs that are not explicitly stated in GS1 Gen Specs.

What the GS1 Digital Link URI Syntax grammar does state is a set of patterns that GS1 Digital Link currently supports. It should not introduce any pairings of AIs that are forbidden in GenSpecs, nor support structures in which a mandatory pairing of AIs in GenSpecs is irretrievably broken - though it also does not necessarily attempt to enforce all the mandatory associations (especially when they apply to AIs that only appear within the URI query string)

The background to (7040) is that the regulations could not accept a bare GIAI, (414) or (417) - they needed additional qualifiers - hence the UIC. The regulations had no specific use for the GLN extension (254), so (254) is not involved in the definition of the Facility ID (fid-path above) - but I don't think that means that (7040) and (254) are mutually exclusive. It only means that we have not yet identified a strong case for expressing (254) as a query string parameter rather than exclusively appearing as an optional 'qualifier' of the (414) within the URI path information. The current syntax is intended to discourage the expression of (254) in the URI query string, since it is really only envisaged in combination with (414), to form a compound key.

KDean-GS1 commented 2 years ago

You're right, Terry, there's no explicit rule. The closest prohibition I can find is the last sentence of the first paragraph of section 3.8.17 describing AI 7040, which states:

The UIC shall not be used with GS1 identification keys for open, supply chain systems.

That said, the documentation for 7040 states that it applies to a machine (asset) GIAI (AI 8004), a facility (physical location) GLN (AI 414), or an economic operator (party) GLN (AI 417). AI 254 applies only to AI 414, and the documentation in section 2.4.2 states:

The GLN extension component may be used to identify internal physical locations within a location identified with a GLN, known as sub-locations.

That logically precludes any situation in which the two AIs can appear together. If we want something more explicit, I can submit a work request.

That's not to say that a facility can't have both. It is reasonable to expect that the facility, when sharing data in the context of the Tobacco Products Directive, does so with a combination of AIs 414 and 7040. However, when sharing inventory or traceability data, it would do so with a combination of AIs 414 and 254.

mgh128 commented 2 years ago

The background to the UIC is that the legislation did not fully accept or recognize existing GS1 identifiers without further qualification, so the UIC in combination with (414) was deemed to correspond to a facility identifier, while a UIC (417) was deemed to correspond to an economic operator ID, while a UIC + GIAI corresponded to a machine identifier.

An economic operator, identified within GS1 by a (417) party GLN, might control multiple facilities, each identified within GS1 by a (414) physical location GLN, each containing multiple production machines, identified within GS1 by GIAIs.

We need to be very careful when making inferences about further mandatory or forbidden relationships between AIs. Of course we might compile a tentative list of potential additional relationships but I would expect that the ID SMG would be the appropriate place for sanity-checking of these.