pakdatakit 2.5.0
TypeScript (npm)
Section titled “TypeScript (npm)”Includes everything prepared for 2.4.0, which was never published on its own: the 2.4.0 changes are listed here with the 2.5.0 ones.
slugify(),compareUrdu(),isRTL()andwrapBidi()(pakdatakit/text).slugifymakes URL slugs that keep Urdu letters (no transliteration), withscript: 'any' | 'latin' | 'urdu'.compareUrdusorts in Urdu alphabetical order following the Unicode CLDR collation for Urdu (CLDR 49), with letters joined to ھ as letters of their own, the same in every port without ICU.isRTLchecks the first letter’s direction;wrapBidiwraps text in Unicode directional isolates.calculateSalaryTax(),calculateMonthlySalaryTax(),getSalaryTaxSlabs(),getSalaryTaxYears()andgetTaxYear()(pakdatakit/incometax), with the new datasetdata/income-tax-slabs.json: the salaried income tax rate table for tax years 2020 to 2027 from FBR’s consolidated Income Tax Ordinance. Returns the tax, the monthly amount, the effective rate and the slab, rounded half up to the paisa. Surcharge, credits and exemptions are not applied. Thesourcefor tax year 2027 is the Finance Act, 2026 as gazetted; FBR Circular No. 02 of 2026-27 and the consolidated Ordinance are cited in DATA.md.scoreAddress()andphoneRiskSignals()(pakdatakit/quality): heuristics for cash on delivery.scoreAddressscores an address 0 to 100 from its city, house number, street, area, postal code (a known post office scores more) and landmark words in English, Roman Urdu and Urdu, and lists what is missing.phoneRiskSignalsflags invalid, landline, service, repeated-digit, sequential and placeholder numbers. The form adapters gainpk.codPhone()(IsCodPhonefor class-validator).getSalesTaxRate(),calculateSalesTax()andsplitInclusive()(pakdatakit/salestax): standard sales tax rates with the dates they applied, from 1 July 2019, for goods (federal) and for services in Punjab, Sindh, Khyber Pakhtunkhwa, Balochistan and Islamabad Capital Territory, each with its law and official source (new datasetsales-tax-rates.json). Amounts are rounded half up to the paisa.parseElectricityRef(),validateElectricityRef()andvalidateGasConsumerNumber()(pakdatakit/bills): DISCO 14-digit reference numbers (with U/R), DISCO customer IDs, K-Electric account numbers, and SNGPL and SSGC consumer numbers, in the formats the utilities’ bill pages ask for.discoisnullfor DISCO bills, as no official source maps the digits to a company.mapCourierStatus()andnormalizeCityForCourier()(pakdatakit/courier): one status vocabulary for courier statuses, mapping only publicly documented statuses (PostEx’s API guide v4.1.9 and Leopards’ “Returned to Shipper”; TCS, M&P, Trax and BlueEx publish none), and city short forms (LHR,Khi,Pindi,Isb, Lyallpur, Urdu names) mapped to the city list. No API clients and no tracking-number detection, as no courier documents its format. The status mapping is experimental: its values may change in a minor release as more couriers’ lists are added (see CONTRIBUTING.md).buildFbrInvoice()andvalidateFbrInvoice()(pakdatakit/fbr-invoice): types for FBR’s Digital Invoicing JSON, a builder that works out each line’s sales tax, and an offline validator that reports FBR’s error codes, following PRAL’s “Technical Specification for DI API” v1.12. No HTTP client and no tokens.
Changed
Section titled “Changed”- Package metadata: the description, keywords and homepage now follow the same
style in every registry, and CI checks that the version, repository URL,
licence and author agree across ports (
npm run check:metadata). binandrepository.urlinpackage.jsonare written in the form npm publishes, sonpm publishno longer warns that it corrected them.- New
NOTICEfile (included in the npm package) and an “Origin and attribution” section in the README. test-vectors/README.mddocuments the shared test vectors;npm run test:portsregenerates them and runs every port against them.dataVersionis now2026-11-18(new dataset: sales tax rates).
Python (PyPI)
Section titled “Python (PyPI)”Includes everything prepared for 2.4.0, which was never published on its own: the 2.4.0 changes are listed here with the 2.5.0 ones.
- Urdu text helpers in
pakdatakit.text:slugify(URL slugs that keep Urdu letters, withscript="any" | "latin" | "urdu"),compare_urdu(Urdu alphabetical order from CLDR 49, forfunctools.cmp_to_key),is_rtlandwrap_bidi(Unicode directional isolates), with theSlugScriptandBidiDirectiontypes. - Income tax on salary (
pakdatakit.incometax):calculate_salary_tax,calculate_monthly_salary_tax,get_salary_tax_slabs,get_salary_tax_yearsandget_tax_year, with theSalaryTax,SalaryTaxSlabandSalaryTaxYeardataclasses, from the salaried rate table of the Income Tax Ordinance 2001 for tax years 2020 to 2027 (new datasetincome-tax-slabs.json). score_address(): scores how complete a delivery address is (0 to 100), returningAddressScore(score, missing, parsed)with the parts not found, weighted byADDRESS_WEIGHTS.phone_risk_signals(): flags a delivery phone number that is invalid, a landline or service number, or looks made up (repeated, sequential or placeholder digits).get_sales_tax_rate(): standard sales tax rate, with its law and source, for goods (FBR) or for services in a province or Islamabad Capital Territory on a date, from 1 July 2019.calculate_sales_tax()adds the tax to an amount (or splits it out withinclusive=True) andsplit_inclusive()splits a tax-inclusive amount, rounding half up to the paisa exactly, asSalesTaxAmounts(net, tax, gross, rate).parse_electricity_ref()/validate_electricity_ref(): reads an electricity bill identifier, a DISCO 14-digit reference number (with an optionalU/R), a DISCO customer ID (10 digits, 11 for LESCO) or a K-Electric 13-digit account number, asElectricityRef(type, digits, formatted, urban_rural, disco).validate_gas_consumer_number()checks an SNGPL (11 digits) or SSGC (10 digits) consumer number. Formats only; no check digit is published.map_courier_status(): maps a courier’s own status name, code or numeric ID to oneCourierStatusvocabulary (pending…cancelled), for the statuses couriers document publicly (PostEx’s merchant API guide and Leopards’ “Returned to Shipper”).normalize_city_for_courier(): maps short forms (LHR,Khi,Pindi), the old name Lyallpur, a trailing “city” and Urdu-script names to the city list. The status mapping is experimental and may change in a minor release as more couriers’ lists are added.build_fbr_invoice()/validate_fbr_invoice()/expected_sales_tax(): FBR Digital Invoicing, following PRAL’s DI API specification v1.12 (FBR_DI_SPEC_VERSION). The builder works out each line’s sales tax (N%andRs.Nrates), fills FBR’s defaults and adds up the columns, asFbrInvoiceBuild(invoice, totals); the validator returns every problem it can find offline with FBR’s error code, asFbrInvoiceValidation(valid, errors). The invoice is a plaindictwith FBR’s camelCase keys (FbrInvoice/FbrInvoiceItemTypedDicts). No HTTP client, no tokens.
Changed
Section titled “Changed”- Package metadata: the description, keywords and homepage now follow the same
style in every registry, and CI checks that the version, repository URL,
licence and author agree across ports (
npm run check:metadata). DATA_VERSIONis now2026-11-18(new dataset: sales tax rates).
Dart (pub.dev)
Section titled “Dart (pub.dev)”Includes everything prepared for 2.4.0, which was never published on its own: the 2.4.0 changes are listed here with the 2.5.0 ones.
calculateSalaryTax()andcalculateMonthlySalaryTax(): income tax on a salaried individual’s taxable income from the salaried rate table of the Income Tax Ordinance 2001 for tax years 2020 to 2027, as aSalaryTax(tax,monthly,effectiveRate,slab,taxYear), rounded half up to the paisa, exactly on every platform.getSalaryTaxSlabs()returns a year’s table (SalaryTaxYear,SalaryTaxSlab) with its law and FBR source,getSalaryTaxYears()the years covered andgetTaxYear()the tax year of a date. Also aspackage:pakdatakit/incometax.dart.slugify(): URL slugs that keep Urdu letters (SlugScriptlimits the script);compareUrdu(): Urdu alphabetical order from the CLDR collation, forList.sort, without ICU;isRTL()andwrapBidi()(BidiDirection): right-to-left detection and Unicode directional isolates.scoreAddress(): scores how complete a delivery address is (0-100), with themissingAddressParts and theparseAddressresult, and warns when a known post office code is in a different province from the city.phoneRiskSignals():PhoneRiskFlags for a phone number a courier cannot reach or that looks made up (landline, service number, repeated or sequential digits, placeholder numbers). AlsoaddressWeights, and aspackage:pakdatakit/quality.dart.getSalesTaxRate(): the standard sales tax rate on goods (FBR) or on services in a province or Islamabad Capital Territory on a date, from 1 July 2019, with the authority, law and source (SalesTaxRate,SalesTaxKind).calculateSalesTax()adds tax at a rate or a looked-up rate, or splits it out withinclusive: true;splitInclusive()splits a tax-inclusive amount. Both returnSalesTaxAmounts, rounded half up to the paisa, exactly on every platform. Also aspackage:pakdatakit/salestax.dart.parseElectricityRef()andvalidateElectricityRef(): a DISCO (WAPDA) 14-digit reference number with optional U/R, a DISCO customer ID (10 or 11 digits) or a 13-digit K-Electric account number, as anElectricityRef(typeas anElectricityRefType,digits,formatted,urbanRural,disco).validateGasConsumerNumber()checks an SNGPL (11-digit) or SSGC (10-digit) consumer number (GasCompany). Format checks only; no utility publishes a check digit. Also aspackage:pakdatakit/bills.dart.mapCourierStatus(): maps a courier’s own status (name, numeric ID or code) to one vocabulary,CourierStatus, from PostEx’s merchant API guide and Leopards’ “Returned to Shipper” (Couriernames the couriers).normalizeCityForCourier()maps short forms (LHR,Khi,Pindi), the old name Lyallpur, a trailing “city” and Urdu script to the city list. No API is called. Also aspackage:pakdatakit/courier.dart.buildFbrInvoice()andvalidateFbrInvoice(): FBR Digital Invoicing, for the invoice JSON (Map<String, Object?>, typedefFbrInvoice) posted to PRAL’s DI API (specification 1.12,fbrDiSpecVersion). The builder works out each line’s sales tax (expectedSalesTax():N%orRs.Nper unit, withcalculateSalesTax), fills FBR’s defaults and adds up the columns (FbrInvoiceBuild,FbrInvoiceTotals); the validator returns every problem it can find offline with FBR’s error code (FbrInvoiceValidation,FbrInvoiceError), optionally rejecting future dates withtoday:. AlsoFbrInvoiceTypeandFbrRegistrationType. No HTTP client and no token handling. Also aspackage:pakdatakit/fbr_invoice.dart.
Changed
Section titled “Changed”- Package metadata: the description, keywords and homepage now follow the same
style in every registry, and CI checks that the version, repository URL,
licence and author agree across ports (
npm run check:metadata). dataVersionis now2026-11-18(new dataset: sales tax rates).
.NET (NuGet)
Section titled “.NET (NuGet)”Includes everything prepared for 2.4.0, which was never published on its own: the 2.4.0 changes are listed here with the 2.5.0 ones.
Text.Slugify(input, options): a URL slug that keeps Urdu letters as they are, folds accented Latin-1 letters and converts Urdu digits (SlugifyOptions.Script:SlugScript.Any,LatinorUrdu).Text.CompareUrdu(a, b): Urdu alphabetical order (CLDRur, with the ھ digraphs as letters of their own), forList.Sort, built in so it does not depend on the culture or ICU.Text.IsRtl(text): whether the first letter is right to left.Text.WrapBidi(text, direction): wraps text in a Unicode directional isolate (BidiDirection.Auto,RtlorLtr).IncomeTax.CalculateSalaryTax(annualIncome, options)andIncomeTax.CalculateMonthlySalaryTax(monthlySalary, options): income tax on salary from the salaried rate table for tax years 2020 to 2027, as aSalaryTax(Tax,Monthly,EffectiveRate,Slab,TaxYear) rounded half up to the paisa in exact integer arithmetic (SalaryTaxOptionstakesTaxYear,DateorOnDate).IncomeTax.GetSalaryTaxSlabs(taxYear)returns the table as aSalaryTaxYearwith itsSalaryTaxSlabbands, law and official source,IncomeTax.GetSalaryTaxYears()the years covered, andIncomeTax.GetTaxYear(date)the July-to-June tax year of a date. Invalid input returnsnull.Quality.ScoreAddress(address): scores how complete a delivery address is (0 to 100) for cash on delivery, as anAddressScore(Score, theMissingAddressPartvalues and theParsedaddress with extra warnings), usingQuality.AddressWeights.Quality.PhoneRiskSignals(phone)returnsPhoneRiskFlagvalues for a number a courier cannot reach or that looks made up (Invalid,Landline,NotMobile,RepeatedDigits,SequentialDigits,TestNumber). New[CodPhone]attribute inPakDataKit.DataAnnotationsandIsCodPhone()rule inPakDataKit.FluentValidation: a mobile number with no risk flags.SalesTax.GetRate(query): the standard sales tax rate on a date, from 1 July 2019, forSalesTaxKind.Goods(federal, FBR) orSalesTaxKind.Servicesin a province or Islamabad Capital Territory, as aSalesTaxRatewith its authority, law and official source (SalesTaxRateQuerytakesKind,ProvinceandDateorOnDate).SalesTax.Calculate(amount, options)adds the tax for aRateor a province’s rate (SalesTaxOptions,Inclusiveto split it out) andSalesTax.SplitInclusive(gross, rate)splits a tax-inclusive amount, both returningSalesTaxAmounts(Net,Tax,Gross,Rate) rounded half up to the paisa in exact integer arithmetic. Invalid input returnsnull.Bills.ParseElectricityRef(input): reads a DISCO (WAPDA) reference number (14 digits, optionalU/R), a DISCO customer ID (10 or 11 digits) or a K-Electric account number (13 digits starting04000), as anElectricityRef(TypeasElectricityRefType.Reference,CustomerIdorKElectric,Digits,Formatted,UrbanRural,Disco), ornull.Bills.ValidateElectricityRef(input)checks the same formats, andBills.ValidateGasConsumerNumber(input, company)checks an 11-digitGasCompany.Sngplor 10-digitGasCompany.Ssgcconsumer number. Format checks only; separators and Urdu digits are accepted.Courier.MapStatus(courier, raw): maps a courier’s own status text, or a numeric status ID through thedoubleoverload, to aCourierStatus(Pending,Booked,PickedUp,InTransit,OutForDelivery,Attempted,UnderReview,Delivered,Returning,Returned,Cancelled). Only publicly documented statuses are mapped (PostEx’s merchant API guide and Leopards’ “Returned to Shipper”); anything else returnsnull. The status mapping is experimental and may change in a minor release as more couriers’ lists are added.Courier.NormalizeCity(input)maps short forms (LHR,Khi,Pindi), the old name Lyallpur, a trailing “city” and Urdu script to a city in the city list. Neither throws.FbrInvoice.Build(input),FbrInvoice.Validate(invoice, today)andFbrInvoice.ExpectedSalesTax(item): FBR Digital Invoicing (PRAL’s DI API specification 1.12,FbrInvoice.SpecVersion) on the invoice JSON (JsonNode;Validatealso takes aJsonElement).Buildworks out each line’ssalesTaxApplicablewithSalesTax.Calculate(or quantity ×Rs.N), fills FBR’s defaults and returns anFbrInvoiceBuild(Invoiceas aJsonObject,TotalsasFbrInvoiceTotals), ornull.Validatereturns anFbrInvoiceValidationwhoseErrorsareFbrInvoiceErrorrecords (Code,Field,Message) with FBR’s error codes, checking everything that needs no call to FBR, including the sales tax to within one paisa.FbrInvoiceTypeandFbrRegistrationTypehold the allowed strings. No HTTP client, no tokens.
Changed
Section titled “Changed”- Package metadata: the description, keywords and homepage now follow the same
style in every registry, and CI checks that the version, repository URL,
licence and author agree across ports (
npm run check:metadata). PackageProjectUrlpoints to the .NET README andCopyrightmatches the licence file.PakData.Versionis now2026-11-18(new dataset: sales tax rates).
PHP (Packagist)
Section titled “PHP (Packagist)”Includes everything prepared for 2.4.0, which was never published on its own: the 2.4.0 changes are listed here with the 2.5.0 ones.
Text::slugify(),Text::compareUrdu(),Text::isRtl()andText::wrapBidi(): URL slugs that keep Urdu letters (script:Text::SCRIPT_ANY,SCRIPT_LATIN,SCRIPT_URDU), Urdu alphabetical order forusort()from the CLDRurcollation (no intl or ICU needed), right-to-left detection, and Unicode directional isolates (Text::BIDI_AUTO,BIDI_RTL,BIDI_LTR). They accept any value and never throw.IncomeTax::calculateSalary(),IncomeTax::calculateMonthlySalary(),IncomeTax::getSalarySlabs(),IncomeTax::getSalaryYears()andIncomeTax::getTaxYear(): income tax on salary from the salaried rate table of the Income Tax Ordinance 2001 for tax years 2020 to 2027, computed exactly in whole paisa (SalaryTax,SalaryTaxSlab,SalaryTaxYear). They returnnullfor any invalid input and never throw.Quality::scoreAddress(): scores how complete a delivery address is (0 to 100) for cash on delivery, with themissingparts (city,houseNumber,street,area,postalCode,landmark) and the parsed address as anAddressScore;Quality::ADDRESS_WEIGHTSholds the points per part.Quality::phoneRiskSignals()flags phone numbers a courier cannot use: invalid, landline and service numbers, and repeated, sequential and placeholder numbers. New Laravel rulepk_cod_phone(andRules\CodPhone) passes only when there are no flags, with English and Urdu messages.SalesTax::getRate(),SalesTax::calculate()andSalesTax::splitInclusive(): standard sales tax rates for goods (FBR) and services (PRA, SRB, KPRA, BRA, ICT) from 1 July 2019, with the law and source of each, and exact sales tax amounts in whole paisa (SalesTaxRate,SalesTaxAmounts). They returnnullfor any invalid input and never throw.Bills::parseElectricityRef(),Bills::validateElectricityRef()andBills::validateGasConsumerNumber(): electricity bill identifiers (14-digit DISCO reference numbers with optional U/R, DISCO customer IDs and K-Electric account numbers) as anElectricityRef, and SNGPL (11 digits) and SSGC (10 digits) gas consumer numbers. New Laravel rulepk_electricity_ref(andRules\ElectricityRef), with English and Urdu messages.Courier::mapStatus()andCourier::normalizeCity(): maps a courier’s own status (PostEx’s documented order statuses and tracking codes, and Leopards’ “Returned to Shipper”) to one vocabulary (Courier::PENDING…Courier::CANCELLED), and maps short forms, old names and Urdu spellings of cities (LHR,Pindi,Lyallpur,Karachi City,لاہور) to the city list. No API is called; both returnnullfor anything unknown and never throw. The status mapping is experimental and may change in a minor release as more couriers’ lists are added.FbrInvoice::build(),FbrInvoice::validate()andFbrInvoice::expectedSalesTax(): FBR Digital Invoicing (PRAL’s DI API specification v1.12,FbrInvoice::SPEC_VERSION).build()works out each line’s sales tax (N%andRs.Nrates), fills FBR’s defaults and adds up the columns;validate()checks an invoice (array or decoded JSON object) offline and returns every problem with FBR’s error code as anFbrInvoiceValidationofFbrInvoiceErrors. No HTTP client or tokens; they never throw.
Changed
Section titled “Changed”composer.jsonnow also requiresext-ctypeandext-json(withext-mbstring), the extensions the code calls, so Composer refuses to install without them. Both are enabled in standard PHP builds.PakData::version()is now2026-11-18(new dataset: sales tax rates).