Transcript#

This transcript was generated automatically and may contain errors.

Hello everyone, and welcome to PyData Global 2025. I'm very excited for you to be joining us today for communicating data quality with Richard. He is joining us from Toronto, so welcome Richard, thanks for being here. If you're attending today, we encourage you to use the chat feature off to the right-hand side, and also there's a Q&A spot, so engage with one another, engage with the speaker, ask some questions. We'll have about five minutes at the end to take any questions you have, but I don't want to take any time away from you, so the floor is all yours. Thanks for being here. Thank you. I'm going to share my screen now.

Great. Start presentation, here we go. So today I'm talking about communicating data quality, making the invisible visible, and fun with pointblank. So the invisible visible part is data errors, trying to sort of unearth those and understand where they are. But anyways, what's pointblank? It's a Python package for validation, profiling, and beautiful data quality reporting. Sometimes I'll say DQ in this presentation, that just means data quality.

The opportunity in data quality

So we really have an opportunity here, an opportunity in data quality. It's foundational to every data-driven decision in your organization that you know. And how do we know this? Well, when the processes work well, teams tend to work a bit faster, there's less time spent firefighting data issues, there's better decisions made due to the trust in the team's metrics and reports, and the confidence in the data system, since quality is upfront, visible, and measurable.

However, this is a sad story, many teams tend to struggle with communicating the data quality problems. So the communication piece is the bit that needs a bit of work.

So you might have great validation logic, that we have all the tools, but the key piece is if stakeholders can't understand what failed and why, nothing really gets fixed. So I have a schematic I want to develop here of the data quality communication gap. So it starts off pretty rosy. Detection, we got that locked in. We got sophisticated validation logic. Many tools are available, many libraries for data validation are around in Python. Where it sort of breaks down, again, is communication. This link is somewhat severed, because, you know, if we're too technical with the outputs, they lose the context of what's, you know, what's wrong. And there's always going to be like an audience mismatch with stakeholders, it's developers speaking with business people, sometimes not, but usually there's a bit of an audience mismatch, they only speak the same language. And because communication is stymied, action is blocked. So in the end, stakeholders can't really act, and unfortunately, issues will just persist now.

So finding data issues, it's only half the battle. You can have the most sophisticated validation logic in the world, but if you can't explain what failed and why, nothing really gets fixed.

So finding data issues, it's only half the battle. You can have the most sophisticated validation logic in the world, but if you can't explain what failed and why, nothing really gets fixed, as I said before. So the challenge is communicating data quality issues. And we have to do this effectively to pipeline owners and to also less technical stakeholders and to leadership. So what do we need? We need outputs that are clear and actionable, to the different audiences. So clear as in what's wrong, and actionable as in where is it wrong.

Introducing pointblank

So enter pointblank. This is a package I work on at Posit, and it's a Python package designed to make the entire data quality lifecycle easier, clearer, and much more collaborative. The library addresses all the barriers we just discussed with its API design, and it provides stakeholder-ready outputs. Every design decision in the package prioritizes clarity and usability, and it makes the data quality work accessible to more people in your org.

Okay, so I'm just showing you a bunch of the outputs you can get from pointblank. We get validation reports. We can also have data set previews and profiles of different parts of your data, just to get to grips with the data set. So we have an emphasis on beautiful reporting, and we use the great tables library, another library developed at Posit, to make these tables for your reporting. So let's get into the API part of this. Let's learn how to use pointblank.

The validate API

So everything starts with the validate class. It's how you define validation plans. You create a validation object with your data, and then you chain validation methods together to build your data quality checks, sort of like step by step. Let me show you how this looks like.

So pb Validate, that's the class I'm talking about, and you feed it a target data table. It could be all sorts of tables. It could be polars, data frames, pandas, DuckDB, you name it. It could be all sorts of things. Then the next few steps are the validation steps right here. We also check. We're checking that rows are complete. There's no none or null values within the rows. We're checking for that. And lastly, we have a check here, which is a table structure check. Call exists, and we're checking that the call API, it's pretty simple. As you can see here, we just have this core pattern. Yeah, it's pretty powerful, as the validation methods share some really powerful arguments that can do lots of things. For instance, we have thresholds for setting tolerances for failures, actions for executing code when failure thresholds are exceeded. The pre will actually modify the target table just for its depth. So if you want to add an extra column and validate that, you can do it with pre. And segments allows you to split to perform validation on subsets of your column data. So you can split across or split down, and we run the same validation on bits of your column.

So in terms of reporting, you just have to print the object itself, and you get the validation report, as we see down here. Let's see it a little bit more large. And this is what it looks like. It's just a few columns. It's meant to be kind of simple, not too much information, but not too little. So let's go over how this table is laid out. So here on the left, we have a number of columns relating to validation rules. On the right is everything related to validation results. And then each of the rows is a validation step. So validation step is each test, each step is a test of the table, and it's focused on a certain aspect of the table. Okay. And validation rules typically have the key constraints. The results have, you know, the results, breaking down test units, and a few more things.

So the intent, really, with this report is to provide the key information in one place, and to have it really interpretable by data stakeholders. So you notice here, there's a nice little affordance on the last column. There's a CSV button. And that's because there are some row failures in this one step. So what a data college stakeholder could do is click this to download a CSV of the filling rows for that step. It's really nice, because the person doesn't even have to know how to use pointblank. They could just be given this report. And they already have a solution that they can follow, or they can dig into the rows and try to figure out a solution.

Test units and failure thresholds

So the other big concepts for reporting in pointblank are test units and failure thresholds. So let's go over test units next. Each validation step will execute a type of validation test against the target table. And so a call val's LT validation step tests that each value in a column is less than a specified number. So the key finding here is, and this is shown in the report, is each step has a number of test units that pass or fail. So you have a total number of units. That's basically each cell in the column. And then we have a passing amount, and then a failing amount. We have the absolute number of test units passing. And then below is always a fraction of thereof. And so the test units are dependent on the test being run. Some methods will test every value in a particular column. So each value will be a test unit. But others will only have a single test unit, because they're just testing the overall, an overall thing. Not individual values, but if an overall test passes or fails.

So test units, they're basically foundational to pointblank's threshold system. So if you look here, you see units pass and fail, have a number of numbers. But we also have a number of columns over here, W, E, and C. And these are thresholds. They represent thresholds that let you define acceptable levels of data quality. So let's get into that.

Different severity signals, which are these right here, can occur when failure conditions are met. So if you see here, we can map this to what we set for our thresholds. So this is basically the fraction of failing test units that will trigger this sort of like signal, either warning, error, or critical. So we see here in this first row, we have a failure rate of 0.15, which is 15%, which is greater than 0.1 threshold for warning. So that gets filled in with a gray. The next one has no failures. So there's no circles filled in, no signals for failure. The third and the fourth one, they go a little bit above the critical threshold of 30%. So these get all of the signals filled in. So this is just a way to see at a glance that we have failures above and beyond what we accept as data quality.

Live demo in Positron

So now I'm going to skip over to my favorite IDE, which is Positron at the moment. And I'm going to go over some demos. And I'm going to show you pointblank in action.

So the first thing I'm going to do is load the NYC flights data set as a Polars data frame. We have a function in pointblank called load data set. So we can just like get a data set out and experiment with it. So we have NYC flights. And we get a new data set. It's really good to at least look at the first few rows of the data set to see that it's okay. So let's actually run this cell. And we get a preview right here. And we see right here, it's basically the data set, the first five rows and last five rows. So it's kind of nice to have. And the cool thing about this preview function is that any type of table will work with it. So it could be like a WDB table, it could be a database, it'll just work just fine.

Now going to the second one right here, this function call summary table, we can get more detailed look at the table itself. What we're getting is like summary information, including like null counts, unique values, a number of values, which are get the mean as well and other stats measures across here. So it's kind of cool. We can look up and down and get a sense for what's in here and look at outliers in the table itself. Now the next thing we can do is get a missing value summary. So running missing values table will give us this. And it really allows us to get a picture of like what's missing in our table. We see some columns have missing values and others don't, which are the blue columns here. So this is really cool for seeing where missing values, whether they exist and where they might live inside your table.

Okay. Let's now create a validation plan for the NYC Flights data set. The plan will include several assertions to check data quality. So here's what we want to validate. We want to see that, you know, all columns ending with the X time don't have null values. Same goes for the carrier column. And we also want to check whether the values in the distance column are all greater than zero. Since this data set is about flights originating from the New York area, we want to check that the origin column has values in this set. You want to see that all rows in the table are distinct or unique.

So we have our validation plan right here. We have our data set right here. This is just some metadata for the report that will just be displayed. And we have thresholds here. So in this argument, we're saying one warning, one test unit is a warning. 1,000 results in error. And 10% of failing test units will result in a critical signal being shown. And here they are right here. The cool thing to deal with all columns ending with time is using a selector. So we have pb ends with and using the stream time. Okay. So that's it. I'm going to run this whole thing. And it's fine. And now we have the report on the right here. So you can see some things failed and they triggered, you know, like some error states. Some things did not. But we get a breakdown of what failed and what did not. In some cases, we have, you know, thousands of failed test units. And in one case, we have only four failed test units, which is pretty interesting.

Let's actually investigate this one row. It's seen that the arrival delay should be less than 1,000 minutes. Okay. That's really strange that it should be that large, but there's some errors there. So let's take a look at that. We can use get data extracts, a method on the validation, the object. And we can zero in on the seventh step. It's the seventh right here. Okay. So I'm going to run that. And actually, I'm going to take that data extract, which is really a data frame, and pass it over to preview.

And this is kind of cool. This is the four rows. And these are the indices that the rows are from. And we see here that the arrival delay is very large for these ones. So we're able to, you know, find some interesting possibly a data error in our large dataset here. And the above is great, if you just want to pass a data frame to somebody. What we can also do is use the get step report method. It will do much the same as here, except it will provide it in a report style. So it will say what the assertion is, what you're meant to what the column should have. You're showing also, like, you know, how many rows have failed. And it actually highlights them right here, if you move across. So arrival delay is way above 1,000 in these cases.

Briefs for communication

So pretty cool. Another thing you can do, and this is part of the communication piece, is you can use something called briefs. And what they do is they provide concise summaries of each validation step's outcome. And they can be automatically generated, which is kind of cool. Here's an example. All we got to do is take the previous example. And all that here was brief equals true in the original validate call. And this will auto generate text, basically. I'm going to run that. And we see right now,

the only change from the first table you saw is that there's some text here explaining, certainly in plain English, what we expect, you know, like, what our expectation is for each of these validation steps. So this is really kind of cool. It's more context than just seeing the, you know, the name of the validation step. We actually got a bit of descriptive text.

Sundering data

Okay. And now another bit of functionality in the package is sundering. We have this method called getSunderedData. What that allows you to do is to, based on the validation itself, split the actual table into a pass piece and into a fail piece. Okay. So basically, any validations that find errors, they'll be sort of moved into, like, the fail piece. And any rows that had no errors will be the passing piece. Let me show you the passing piece right here.

Okay. Well, we got the data right here. We pass it into preview. And essentially, these are the, or at least a preview of the failing rows, right? And it seems to be quite a few of them because a lot of the rows went through some failures. So it contains all of the rows that met all the validation criteria set in our plan. Okay. So that's getSunderedData, a really good one. And that is actually it for my demo. I'm going to go back to my slides right now.

Workflow flexibility

And there's many more things in the package in terms of workflow flexibility. Like, for instance, if you want to get off the ground running, you can use an LLM-powered draft validation class right here. You provide the data set and the model you want to use. You just have to have a key available. And what will happen is it will return a full validation plan that covers a lot. Basically, it's more than you can write, like, really quickly. And it's actually a great starting point, and you can adapt it to your needs. And the cool thing is the plan generally And the cool thing is the plan generates a very large validation report, but it all passes. So it gives you, like, essentially something that you can sort of tweak. You can omit some of the steps. But it's a great sort of starting point.

One more thing you can do is you can define validation plans as YAML. And this makes validation plans version controllable and much more easier to review. So here's, like, a text version, basically YAML, defining a validation plan. Instead of using the Python API, you can just create a text file with YAML. And then you can actually run it from the Python API using YAML interrogate, point it towards the file, and you will get a report based on that YAML. And it can make it easier to read. People don't really have to know about the Python API. It's just sometimes a bit easier. And, again, more version controllable.

Automated responses and pipeline actions

So data quality checks, they really ought to be part of your deployment pipeline, just like unit tests and linting. But how do you automatically respond when validations fail? Well, here's a little demo right here. You can create functions right here, like show alert or block deployment. So the first one will print a custom message about a failure. And the second one will exit the process, the pipeline process, after printing a message.

Okay. We follow that up in an actions class right here. So assign warning to just a string. That'll just print it. Error will use a show alert function. And then critical will block the deployment. So now we have actions. We put that into our validate constructor, and we have to have thresholds. So if any of these are entered, these threshold states, these actions will fire. Okay. So, yeah. So the combination of thresholds and actions will guard a pipeline against data quality issues in this way. So it's a good pattern to have.

So using thresholds and actions in a validate class is good for smart automation. And we can recommend a few things for the warning threshold. We can block the DQ issue and just continue. For an error state, we might want to send alerts, but still continue the pipeline. And for the critical threshold, we probably want to log the issue and block the deployment immediately. So this approach will, if designed well, will prevent false alarms while ensuring that critical issues don't slip through.

Design goals for collaboration

So when we design pointblank, we want to design it for collaboration. We know that small design choices will make a big difference in adoption. So every choice by me in the API, every open format, and so on, is an opportunity to make data quality work a bit more collaboratively. So the major design goals were to have, of course, those easy to understand summaries, so people really get the gist quickly. You can just show them the report, and there's not too much explaining to do. We want to have actionable extracts that show exactly what's wrong. So you can just pass them off to a data engineer, for instance. We definitely want to have ready to share reports, so they're in a shareable state. You can pass them on through email, through Slack, through a core document. Lots of ways you can share it, because it's just HTML.

And we also want to have multi-language support. pointblank actually has the ability to generate those reports that you saw in over 40 different languages. You just got to change the lang parameter. And then also a big thing was support for many data sources, like Polars, Pandas, DuckDB, Parquet, CSV, anything that is supported by IBIS or by normals. And again, what's this all for? Basically, when DEQ outputs are accessible, more people will engage with them. And as its accessibility leads to participation, we get more ownership of data quality in an organization.

Takeaways

Okay, just to conclude, I'm going to give you some takeaway points. Data quality is what I think is a communication problem, not just a technical one. And solving the technical side is only valuable when you can effectively communicate those issues to stakeholders. pointblank, the package makes validation, profiling, and reporting accessible. And it's not just about technical users, it's about making the data quality work inclusive across the org. Beautiful outputs lead to better collaboration and faster resolution. When these reports are clear and they're actionable, people actually want to read them and possibly take action. That's the hope.

Data quality is what I think is a communication problem, not just a technical one. And solving the technical side is only valuable when you can effectively communicate those issues to stakeholders.

Finally, flexible workflows. So we have, I showed you the Python API, I showed you some YAML, you can use LLMs, there's actually more stuff in the package involving LLMs, I just didn't show. We also have a CLI, can't show that because of time restrictions, but there's lots of ways to work with pointblank. And it kind of meets you where you are. So you shouldn't have to change your entire workflow just to adopt better DQ practices. And finally, we realize that small design choices make the work less annoying, more rewarding, and some thoughtful UX can transform data quality from what could be a dreaded task into a valued practice. And that's really it. That's my presentation. You can find more about pointblank in GitHub, the positive organization, just look for pointblank. And my closing remark is, please try out the package. Let me know how it goes. Drop me an issue. I read them all. You want to start a discussion, I'm there too. Thank you.

Q&A

Thanks so much, Richard. Can you all hear me okay? Okay. We did have, let's see. We do have a question. I'm going to post it up on the stage here for you. A question about another product deposit. Is Shiny GPU accelerated yet? I don't really work on Shiny, but I want to say no. That's my guess. I don't take my word for it, but I think no, it's not. Yeah.

Okay. And then we've got one more question that just came in from Josh. Do you think it's important for internal IT auditors to validate the AI engineers are measuring and communicating data quality?

Internal IT auditors. I mean, they may have some part in it. I mean, if there's more people in the game, yeah, more power to it. Usually it's like a dearth of people that want to participate in measuring and communicating data quality. So, if I tell you auditors want in, I say, yeah, that's, I would accept. I don't think it's important, but I think it's more important to have more people. So, that's really what I'm driving at.

Okay. All right. We still have a few moments if anyone wants to put in any final questions. Just give it one moment here and I want to thank you so much for speaking. Yeah, thank you. And earlier we did have a little freeze up. Apologies for that. It seems like it cleared itself up though. So, all good. But all right. Not seeing any more questions come through. So, thanks so much, everyone. Thank you again, Richard, and we will see you at the next session. All right. Thank you. All right. Bye, everyone.