hledat

Začněte vyhledáváním výše

  1. Domů
  2. Články
  3. Don’t Fix Bad Data, Do This Instead

Don’t Fix Bad Data, Do This Instead

Martina Ivaničová
“Prefer to watch rather than read? See the talk from EuroPython 2024 with the same topic here!” 

Peo­ple don’t know what they mean when they talk about data quality.

Sto­ry From The Trench­es 

A few years ago, our data plat­form team aimed to pin­point the pri­ma­ry con­cerns of our data users. We con­duct­ed a sur­vey among indi­vid­u­als inter­act­ing with our data plat­form, and unsur­pris­ing­ly, the main con­cern high­light­ed was data quality.

The ini­tial response, char­ac­ter­is­tic of our engi­neer­ing mind­set, was to devel­op data qual­i­ty tool­ing. We intro­duced an inter­nal tool named Con­tes­sa. Despite being some­what cum­ber­some and neces­si­tat­ing sig­nif­i­cant man­u­al con­fig­u­ra­tion, Con­tes­sa facil­i­tat­ed checks for stan­dard dimen­sions of data qual­i­ty, encom­pass­ing con­sis­ten­cy, time­li­ness, valid­i­ty, unique­ness, accu­ra­cy and com­plete­ness. After run­ning the tool for a cou­ple of months with hun­dreds of data qual­i­ty checks we con­clud­ed that: 

  • Data qual­i­ty checks occa­sion­al­ly assist­ed data users in dis­cov­er­ing, in a short­er time­frame, that the data was com­pro­mised and could not be relied upon. 

  • Despite the fre­quent exe­cu­tion of data qual­i­ty checks, there was no notice­able improve­ment in the sub­jec­tive per­cep­tion of data quality. 

  • For a sig­nif­i­cant por­tion of issues, par­tic­u­lar­ly those iden­ti­fied through auto­mat­ed data qual­i­ty checks such as con­sis­ten­cy or valid­i­ty, no cor­rec­tive actions were ever taken. 

Sur­vey and objec­tive mea­sure­ment are use­ful tools, but noth­ing can replace a dis­cus­sion over cof­fee and cake, as Jane Car­ruthers writes in her book, The Chief Data Officer’s Play­book”. Indeed, I rec­om­mend this to any­body, as one-on-one con­ver­sa­tions helped us dis­cov­er anoth­er impor­tant angle of the sit­u­a­tion. Some of these con­ver­sa­tions unfold­ed as follows: 

Hey, you say, that data qual­i­ty is poor, what do you mean by that?” 

#1 Pric­ing busi­ness analyst:

We are work­ing on set­ting up price for the ancil­lary prod­uct X. In the dataset we use, we are miss­ing data on what was the actu­al rev­enue from the prod­uct X per each order. We have this dataset , but it con­tains only expect­ed val­ue of the rev­enue from X at time of the pur­chase. We can see also the actu­al rev­enue per prod­uct, but not at the order gran­u­lar­i­ty.” 

#2 Prod­uct analyst:

There are sev­er­al touch­points in our customer’s jour­ney where we redi­rect our cus­tomers to our partner’s web­site — in case they are inter­est­ed in pur­chas­ing 3rd par­ty prod­uct Y. We reg­u­lar­ly down­load the trans­ac­tion data from our part­ner and we analyse it to opti­mise this offer­ing. In 30% of cas­es we are miss­ing infor­ma­tion on which touch­point our cus­tomer left to the partner’s site.”

# 3 Ana­lyt­ics engineer:

We pre­pared a data set con­tain­ing list of deep links — infor­ma­tion on what offers our cus­tomers clicked on. How­ev­er for a cer­tain group of deep links, the date of the offer is not in the for­mat we expect it to be. We had to fil­ter out these records and we do not take them into account.” 

There is a com­mon denom­i­na­tor in these cas­es: our data qual­i­ty tools could not resolve any of these issues; the solu­tion lay elsewhere. 

In case #1, the solu­tion involved extend­ing the actu­al ancil­lary rev­enue data mod­el to the required granularity. 

For case #2, fron­tend devel­op­ers con­duct­ed a review of all the steps where redi­rec­tion could occur and added a query para­me­ter to the redi­rec­tion URL

In case #3, the issue arose because the API call, respon­si­ble for fetch­ing the val­i­dat­ed depar­ture date before stor­ing the data, was tim­ing out in some instances. Imple­ment­ing retry log­ic on the API call by the engi­neer­ing team resolved the problem. 

The main prob­lem was either the data not get­ting logged or not being put togeth­er, con­nect­ed, or under­stood as we thought it would. 

In his 1861 nov­el Great Expec­ta­tions,” Charles Dick­ens tells the sto­ry of Pip, an orphan with great expec­ta­tions for love, wealth, and soci­etal sta­tus, who encoun­ters numer­ous dis­il­lu­sion­ments. A renowned data qual­i­ty frame­work has been named Great Expec­ta­tions,” a fit­ting title indeed. 

This metaphor apt­ly describes the chal­lenges faced by data users, includ­ing data sci­en­tists, ana­lysts, data engi­neers, prod­uct man­agers, UX researchers, and busi­ness deci­sion-mak­ers. Our expec­ta­tions of data are high, and this often leads to frus­tra­tion when real­i­ty does not meet these expectations. 

The under­ly­ing issue in cas­es sim­i­lar to those men­tioned above is that, even though data con­sumers expect cer­tain out­comes, there are no guar­an­tees that these expec­ta­tions will be met. For instance, not every record may include the redi­rect para­me­ter, or all records might not have the date filled in. Fur­ther­more, the peo­ple capa­ble of resolv­ing these issues are often unaware of them. 

  1. When the expec­ta­tions of data con­sumers dif­fer from real­i­ty, it man­i­fests as issues with data quality. 

  2. The expec­ta­tions of data con­sumers are often implic­it and not articulated. 

  3. Data con­sumers can apply data cleans­ing tech­niques, but in gen­er­al they have lim­it­ed means to trans­form poor-qual­i­ty data into high-qual­i­ty data. 

  4. Data qual­i­ty checks serve as a safe­ty net, aid­ing in the ear­ly iden­ti­fi­ca­tion of prob­lems, but they do not pre­vent issues from occur­ring in the first place. 

Fast For­ward 

We did not give up, and as we moved for­ward we under­stood that even seem­ing­ly sim­ple prob­lems require com­plex solu­tions. What led to improve­ments was com­bi­na­tion of tech­ni­cal (hard) and cul­tur­al (soft) measures. 

The essen­tial require­ment for any of these mea­sures was to estab­lish a cul­ture of data own­er­ship. This involves set­ting up a sys­tem where every enti­ty gen­er­at­ing data is linked to a human orga­ni­za­tion­al unit, such as a team that takes account­abil­i­ty. This unit should be capa­ble of explic­it­ly com­mit­ting to or reject­ing expec­ta­tions relat­ed to the data. This com­mit­ment, is tech­ni­cal­ly rep­re­sent­ed as data contract.

Ensuring data quality relies on two main pillars, soft measures and hard measures which are equally important.

Hard mea­sures 

Data qual­i­ty checks 

Data qual­i­ty checks iden­ti­fy data issues post hoc. They can­not pre­vent data qual­i­ty issues from hap­pen­ing, they can, espe­cial­ly when com­bined with lin­eage and alert­ing solu­tions or even bet­ter with cir­cuit break­ers, short­en the detec­tion time and increase the chances of mit­i­gat­ing the harm caused by bro­ken data”. The mar­ket is flour­ish­ing with tools like Soda​.io, Monte Car­lo, Great Expec­ta­tions, Infor­mat­i­ca, Tal­end …. We replaced our in-house made Con­tes­sa with one from the market. 

Data inte­gra­tion tests 

We’ve recent­ly pio­neered data inte­gra­tion tests, which dif­fer sig­nif­i­cant­ly from stan­dard data qual­i­ty checks in that they are a proac­tive measure. 

Essen­tial­ly, these tests are designed to iden­ti­fy poten­tial data qual­i­ty issues before they occur. In our set­up, data from the order pro­cess­ing pro­duc­tion sys­tem is streamed via Google Pub­Sub ser­vice, which is then uti­lized for trad­ing per­for­mance analytics. 

When­ev­er a git merge request is made that alters the pro­duc­tion appli­ca­tion code, an inte­gra­tion test is auto­mat­i­cal­ly ini­ti­at­ed. This ensures the data con­tract remains intact. These tests go beyond mere­ly ver­i­fy­ing data schema; they also check the con­tent of the data. 

To illus­trate, when a new order is placed with a spe­cif­ic price and oth­er details, we expect a cor­re­spond­ing event to be accu­rate­ly pub­lished with the antic­i­pat­ed val­ues. The inte­gra­tion test con­firms this using a sam­ple data, there­by safe­guard­ing the integri­ty and con­sis­ten­cy of our data before it impacts the pro­duc­tion system. 

Integration tests validate even before the release that the data contract will not be broken. 

Soft mea­sures 

Data Col­lab­o­ra­tion process 

In a nut­shell, this mea­sure ensures coop­er­a­tion among data ana­lysts, prod­uct man­agers, and engi­neers. Prac­ti­cal­ly, this means: 

  • Prod­uct man­agers involve ana­lyt­ics from the out­set of prod­uct devel­op­ment and fea­ture spec­i­fi­ca­tion. They do data informed decisions. 

  • The domain ana­lyt­ics engi­neers and ana­lysts assess whether addi­tion­al data points need to be logged and how this impacts report­ing, iden­ti­fy the need for new data pub­li­ca­tion and sig­nal any poten­tial break­ing changes. They stay in sync with domain prod­uct man­agers and domain engi­neers to famil­iar­ize them­selves with the back­log and roadmap, and par­tic­i­pate in defin­ing and mod­i­fy­ing events, datasets, and attributes. 

  • Domain engi­neers under­stand the impact of tech­ni­cal changes on data struc­ture and log­ic, they are respon­si­ble for keep­ing the data con­tract intact by defin­ing data qual­i­ty and inte­gra­tion tests to val­i­date whether changes in busi­ness log­ic are reflect­ed in ana­lyt­i­cal plane. They fix the prob­lem at source when the data qual­i­ty checks reveal the appli­ca­tion bug. 

Data collaboration process among domain data players

Prod­uct think­ing 

There is a shift in mind­set we applied, and it bears cer­tain marks of prod­uct thinking. 

  • Not all the data are equal­ly impor­tant, that’s why we cat­e­gorised them into sev­er­al tiers in the same way as man­u­fac­tures cat­e­gorise prod­ucts in prod­uct tiers. For instance finan­cial report­ing data are in the top tier. On the oth­er hand the data such as devel­op­ers pro­duc­tiv­i­ty, or can­di­date inter­view met­rics can be 5% off, and world will not fall apart. 

  • Clear­ly com­mu­ni­cate the dif­fer­ences in fea­tures and qual­i­ty among prod­uct tiers to man­age data users expec­ta­tions effec­tive­ly. We sought to bring trans­paren­cy about the inten­tion­al trade-offs to build trust with data con­sumers. 
     

  • It is impor­tant to make edu­cat­ed deci­sion of the invest­ment vs. gain of every new fea­ture and clear­ly com­mu­ni­cate the out­come. For instance, it might be pos­si­ble to increase the accu­ra­cy of our expect­ed net rev­enue mod­el by 5% , but it will incure addi­tion­al costs of mod­el devel­op­ment and com­pute costs by 7%. It is a prod­uct decission. 

  • Anoth­er aspect is that it often occurs that what data users per­ceive as a data qual­i­ty issue is viewed from the ana­lyt­ics engineer’s per­spec­tive as either a new fea­ture request or a dif­fer­ent data prod­uct. Whether to imple­ment it is once again a prod­uct decision. 

Sum­ma­ry 

No, we real­ly can’t fix data qual­i­ty ex post. What we do instead is: 

  • Estab­lish a process that enhances our abil­i­ty to pre­vent data qual­i­ty issues and detect them ear­li­er if they do occur. 

  • Pro­mote account­abil­i­ty in the hands of data own­ers. If you’re own­er of the data, you’re also respon­si­ble for its qual­i­ty. This involves turn­ing implic­it expec­ta­tions about data qual­i­ty into explic­it standards. 

  • Apply prod­uct think­ing to data. Be aware of invest­ment vs. gain. 

Mohlo by vás také zajímat

Don’t Fix Bad Data, Do This Instead