An Indonesian ID Number Encodes Your Birth Date and Gender — So I Built a Tool That Fact-Checks Spreadsheets With It
Every Indonesian citizen has a NIK: a 16-digit national ID number. Most people treat it as a random string. It isn't. Digits 7–12 encode the holder's birth date as DDMMYY — and for women, the day is stored as the real day plus 40. So a NIK containing 570890 means: born on the 17th (57 − 40) of August 1990, female. Which means something interesting: if a spreadsheet has a NIK column and separate…
Indonesian citizens possess a 16-digit national identification number called NIK, which reveals specific information encoded within its digits. For women, the day of birth is stored as the actual day plus 40, so a NIK value of 570890 indicates a birthdate of August 17, 1990, for a female individual. This feature inspired the creation of a tool named kualitasid, which is a data quality profiler and cleaner specifically designed to handle data formatted according to Indonesian standards.
The tool is built using pandas and is available on PyPI, allowing users to install it via the command `bash pip install kualitasid`.
Kualitasid is tailored to address the unique characteristics of Indonesian datasets, such as different formats for monetary values, phone numbers, dates, and other types of information. It can detect the data type of each column, score the dataset's quality from 0 to 100, identify and report invalid, empty, or duplicate values, and automatically clean the data by converting it into standardized formats.
For instance, it can transform "Rp 5.000.000" into "5000000" and "0812-3456-7890" into "+6281234567890", as well as convert the date "17 Agustus 1990" into a recognized date format.
One of the key aspects of kualitasid is its ability to check for consistency between a NIK column and separate birth date and gender columns within a spreadsheet. If inconsistencies are found, such as a NIK indicating a female birthdate but the gender column stating otherwise, or a discrepancy in the birth date versus the date column, kualitasid flags these issues.
The tool is designed to handle invalid NIKs gracefully by skipping them rather than double-reporting errors. Additionally, to protect privacy, all NIKs and other sensitive data are masked in the output, ensuring that the tool never reveals full national ID numbers, even if it flags potential issues.
The tool's development was guided by a set of principles to ensure that it performs its tasks responsibly and effectively. Invalid NIKs are not double-reported, and the consistency check only applies to properly formatted NIKs to avoid false positives. The output of the reports is also safeguarded to prevent any leakage of actual national ID numbers, with invalid examples for sensitive data types being masked by default.
An important consideration made during the tool's development was to avoid comparing province digits in a NIK against a province column, as this could generate false positives due to differences between registration and current residence.
In a practical demonstration of its capabilities, kualitasid was applied to a sample dataset with intentionally messy data. The dataset contained five rows with various inaccuracies, including issues with NIKs, phone numbers, dates, and other fields. After running kualitasid on the dataset, it generated a comprehensive report detailing the quality score, the number of duplicate rows, and specific consistency problems found in the data.
For example, it identified that Siti Aminah's NIK encoded her as a female, contradicting the "Laki-laki" (male) gender listed in the gender column, and pointed out that Andi Wijaya's NIK suggested a birthdate of March 15, 1985, while the birth date column showed March 16, 1985, highlighting a one-day discrepancy.
Kualitasid is designed with a clear focus on Indonesian data formats and does not attempt to validate data from other countries, making it highly specialized for Indonesian datasets. It operates locally, ensuring that no data is transmitted outside the machine, which is crucial for handling sensitive national ID numbers. The tool is straightforward to use, supporting input in CSV or Excel formats and producing reports in various formats, including text, JSON, or HTML.
Despite its current capabilities, kualitasid aims to be flexible and expandable. It is MIT-licensed, allowing for open collaboration and modification by developers. The tool is currently at version 0.3.0 and welcomes feedback on any limitations or additional formats users might need it to handle. Those working with Indonesian datasets, including government agencies, fintech companies, HR departments, and e-commerce platforms, are encouraged to reach out for potential enhancements or contributions. Further information about kualitasid can be found on its GitHub repository and PyPI page.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to