Repository avatar
AI Tools
v1.0.0
active

nbrain-sfda-gs1-tatmeen

io.github.NBrain-Studio/nbrain-sfda-gs1-tatmeen

MENA Pharma GS1 DataMatrix SDK for Saudi SFDA RSD, UAE Tatmeen, Bahrain NHRA & SSCC-18

Documentation

nbrain-sfda-gs1-tatmeen — MENA Pharmaceutical Serialization & GS1 DataMatrix SDK

Engineered by Eng. Nadeem Mohamed Badr El-Din (ORCID 0009-0005-5836-2631) — Founder of NBrain (nbra.in).

Zero-dependency GS1 DataMatrix (]d2), GS1-128 (]C1), SSCC-18 Pallet Aggregation & W3C GS1 Digital Link parser, encoder, and regulatory compliance auditor for Saudi SFDA RSD (رصد), UAE MoHAP Tatmeen (تطمين), and Bahrain NHRA, parity-tested across Python, JavaScript/ESM, and Rust.

Key Regulatory Capabilities

  • 4-Pillar Serialization Validation: Verifies AI (01) GTIN-14 MOD-10 check digits, AI (17) YYMMDD expiry dates (including GS1 General Specifications §3.4.2 day 00 = end-of-month leap-year resolution), AI (10) CSET-82 Batch/Lot, and AI (21) unit serial numbers.
  • State-Machine FNC1 (\x1d) Decoder: Safely parses both optimal fixed-first strings and non-optimal hospital/3PL strings where variable-length AI (10) or AI (21) precedes AI (17), plus bracketed HRI (01)...(17)...(10)...(21)....
  • Saudi SFDA PTS & Tatmeen Logistics (AI 00 SSCC-18): Validates 18-digit Serial Shipping Container Codes for case/pallet aggregation.
  • GS1 Digital Link 1.1: Emits canonical https://id.gs1.org/01/{gtin}/10/{lot}/21/{serial}?17={yymmdd} URIs.

Verified Examples

Country PrefixHRIResolved ExpiryCompliance (2026-12-06)
0628(01)06281000001233(17)280200(10)LOT-KSA-01(21)SN10000012028-02-29PASS
0629(01)06291041500213(17)270600(10)DXB-TAT-88(21)AE99881122027-06-30PASS
0608(01)06081000223341(17)291231(10)BH-NHRA-7(21)MN-4455662029-12-31PASS
0622(01)06221000998874(17)260200(10)CAI-EDA-3(21)EG-7778882026-02-28EXPIRED (EXPIRED_PACK)

Quickstart

from nbrain_sfda_gs1 import encode_gs1_datamatrix, audit_pharma_pack

pack = encode_gs1_datamatrix("06281000001233", "280200", "LOT-RYD-01", "SN9001", include_symbology=True)
report = audit_pharma_pack(pack["element_string"], authority="SFDA_RSD")

License: MIT