Hi,
I have a requirement to run some standard DQ validation rules in a generic way on any input file based off of a config file per input file. Please can you advise the best way to do that in D3S Analyse?
Example Use Case below:
Inputs:
- InputData.csv - File containing data to run data validation rules on. Example data:
TradeId, LEI, TradeDate, Notional, BuySellFlag
001, ,22-01-2021, 100, B
002,ABC,29-04-2021, , X
- TestCasesForInputData.csv
TestNumber, TestFieldName, TestType, TestTypeValue
TEST_01,Notional,NotNull, n/a
TEST_02,LEI,NotNull, n/a
TEST_03,TradeDate,DateGreaterThan, 28-04-2021
TEST_04,CheckInEnum,“B, S”
Then for each row in the Input file, the code will process the row and apply all relevant tests from file TestCasesForInputData.csv to all relevant fields e.g. set TestFieldNameValue to LEI and run TEST_02 which would set error = Y
If TestType = NotNull
Then
if (TestFieldNameValue.isNull() and TestFieldNameValue.strlen() == 0)
then
error = "Y"
else
error = "N"
If TestType = DateGreaterThan
then
#convert to date first?
if TestFieldNameValue > TestTypeValue
then
error = "Y"
else
error = "N"
If TestType = CheckInEnum
if TestFieldNameValue NOT IN TestTypeValue
then
error = "Y"
else
error = "N"
#for all tests emit the errors
emit TestNumber, TestFieldName, TestType, TestTypeValue, TestFieldNameValue
where error == "Y"
thanks!