international-orienteering-federation / datastandard-v.next

IOF Data Standard, working repository for the next version
https://orienteering.sport/iof/it/data-standard-3-0/
0 stars 0 forks source link

Lack of mandatory IDs on elements #4

Open hansonwj opened 1 year ago

hansonwj commented 1 year ago

It would be useful if the spec included a mandatory guid on each element, to help with maintaining data between systems.

nzmangan commented 7 months ago

@hansonwj

The following entities has an ID property attached to them:

Class => Id
ClassCourseAssignment => ClassId
ClassType => Id
Control => Id
Control => PunchingUnitId
Course => Id
Event => Id
Fee => Id
Map => Id
Organisation => Id
Person => Id
PersonCourseAssignment => EntryId
PersonEntry => Id
PersonResult => EntryId
PersonStart => EntryId
Service => Id
ServiceRequest => Id
SimpleCourse => Id
TeamEntry => Id
TeamMemberCourseAssignment => EntryId
TeamMemberResult => EntryId
TeamMemberStart => EntryId
TeamResult => EntryId
TeamStart => EntryId

Given the xsd the following class was generated (for c#):

namespace IOF.XML.V3 {
  [Serializable()]
  [DebuggerStepThrough()]
  [DesignerCategory("code")]
  [XmlType(Namespace = "http://www.orienteering.org/datastandard/3.0")]
  public partial class Id {
    [XmlAttribute("type")]
    public string Type { get; set; }
    [XmlText()]
    public string Value { get; set; }
  }
}

So each id property has both an value property and a type property which should hopefully be enough to allow you to attach the id required to specific entities.

@hansonwj Can you please review the list and see if anything entity is missing the requested id (array)?

In c# you should be able to write an extention method to extract the ID in a clean way...

hansonwj commented 7 months ago

Hi @nzmangan apologies for not being clearer.

My issue is not that the Id elements don't exist in the spec, but that it is not mandatory to provide an Id in most cases. For example, in the Person element [IOF.xsd:458], the minOccurs for the Id element is set at 0

In this scenario, if no Id is provided, you would have to use the Name and other keys to identify the Person. If I remember correctly, I was trying to detect new PersonResult elements in live results, but the originating system did not provide a unique identifier for each PersonResult element, meaning I had to check the Id of the Person within the PersonResult instead. Not the end of the world, but also not ideal. There must be valid reasons why Id elements are not mandatory in the spec, but I think it is worth considering if some of the elements should have mandatory Ids. Please correct me if I have misunderstood the spec.
nzmangan commented 7 months ago

@hansonwj

I am struggling to see what difference it would make the minimum value 1 as it would still be down to each software to implement such feature. I would not be surprised if 0% of the applications out there is not validating the generated xml against the xsd, so even if we do change this I am not sure how many application would enforce such change.

I guess in theory you can argue that you can tell the developers that they do not conform to the standard but I am not sure what leverage you would have. There is plenty of software used that are not dealing well with missing xml element / null values. There is also a possibility that people would just generate random numbers instead which I guess is even less helpful.

I do agree with what you are trying to achieve and yes IOF should probably ensure the specs are showing best practice if IOF values your proposal.