URX UAC Validator presentation - moduleus/urx GitHub Wiki


title: URX/UAC Validator presentation

URX/UAC Validator presentation

Validator purpose

The validator aims to detect errors in the urx/uac datasets to generate errors or to fix the detected errors.

The validator parses manually the urx/uac classes and performs generic checks on the architecture and calls generic callbacks to react dynamically for each situation.

This mode of operation enables both to report error messages or to fix the dataset while analysing it.

How Validator works

The ValidatorBase is the Base class that implements the check interface in URX/UAC. ValidatorBase implements a static parsing of the structures. An improvement will probably be scheduled in order to parse the structures dynamicaly. TheValidatorReportBase is the class that implements the callbacks used by the ValidatorBase class whose it inherits. Fynaly these classes are templated, so one instance is given for URX and UAC needs: ValidatorReport.


///////////////////////
///////// URX /////////
///////////////////////

namespace urx{

template <typename Derived, typename Dataset>
class ValidatorBase {}; // Implements the check API

/// Return a list of error messages detected in the checked class
/// If the output vector is empty then all is ok
template <template <typename, typename...> class ValidatorBaseT, typename Dataset>
class ValidatorReportBase
    : public ValidatorBaseT<ValidatorReportBase<ValidatorBaseT, Dataset>, Dataset> {
  // Implements all functions needed by the base class
  // such as valueNotPositive to fill the _output when the tested number is negative 
 private:
  std::vector<std::string> _output;
};

using ValidatorReport = urx::utils::ValidatorReportBase<ValidatorBase, Dataset>;
}

///////////////////////
///////// UAC /////////
///////////////////////

namespace uac{

/// Use the basic URX implementation and add other checks for UAC structures
template <typename Derived, typename Dataset>
class ValidatorBase : public urx::utils::ValidatorBase<Derived, Dataset> {};

using ValidatorReport = urx::utils::ValidatorReportBase<ValidatorBase, Dataset>;
}

List of realized checks

URX

Acquisition

  • Probe pointers are not null
  • Excitation pointers are not null
  • Group pointers are not null
  • excitations vector is not empty
  • groups vector is not empty
  • groups_data vector is not empty
  • local_time is Iso 8601
  • country_code is Iso 3166
  • timestamp is set
  • timestamp is positive

Excitation

  • sampling_frequency is set
  • sampling_frequency is positive
  • transmit_frequency is set
  • transmit_frequency is positive
  • waveform vector is not empty

Group

  • sequence vector is not empty
  • sound_speed is set
  • sound_speed is positive
  • data_type is defined
  • sampling_type is defined

GroupData

  • Group pointer exists in the Acquisition
  • group_timestamp is set
  • sequence_timestamps is not empty
  • sequence_timestamps elements are set
  • event_timestamps is not empty
  • event_timestamps elements vector are not empty
  • event_timestamps elements vector elements are not empty
  • event_timestamps elements vector elements are set

ImpulseResponse

  • sampling_frequency is set
  • sampling_frequency is positive
  • time_offset is set
  • time_offset is positive
  • data vector is not empty

Probe

  • impulse_responses vector is not empty
  • impulse_responses pointers are not null
  • element_geometries vector is not empty
  • element_geometries pointers are not null
  • elements vector is not empty
  • elements references ElementGeometry pointer in the probe
  • elements references ImpulseResponse pointer in the probe

ElementGeometry

  • perimeter size is greater than 2

ReceiveSetup

  • Probe pointer exists in the Acquisition
  • modulation_frequency is set
  • modulation_frequency is positive
  • sampling_frequency is set
  • sampling_frequency is positive
  • tgc_sampling_frequency is set if tgc_profile is not empty
  • tgc_sampling_frequency is positive if tgc_profile is not empty
  • time_offset is set
  • time_offset is positive
  • active_elements elements id are lesser than probe->elements.size()

TransmitSetup

  • Probe pointer exists in the Acquisition
  • Excitation pointer exists in the Acquisition
  • time_offset is set
  • time_offset is positive
  • delays vector, active_elements vector and excitations vector have the same size
  • active_elements elements id are lesser than probe->elements.size()

Wave

  • time_zero is set
  • parameters size matches the type

UAC

Acquisition

  • SuperGroup pointers are not null
  • excitations vector is not empty
  • initial_group Group pointer exists in the Acquisition
  • time_offset is set
  • time_offset is positive

DestinationLink

  • destination Group pointer exists in the Acquisition

Event

  • time_offset is set
  • time_offset is positive

IGroup

  • time_offset is set
  • time_offset is positive
  • period is set
  • period is positive

SuperGroup

  • initial_group is not null
  • initial_group Group pointer exists in the Acquisition

TriggerIn

  • edge is not UNDEFINED

TriggerOut

  • polarity is not UNDEFINED
  • time_offset is set
  • time_offset is positive
  • pulse_duration is set
  • pulse_duration is positive

Where is it used

Writer

The ValidatorReport is used by default in the utils::writer::saveToFile function to prevent the save of an unusable dataset.

This behavior can be disabled by setting _check_data to false in the WriterOptions.

User needs

The user can also implements its own class that inherits from ValidatorBase in order to specify the wanted behavior for the callbacks. Callbacks can be used to fix the detected errors.