data_grid = {
'des_lay_arquivo': u'LINHA'
, 'flg_map_clna_ano': u'S'
, 'vlr_map_clna_ano': 2019
, 'lst_head': [u'LST_VLR_ANO_CTR', u'LST_VLR_IDADE', u'LST_DES_DT_NSCMNTO', u'LST_DES_CPF_CNPJ', u'LST_VLR_PREM_EMTD', u'LST_VLR_CRRTGM', u'LST_VLR_CPTL_SGD']
, 'raw_data':
{
u'LST_DES_DT_NSCMNTO': ['12/20/2013', '07/05/2010', '09/12/2011', '5/13/2010', '7/20/2015', '11/08/2010', '3/28/2011', '10/14/2013', '8/27/2016']
, 'ID_ROW': ['2', '3', '4', '5', '6', '7', '8', '9', '10']
, u'LST_DES_CPF_CNPJ': ['', '3.016.445-04', '478j051030', '892590000000000009952', '571902596', '412882792', '932776868', '919133651', '579814469']
, u'LST_VLR_CPTL_SGD': ['52914.72', '119488', '74a823.48', '798727.44', '415865.88', '1202.88', '', '68078.88', '649283.04']
, u'LST_VLR_CRRTGM': ['87999.84', '211152.48', '151892.62', '1055863.76', '734892.48', '2720.16', '295966.72', '33223.68', '316861.44']
, u'LST_VLR_IDADE': ['27', '72', '89', '45', '42', '83', '37', '49', '55']
, u'LST_VLR_ANO_CTR': ['', '220', '2021', '1000', '2023', '2024', '2025', '2026', '2027']
, u'LST_VLR_PREM_EMTD': ['140914.56', '330640.86', '226716.1', '1854591.2', '1150758.36', '3923.04', '902434.24', '101302.56', '966144.48']
}
}
receiving this dictionary we will validate the information that is coming from it
The idea of the code is to receive the dictionary, validate the fields according to the rules in the code and separate into two dictionaries what is in error and what is without error.
the dictionary with error will have the same fields but we add an error comment field for each column