[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M739RGFE66EDDG061P0ETXYD":3,"skill-same:01M739RGFE66EDDG061P0ETXYD":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":6,"updatedAt":44,"install":45,"resources":58},"01M739RGFE66EDDG061P0ETXYD","implement-pharma-serialisation",null,"Implement pharmaceutical serialisation and track-and-trace systems compliant with EU FMD, US DSCSA, and other global regulations. Covers unique identifier generation, aggregation hierarchy, EPCIS data exchange, and verification endpoint integration. Use when implementing serialisation for a new product launch, integrating with the EMVS\u002FNMVS, designing DSCSA-compliant transaction exchange, building an EPCIS event repository, or extending serialisation to additional markets (China, Brazil, Russia).","roohe\u002Fagentic-super-skills","roohe","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99054084?v=4","01M734WCDFP6RZVT5CNM00QR26","01M734WCE4BD0T4NZS5PCV9V5F",10,"MIT","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fimplement-pharma-serialisation\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: implement-pharma-serialisation\nlocale: caveman-lite\nsource_locale: en\nsource_commit: 82c77053\ntranslator: \"Julius Brussee homage — caveman\"\ntranslation_date: \"2026-04-24\"\ndescription: >\n  Implement pharmaceutical serialisation and track-and-trace systems compliant\n  with EU FMD, US DSCSA, and other global regulations. Covers unique identifier\n  generation, aggregation hierarchy, EPCIS data exchange, and verification\n  endpoint integration. Use when implementing serialisation for a new product\n  launch, integrating with the EMVS\u002FNMVS, designing DSCSA-compliant transaction\n  exchange, building an EPCIS event repository, or extending serialisation to\n  additional markets (China, Brazil, Russia).\nlicense: MIT\nallowed-tools: Read Write Edit Bash Grep Glob\nmetadata:\n  author: Philipp Thoss\n  version: \"1.0\"\n  domain: compliance\n  complexity: advanced\n  language: multi\n  tags: serialisation, eu-fmd, dscsa, epcis, track-and-trace, pharma\n---\n\n# Implement Pharmaceutical Serialisation\n\nSet up pharmaceutical serialisation systems for regulatory compliance with global track-and-trace mandates.\n\n## When to Use\n\n- Implementing serialisation for a new product launch in the EU or US market\n- Integrating with the European Medicines Verification System (EMVS\u002FNMVS)\n- Designing DSCSA-compliant transaction information exchange\n- Building or integrating an EPCIS event repository for supply chain visibility\n- Extending serialisation to additional markets (China NMPA, Brazil ANVISA, etc.)\n\n## Inputs\n\n- **Required**: Product information (GTIN, product code, dosage form, pack sizes)\n- **Required**: Target market regulations (EU FMD, DSCSA, or both)\n- **Required**: Packaging hierarchy (unit, bundle, case, pallet)\n- **Optional**: Existing ERP\u002FMES system details for integration\n- **Optional**: Contract manufacturer serialisation capabilities\n- **Optional**: Verification endpoint specifications\n\n## Procedure\n\n### Step 1: Understand the Regulatory Landscape\n\n| Regulation | Region | Key Requirements | Deadline |\n|-----------|--------|------------------|----------|\n| EU FMD (2011\u002F62\u002FEU) | EU\u002FEEA | Unique identifier + tamper-evident feature on each unit | Live since Feb 2019 |\n| DSCSA | USA | Electronic, interoperable tracing at package level | Full enforcement Nov 2024+ |\n| China NMPA | China | Unique drug traceability code per minimum saleable unit | Rolling |\n| Brazil ANVISA (SNCM) | Brazil | Serialisation of pharmaceuticals with IUM | Rolling |\n| Russia MDLP | Russia | Crypto-code per unit, mandatory scanning | Live |\n\nKey data elements per regulation:\n\n**EU FMD unique identifier (per Delegated Regulation 2016\u002F161):**\n- Product code (GTIN-14 from GS1)\n- Serial number (up to 20 alphanumeric characters, randomised)\n- Batch\u002Flot number\n- Expiry date\n\n**DSCSA transaction information:**\n- Product identifier (NDC\u002FGTIN, serial number, lot, expiry)\n- Transaction information (date, entities, shipment details)\n- Transaction history and transaction statement\n- Verification at package level\n\n**Got:** Clear understanding of which regulations apply to each product-market combination.\n**If fail:** Engage regulatory affairs to confirm market requirements before proceeding.\n\n### Step 2: Design the Serialisation Data Model\n\n```sql\n-- Core serialisation data model\nCREATE TABLE serial_numbers (\n    id BIGSERIAL PRIMARY KEY,\n    gtin VARCHAR(14) NOT NULL,          -- GS1 GTIN-14\n    serial_number VARCHAR(20) NOT NULL,  -- Unique per GTIN\n    batch_lot VARCHAR(20) NOT NULL,\n    expiry_date DATE NOT NULL,\n    status VARCHAR(20) DEFAULT 'ACTIVE', -- ACTIVE, DECOMMISSIONED, DISPENSED, etc.\n    created_at TIMESTAMPTZ DEFAULT NOW(),\n    UNIQUE(gtin, serial_number)\n);\n\n-- Aggregation hierarchy\nCREATE TABLE aggregation (\n    id BIGSERIAL PRIMARY KEY,\n    parent_code VARCHAR(50) NOT NULL,     -- SSCC or higher-level code\n    parent_level VARCHAR(10) NOT NULL,    -- CASE, PALLET, BUNDLE\n    child_code VARCHAR(50) NOT NULL,      -- GTIN+serial or child SSCC\n    child_level VARCHAR(10) NOT NULL,     -- UNIT, BUNDLE, CASE\n    aggregation_event_id UUID NOT NULL,\n    created_at TIMESTAMPTZ DEFAULT NOW()\n);\n\n-- EPCIS events\nCREATE TABLE epcis_events (\n    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n    event_type VARCHAR(30) NOT NULL,      -- ObjectEvent, AggregationEvent, TransactionEvent\n    action VARCHAR(10) NOT NULL,          -- ADD, OBSERVE, DELETE\n    biz_step VARCHAR(100),               -- urn:epcglobal:cbv:bizstep:commissioning\n    disposition VARCHAR(100),             -- urn:epcglobal:cbv:disp:active\n    read_point VARCHAR(100),             -- urn:epc:id:sgln:location\n    event_time TIMESTAMPTZ NOT NULL,\n    event_timezone VARCHAR(6) NOT NULL,\n    payload JSONB NOT NULL,\n    created_at TIMESTAMPTZ DEFAULT NOW()\n);\n```\n\nAggregation hierarchy:\n\n```\nPallet (SSCC)\n  └── Case (SSCC)\n       └── Bundle (GTIN + serial) [optional level]\n            └── Unit (GTIN + serial)\n```\n\n**Got:** Data model supports full pack hierarchy with EPCIS event tracking.\n**If fail:** If existing ERP schema conflicts, design an integration layer rather than modifying ERP directly.\n\n### Step 3: Implement Serial Number Generation\n\n```python\nimport secrets\nimport string\n\ndef generate_serial_number(length: int = 20, charset: str = None) -> str:\n    \"\"\"Generate a random serial number compliant with GS1 standards.\n\n    EU FMD requires randomised serial numbers to prevent prediction.\n    Max 20 characters, alphanumeric (GS1 Application Identifier 21).\n    \"\"\"\n    if charset is None:\n        # GS1 AI(21) allows: digits, uppercase, lowercase, and some special chars\n        # Most implementations use alphanumeric only for interoperability\n        charset = string.ascii_uppercase + string.digits\n    return ''.join(secrets.choice(charset) for _ in range(length))\n\n\ndef generate_serial_batch(gtin: str, batch_lot: str, expiry: str, count: int) -> list:\n    \"\"\"Generate a batch of unique serial numbers for a production run.\"\"\"\n    serials = set()\n    while len(serials) \u003C count:\n        serials.add(generate_serial_number())\n    return [\n        {\n            \"gtin\": gtin,\n            \"serial_number\": sn,\n            \"batch_lot\": batch_lot,\n            \"expiry_date\": expiry,\n            \"status\": \"COMMISSIONED\"\n        }\n        for sn in serials\n    ]\n```\n\n**Got:** Serial numbers are cryptographically random, unique per GTIN, and stored before printing.\n**If fail:** If a uniqueness collision occurs, regenerate the conflicting serial and log the event.\n\n### Step 4: Implement GS1 DataMatrix Encoding\n\nThe 2D DataMatrix barcode encodes the GS1 element string:\n\n```\n(01)GTIN(21)Serial(10)Batch(17)Expiry\n```\n\nExample:\n```\n(01)05012345678901(21)A1B2C3D4E5(10)LOT123(17)261231\n```\n\nWhere:\n- AI(01) = GTIN-14\n- AI(21) = Serial number\n- AI(10) = Batch\u002Flot number\n- AI(17) = Expiry date (YYMMDD)\n\nThe GS1 DataMatrix uses FNC1 as a separator (GS character, ASCII 29) between variable-length fields.\n\n```python\ndef encode_gs1_element_string(gtin: str, serial: str, batch: str, expiry: str) -> str:\n    \"\"\"Encode GS1 element string for DataMatrix printing.\n\n    FNC1 (GS character \\\\x1d) separates variable-length fields.\n    AI(01) and AI(17) are fixed length, so no separator needed after them.\n    AI(21) and AI(10) are variable length and need FNC1 terminator.\n    \"\"\"\n    GS = '\\x1d'  # GS1 FNC1 \u002F Group Separator\n    return f\"01{gtin}21{serial}{GS}10{batch}{GS}17{expiry}\"\n```\n\n**Got:** Encoded strings verified by scanning test prints with a GS1-certified verifier (ISO 15415 grade C or above).\n**If fail:** If scan verification fails, check print quality, quiet zones, and encoding order.\n\n### Step 5: Integrate with National Verification Systems\n\n#### EU FMD — EMVS\u002FNMVS Integration\n\n```\nMAH → Upload serial data → EU Hub → Distribute to National Systems (NMVS)\n                                      ├── Germany (securPharm)\n                                      ├── France (CTS)\n                                      ├── Italy (AIFA)\n                                      └── ... 31 markets\n```\n\nAPI operations:\n1. **Upload** (MAH → EU Hub): Batch upload of commissioned serial numbers\n2. **Verify** (Pharmacy → NMVS): Check serial status before dispensing\n3. **Decommission** (Pharmacy → NMVS): Mark as dispensed at point of sale\n4. **Reactivate** (MAH → NMVS): Reverse accidental decommission\n\n#### DSCSA — Verification Router Service\n\n```\nTrading Partner A → VRS Request → Verification Router → MAH's VRS → Response\n```\n\nImplement a VRS responder endpoint:\n\n```python\n# Simplified VRS endpoint (DSCSA verification)\nfrom fastapi import FastAPI, HTTPException\n\napp = FastAPI()\n\n@app.get(\"\u002Fverify\u002F{gtin}\u002F{serial}\u002F{lot}\u002F{expiry}\")\nasync def verify_product(gtin: str, serial: str, lot: str, expiry: str):\n    \"\"\"DSCSA product verification endpoint.\"\"\"\n    record = await lookup_serial(gtin, serial)\n    if record is None:\n        return {\"verified\": False, \"reason\": \"SERIAL_NOT_FOUND\"}\n    if record.batch_lot != lot or str(record.expiry_date) != expiry:\n        return {\"verified\": False, \"reason\": \"DATA_MISMATCH\"}\n    if record.status != \"ACTIVE\":\n        return {\"verified\": False, \"reason\": f\"STATUS_{record.status}\"}\n    return {\"verified\": True, \"status\": record.status}\n```\n\n**Got:** Verification endpoints respond within 1 second with correct status.\n**If fail:** If national system upload fails, retry with exponential backoff and alert operations.\n\n### Step 6: Implement EPCIS Event Capture\n\nRecord supply chain events in EPCIS 2.0 format:\n\n```json\n{\n  \"@context\": \"https:\u002F\u002Fref.gs1.org\u002Fstandards\u002Fepcis\u002F2.0.0\u002Fepcis-context.jsonld\",\n  \"type\": \"ObjectEvent\",\n  \"eventTime\": \"2025-03-15T10:30:00.000+01:00\",\n  \"eventTimeZoneOffset\": \"+01:00\",\n  \"epcList\": [\"urn:epc:id:sgtin:5012345.067890.A1B2C3D4E5\"],\n  \"action\": \"ADD\",\n  \"bizStep\": \"urn:epcglobal:cbv:bizstep:commissioning\",\n  \"disposition\": \"urn:epcglobal:cbv:disp:active\",\n  \"readPoint\": {\"id\": \"urn:epc:id:sgln:5012345.00001.0\"},\n  \"bizLocation\": {\"id\": \"urn:epc:id:sgln:5012345.00001.0\"}\n}\n```\n\nKey business steps in the pharma supply chain:\n- `commissioning` — serial number assigned to physical unit\n- `packing` — aggregation into cases\u002Fpallets\n- `shipping` — departure from a location\n- `receiving` — arrival at a location\n- `dispensing` — supplied to patient (decommission trigger)\n\n**Got:** Every status change generates an EPCIS event with correct timestamps and locations.\n**If fail:** Failed event capture must be queued and retried; never silently dropped.\n\n## Validation\n\n- [ ] Serial numbers are randomised and unique per GTIN\n- [ ] GS1 DataMatrix encoding verified by barcode scanner (ISO 15415 grade C+)\n- [ ] Aggregation hierarchy correctly links units → bundles → cases → pallets\n- [ ] National verification system integration tested (upload, verify, decommission)\n- [ ] EPCIS events captured for all business steps\n- [ ] Verification endpoint responds within 1 second\n- [ ] Exception handling covers upload failures, scan failures, and network errors\n\n## Pitfalls\n\n- **Sequential serial numbers**: EU FMD explicitly requires randomisation to prevent counterfeiting. Never use sequential numbering.\n- **Aggregation errors**: Disaggregation (breaking a case) must update the hierarchy. Shipping a case with wrong child associations causes verification failures downstream.\n- **Timezone handling**: EPCIS events must include timezone offset. Using local time without offset causes event ordering ambiguity across sites.\n- **Late uploads**: Serial data must be uploaded to national systems before product enters the supply chain. Late upload = product flagged as suspicious at pharmacy.\n- **Ignoring exceptions**: Legitimate products get flagged (false alerts) regularly. A process for investigating and resolving alerts is essential.\n\n## Related Skills\n\n- `perform-csv-assessment` — validate serialisation system as a computerised system\n- `conduct-gxp-audit` — audit serialisation processes\n- `implement-audit-trail` — audit trail for serialisation events\n- `serialize-data-formats` — general data serialisation (different domain, complementary concepts)\n- `design-serialization-schema` — schema design for data exchange formats\n","# Implement Pharmaceutical Serialisation\n\nSet up pharmaceutical serialisation systems for regulatory compliance with global track-and-trace mandates.\n\n## When to Use\n\n- Implementing serialisation for a new product launch in the EU or US market\n- Integrating with the European Medicines Verification System (EMVS\u002FNMVS)\n- Designing DSCSA-compliant transaction information exchange\n- Building or integrating an EPCIS event repository for supply chain visibility\n- Extending serialisation to additional markets (China NMPA, Brazil ANVISA, etc.)\n\n## Inputs\n\n- **Required**: Product information (GTIN, product code, dosage form, pack sizes)\n- **Required**: Target market regulations (EU FMD, DSCSA, or both)\n- **Required**: Packaging hierarchy (unit, bundle, case, pallet)\n- **Optional**: Existing ERP\u002FMES system details for integration\n- **Optional**: Contract manufacturer serialisation capabilities\n- **Optional**: Verification endpoint specifications\n\n## Procedure\n\n### Step 1: Understand the Regulatory Landscape\n\n| Regulation | Region | Key Requirements | Deadline |\n|-----------|--------|------------------|----------|\n| EU FMD (2011\u002F62\u002FEU) | EU\u002FEEA | Unique identifier + tamper-evident feature on each unit | Live since Feb 2019 |\n| DSCSA | USA | Electronic, interoperable tracing at package level | Full enforcement Nov 2024+ |\n| China NMPA | China | Unique drug traceability code per minimum saleable unit | Rolling |\n| Brazil ANVISA (SNCM) | Brazil | Serialisation of pharmaceuticals with IUM | Rolling |\n| Russia MDLP | Russia | Crypto-code per unit, mandatory scanning | Live |\n\nKey data elements per regulation:\n\n**EU FMD unique identifier (per Delegated Regulation 2016\u002F161):**\n- Product code (GTIN-14 from GS1)\n- Serial number (up to 20 alphanumeric characters, randomised)\n- Batch\u002Flot number\n- Expiry date\n\n**DSCSA transaction information:**\n- Product identifier (NDC\u002FGTIN, serial number, lot, expiry)\n- Transaction information (date, entities, shipment details)\n- Transaction history and transaction statement\n- Verification at package level\n\n**Got:** Clear understanding of which regulations apply to each product-market combination.\n**If fail:** Engage regulatory affairs to confirm market requirements before proceeding.\n\n### Step 2: Design the Serialisation Data Model\n\n```sql\n-- Core serialisation data model\nCREATE TABLE serial_numbers (\n    id BIGSERIAL PRIMARY KEY,\n    gtin VARCHAR(14) NOT NULL,          -- GS1 GTIN-14\n    serial_number VARCHAR(20) NOT NULL,  -- Unique per GTIN\n    batch_lot VARCHAR(20) NOT NULL,\n    expiry_date DATE NOT NULL,\n    status VARCHAR(20) DEFAULT 'ACTIVE', -- ACTIVE, DECOMMISSIONED, DISPENSED, etc.\n    created_at TIMESTAMPTZ DEFAULT NOW(),\n    UNIQUE(gtin, serial_number)\n);\n\n-- Aggregation hierarchy\nCREATE TABLE aggregation (\n    id BIGSERIAL PRIMARY KEY,\n    parent_code VARCHAR(50) NOT NULL,     -- SSCC or higher-level code\n    parent_level VARCHAR(10) NOT NULL,    -- CASE, PALLET, BUNDLE\n    child_code VARCHAR(50) NOT NULL,      -- GTIN+serial or child SSCC\n    child_level VARCHAR(10) NOT NULL,     -- UNIT, BUNDLE, CASE\n    aggregation_event_id UUID NOT NULL,\n    created_at TIMESTAMPTZ DEFAULT NOW()\n);\n\n-- EPCIS events\nCREATE TABLE epcis_events (\n    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n    event_type VARCHAR(30) NOT NULL,      -- ObjectEvent, AggregationEvent, TransactionEvent\n    action VARCHAR(10) NOT NULL,          -- ADD, OBSERVE, DELETE\n    biz_step VARCHAR(100),               -- urn:epcglobal:cbv:bizstep:commissioning\n    disposition VARCHAR(100),             -- urn:epcglobal:cbv:disp:active\n    read_point VARCHAR(100),             -- urn:epc:id:sgln:location\n    event_time TIMESTAMPTZ NOT NULL,\n    event_timezone VARCHAR(6) NOT NULL,\n    payload JSONB NOT NULL,\n    created_at TIMESTAMPTZ DEFAULT NOW()\n);\n```\n\nAggregation hierarchy:\n\n```\nPallet (SSCC)\n  └── Case (SSCC)\n       └── Bundle (GTIN + serial) [optional level]\n            └── Unit (GTIN + serial)\n```\n\n**Got:** Data model supports full pack hierarchy with EPCIS event tracking.\n**If fail:** If existing ERP schema conflicts, design an integration layer rather than modifying ERP directly.\n\n### Step 3: Implement Serial Number Generation\n\n```python\nimport secrets\nimport string\n\ndef generate_serial_number(length: int = 20, charset: str = None) -> str:\n    \"\"\"Generate a random serial number compliant with GS1 standards.\n\n    EU FMD requires randomised serial numbers to prevent prediction.\n    Max 20 characters, alphanumeric (GS1 Application Identifier 21).\n    \"\"\"\n    if charset is None:\n        # GS1 AI(21) allows: digits, uppercase, lowercase, and some special chars\n        # Most implementations use alphanumeric only for interoperability\n        charset = string.ascii_uppercase + string.digits\n    return ''.join(secrets.choice(charset) for _ in range(length))\n\n\ndef generate_serial_batch(gtin: str, batch_lot: str, expiry: str, count: int) -> list:\n    \"\"\"Generate a batch of unique serial numbers for a production run.\"\"\"\n    serials = set()\n    while len(serials) \u003C count:\n        serials.add(generate_serial_number())\n    return [\n        {\n            \"gtin\": gtin,\n            \"serial_number\": sn,\n            \"batch_lot\": batch_lot,\n            \"expiry_date\": expiry,\n            \"status\": \"COMMISSIONED\"\n        }\n        for sn in serials\n    ]\n```\n\n**Got:** Serial numbers are cryptographically random, unique per GTIN, and stored before printing.\n**If fail:** If a uniqueness collision occurs, regenerate the conflicting serial and log the event.\n\n### Step 4: Implement GS1 DataMatrix Encoding\n\nThe 2D DataMatrix barcode encodes the GS1 element string:\n\n```\n(01)GTIN(21)Serial(10)Batch(17)Expiry\n```\n\nExample:\n```\n(01)05012345678901(21)A1B2C3D4E5(10)LOT123(17)261231\n```\n\nWhere:\n- AI(01) = GTIN-14\n- AI(21) = Serial number\n- AI(10) = Batch\u002Flot number\n- AI(17) = Expiry date (YYMMDD)\n\nThe GS1 DataMatrix uses FNC1 as a separator (GS character, ASCII 29) between variable-length fields.\n\n```python\ndef encode_gs1_element_string(gtin: str, serial: str, batch: str, expiry: str) -> str:\n    \"\"\"Encode GS1 element string for DataMatrix printing.\n\n    FNC1 (GS character \\\\x1d) separates variable-length fields.\n    AI(01) and AI(17) are fixed length, so no separator needed after them.\n    AI(21) and AI(10) are variable length and need FNC1 terminator.\n    \"\"\"\n    GS = '\\x1d'  # GS1 FNC1 \u002F Group Separator\n    return f\"01{gtin}21{serial}{GS}10{batch}{GS}17{expiry}\"\n```\n\n**Got:** Encoded strings verified by scanning test prints with a GS1-certified verifier (ISO 15415 grade C or above).\n**If fail:** If scan verification fails, check print quality, quiet zones, and encoding order.\n\n### Step 5: Integrate with National Verification Systems\n\n#### EU FMD — EMVS\u002FNMVS Integration\n\n```\nMAH → Upload serial data → EU Hub → Distribute to National Systems (NMVS)\n                                      ├── Germany (securPharm)\n                                      ├── France (CTS)\n                                      ├── Italy (AIFA)\n                                      └── ... 31 markets\n```\n\nAPI operations:\n1. **Upload** (MAH → EU Hub): Batch upload of commissioned serial numbers\n2. **Verify** (Pharmacy → NMVS): Check serial status before dispensing\n3. **Decommission** (Pharmacy → NMVS): Mark as dispensed at point of sale\n4. **Reactivate** (MAH → NMVS): Reverse accidental decommission\n\n#### DSCSA — Verification Router Service\n\n```\nTrading Partner A → VRS Request → Verification Router → MAH's VRS → Response\n```\n\nImplement a VRS responder endpoint:\n\n```python\n# Simplified VRS endpoint (DSCSA verification)\nfrom fastapi import FastAPI, HTTPException\n\napp = FastAPI()\n\n@app.get(\"\u002Fverify\u002F{gtin}\u002F{serial}\u002F{lot}\u002F{expiry}\")\nasync def verify_product(gtin: str, serial: str, lot: str, expiry: str):\n    \"\"\"DSCSA product verification endpoint.\"\"\"\n    record = await lookup_serial(gtin, serial)\n    if record is None:\n        return {\"verified\": False, \"reason\": \"SERIAL_NOT_FOUND\"}\n    if record.batch_lot != lot or str(record.expiry_date) != expiry:\n        return {\"verified\": False, \"reason\": \"DATA_MISMATCH\"}\n    if record.status != \"ACTIVE\":\n        return {\"verified\": False, \"reason\": f\"STATUS_{record.status}\"}\n    return {\"verified\": True, \"status\": record.status}\n```\n\n**Got:** Verification endpoints respond within 1 second with correct status.\n**If fail:** If national system upload fails, retry with exponential backoff and alert operations.\n\n### Step 6: Implement EPCIS Event Capture\n\nRecord supply chain events in EPCIS 2.0 format:\n\n```json\n{\n  \"@context\": \"https:\u002F\u002Fref.gs1.org\u002Fstandards\u002Fepcis\u002F2.0.0\u002Fepcis-context.jsonld\",\n  \"type\": \"ObjectEvent\",\n  \"eventTime\": \"2025-03-15T10:30:00.000+01:00\",\n  \"eventTimeZoneOffset\": \"+01:00\",\n  \"epcList\": [\"urn:epc:id:sgtin:5012345.067890.A1B2C3D4E5\"],\n  \"action\": \"ADD\",\n  \"bizStep\": \"urn:epcglobal:cbv:bizstep:commissioning\",\n  \"disposition\": \"urn:epcglobal:cbv:disp:active\",\n  \"readPoint\": {\"id\": \"urn:epc:id:sgln:5012345.00001.0\"},\n  \"bizLocation\": {\"id\": \"urn:epc:id:sgln:5012345.00001.0\"}\n}\n```\n\nKey business steps in the pharma supply chain:\n- `commissioning` — serial number assigned to physical unit\n- `packing` — aggregation into cases\u002Fpallets\n- `shipping` — departure from a location\n- `receiving` — arrival at a location\n- `dispensing` — supplied to patient (decommission trigger)\n\n**Got:** Every status change generates an EPCIS event with correct timestamps and locations.\n**If fail:** Failed event capture must be queued and retried; never silently dropped.\n\n## Validation\n\n- [ ] Serial numbers are randomised and unique per GTIN\n- [ ] GS1 DataMatrix encoding verified by barcode scanner (ISO 15415 grade C+)\n- [ ] Aggregation hierarchy correctly links units → bundles → cases → pallets\n- [ ] National verification system integration tested (upload, verify, decommission)\n- [ ] EPCIS events captured for all business steps\n- [ ] Verification endpoint responds within 1 second\n- [ ] Exception handling covers upload failures, scan failures, and network errors\n\n## Pitfalls\n\n- **Sequential serial numbers**: EU FMD explicitly requires randomisation to prevent counterfeiting. Never use sequential numbering.\n- **Aggregation errors**: Disaggregation (breaking a case) must update the hierarchy. Shipping a case with wrong child associations causes verification failures downstream.\n- **Timezone handling**: EPCIS events must include timezone offset. Using local time without offset causes event ordering ambiguity across sites.\n- **Late uploads**: Serial data must be uploaded to national systems before product enters the supply chain. Late upload = product flagged as suspicious at pharmacy.\n- **Ignoring exceptions**: Legitimate products get flagged (false alerts) regularly. A process for investigating and resolving alerts is essential.\n\n## Related Skills\n\n- `perform-csv-assessment` — validate serialisation system as a computerised system\n- `conduct-gxp-audit` — audit serialisation processes\n- `implement-audit-trail` — audit trail for serialisation events\n- `serialize-data-formats` — general data serialisation (different domain, complementary concepts)\n- `design-serialization-schema` — schema design for data exchange formats\n",{"name":5,"locale":23,"license":14,"metadata":24,"translator":31,"description":32,"allowed-tools":33,"source_commit":34,"source_locale":35,"translation_date":36},"caveman-lite",{"tags":25,"author":26,"domain":27,"version":28,"language":29,"complexity":30},"serialisation, eu-fmd, dscsa, epcis, track-and-trace, pharma","Philipp Thoss","compliance","1.0","multi","advanced","Julius Brussee homage — caveman","Implement pharmaceutical serialisation and track-and-trace systems compliant with EU FMD, US DSCSA, and other global regulations. Covers unique identifier generation, aggregation hierarchy, EPCIS data exchange, and verification endpoint integration. Use when implementing serialisation for a new product launch, integrating with the EMVS\u002FNMVS, designing DSCSA-compliant transaction exchange, building an EPCIS event repository, or extending serialisation to additional markets (China, Brazil, Russia).\n","Read Write Edit Bash Grep Glob","82c77053","en","2026-04-24","master","f483e54f3ad5f202a77d45f2e57f8d970b71195f","skills_library\u002Fimplement-pharma-serialisation",2,"https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills","https:\u002F\u002Fgithub.com\u002Froohe","yoou.link","2026-05-19 15:56:07",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add roohe\u002Fagentic-super-skills --skill implement-pharma-serialisation",{"tool":51,"command":52},"bunx","bunx skills add roohe\u002Fagentic-super-skills --skill implement-pharma-serialisation",{"tool":54,"command":55},"pnpm","pnpm dlx skills add roohe\u002Fagentic-super-skills --skill implement-pharma-serialisation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fimplement-pharma-serialisation\u002FSKILL.md",true,[],[60,67,74,81,88,95],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M73D865CZME2FCMKA4PQM348","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M73D7Z64J4ABWZJD7P44XBBF","youtube-downloader","Download and process YouTube content for research. Use when: downloading competitor videos for analysis; extracting audio for podcasts; getting transcripts for content repurposing; archiving webinars; research content curation","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyoutube-downloader\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M73D7K8778TGZV3GJFR3703D","yc-pitch-deck","Create a compelling startup pitch deck that follows the structure proven to raise billions from top investors. Master the YC and Sequoia formats that get founders funded. Use when: **Fundraising** to create investor pitch decks; **YC application** to structure your narrative; **Demo Day prep** to craft your 2-minute pitch; **Angel investors** to communicate your opportunity; **Partnership pitches** to structure compelling asks","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyc-pitch-deck\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M73D70KJSE0E8Z28YMNNRT04","x-twitter-scraper","Use when the user needs X (Twitter) data or confirmation-gated X actions through Xquik: tweet search, user lookup, follower extraction, media download, monitoring, webhooks, MCP, SDKs, posting, likes, DMs, and profile updates. Requires a Xquik API key. Never ask for X login material.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fx-twitter-scraper\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M73D6ED01GV077R7K4NZNFZJ","write-vignette","Create R package vignettes using R Markdown or Quarto. Covers vignette setup, YAML configuration, code chunk options, building and testing, and CRAN requirements for vignettes. Use when adding a Getting Started tutorial, documenting complex workflows spanning multiple functions, creating domain-specific guides, or when CRAN submission requires user-facing documentation beyond function help pages.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-vignette\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M73D69YJR0BK3NFHE0CYG3EF","write-validation-documentation","Write IQ\u002FOQ\u002FPQ validation documentation for computerized systems in regulated environments. Covers protocols, reports, test scripts, deviation handling, and approval workflows. Use when validating R or other software for regulated use, preparing for a regulatory audit, documenting qualification of computing environments, or creating and updating validation protocols and reports for new or re-qualified systems.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-validation-documentation\u002FSKILL.md",[],[]]