FAIRmat-NFDI / data-modeling

3 stars 1 forks source link

dataconverter clarify handling for cases where a required group has first-order children which are all optional but group is required, list of silent and explicit rules, as a summary in the tech paper would be extremely useful #75

Open sherjeelshabih opened 1 year ago

sherjeelshabih commented 1 year ago

MarkusK, em_lab in ENTRY[entry]/measurement/NXEVENT_DATA_EM[event_data_em]/

sherjeelshabih commented 1 year ago

Can you leave an example here? @mkuehbach

sanbrock commented 1 year ago

how to describe conditional requirements. Something is required IF some other condition is met in the dataset.

sherjeelshabih commented 1 year ago

The validation in the data converter could be summarized as below:

  1. Check if all required fields described in the AppDef exist a. Loops over all paths in the template and checks whether they exist in the data instance by converting both to NXDL paths and then matching them. b. If given path in template is just a group, not a field or attrib, the converter checks if the group exists i. To check if a group exists, the converter checks whether there is a child of the given group in the data instance.

  2. Paths that have been added but are not part of the template and may be still available in the NXDL space are then checked. a. Convert all paths to NXDL and check with nexus.py if an NXDL entry exists in the NeXus space. b. If found, the data instance of the found path is tagged correctly in the template for its optionality.

  3. The converter then checks for entries in the data instance that have optional parents. It means that if you have an optional parent defined in the AppDef, this part of the code will check whether this entry should exist or more is needed. a. Loops over all paths in data instance and checks whether they are a child of an optional parent. b. If they are a child of an optional parent, the converter checks if all required children of the given optional group are also set. This is the only thing that matters for optional groups. All required fields of an optional group should exist.