presidio icon indicating copy to clipboard operation
presidio copied to clipboard

Add IN_DRIVING_LICENCE recognizer for Indian driving licence numbers

Open shlokbam opened this issue 4 weeks ago • 0 comments

Is your feature request related to a problem? Please describe. Presidio has several Indian recognizers (IN_PAN, IN_AADHAAR, IN_VOTER, IN_PASSPORT, IN_VEHICLE_REGISTRATION, IN_GSTIN), but none for driving licence numbers, which are a common identifier in Indian KYC and onboarding documents.

Describe the solution you'd like A new country-specific recognizer, InDrivingLicenceRecognizer (COUNTRY_CODE = "in", entity IN_DRIVING_LICENCE), shipped enabled: false like the other Indian recognizers.

Proposed format: the standard number used by the national Sarathi system (MoRTH), SS-RRYYYYNNNNNNN or SSRR YYYYNNNNNNN:

  • SS: 2-letter state/UT code (e.g. MH, HR, KA)
  • RR: 2-digit RTO code
  • YYYY: 4-digit year of issue
  • NNNNNNN: 7-digit serial

That's 15 characters, plus an optional space or hyphen (e.g. MH14 20110062821, HR-0619850034761).

Proposed design:

  • One regex, \b[A-Z]{2}[- ]?\d{2}[- ]?\d{4}\d{7}\b, with a weak base score (0.3), so it never matches a bare digit run.
  • Context words such as "driving licence", "licence number" and "dl no" to raise the score.
  • validate_result rejects unknown state/UT codes and years outside 1950–current year. It never promotes to 1.0, since no checksum is published.
  • Unit tests plus a configuration-path test through RecognizerRegistryProvider.

Source: the input format of the Sarathi DL status service, https://sarathi.parivahan.gov.in/. I could not find a formal published specification. Secondary references (e.g. Paytm, GeeksforGeeks) agree with this format. Older licences printed in state-specific formats (e.g. RJ-13/DLC/12/123456) would be out of scope.

Describe alternatives you've considered Users can add a custom PatternRecognizer themselves, but a predefined one keeps the format, state-code list and tests in one maintained place, consistent with the other Indian recognizers.

Additional context I have an implementation ready and would be happy to open a PR if you'd accept this. Feedback on the format or score is welcome.

shlokbam avatar Nov 08 '26 18:11 shlokbam