Skip to main content
Loading navigation
Back to prompt library

Build a Verified Document Sharing and Expiry Tracking Platform — implementation

Linked challenge: Build a Verified Document Sharing and Expiry Tracking Platform

Prompt source

implementation96 lines11 sectionsNo variables1 code block
## Build
Verify digital trade credentials and dangerous goods permits using OpenAttestation schemas. Track expiry horizons and construct redacted credential packages for downstream port authorities.

## User
Logistics Compliance Officer

## Workflow
1. Ingest digital trade credential JSON submittals against OpenAttestation schema rules.
2. Evaluate document expiration timestamps against current system date.
3. Obfuscate sensitive commercial pricing fields using OpenAttestation cryptographic field masking.
4. Generate structured compliance notifications and dispatch renewal alerts to freight forwarders.

## Interface
React dashboard displaying document validity status, days remaining before expiry, and one-click selective redaction toggles.

## Data
Simulate OpenAttestation v2 JSON documents using the open-attestation CLI mock templates. No paid API keys or blockchain deployment needed.
Starter examples below are synthetic. They are not downloaded records.

## Source
[OpenAttestation](https://raw.githubusercontent.com/Open-Attestation/open-attestation/master/README.md)
Utilizes OpenAttestation schema 2.0 validation, wrapDocuments Merkle hashing, and obfuscateDocument field masking methods.

## Tools
pydantic-ai, fastapi, open-attestation.
Pydantic AI provides strict schema-enforced validation for structured attestation payloads and credential metadata.
Local lightweight model or hosted API for drafting plain-English renewal notices to suppliers.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Validate input documents using official @govtechsg/open-attestation schema 2.0 schemas.
- Generate selective disclosure redacted documents using OpenAttestation obfuscateDocument.
- Flag expiring documents within a configurable 30-day lookahead window.
- Render an interactive queue for compliance officers to dispatch renewal alerts.

## Starter Examples
```json
[
  {
    "input": {
      "current_date": "2025-03-01",
      "document": {
        "$template": {
          "name": "DG_PERMIT",
          "type": "EMBEDDED_RENDERER",
          "url": "https://localhost:3000/renderer"
        },
        "expiryDate": "2025-03-15",
        "id": "SGP-DG-9021",
        "issuers": [
          {
            "identityProof": {
              "location": "tradetrust.io",
              "type": "DNS-TXT"
            },
            "name": "MPA Store",
            "tokenRegistry": "0x9178F546D3FF57D7A6352bD61B80cCCD46199C2d"
          }
        ],
        "permitClass": "Class 3 Flammable",
        "recipient": {
          "name": "Apex Logistics SG"
        }
      }
    },
    "expected_output": {
      "actions": [
        "TRIGGER_RENEWAL_NOTICE",
        "OBFUSCATE_CONFIDENTIAL_FIELDS"
      ],
      "days_to_expiry": 14,
      "document_id": "SGP-DG-9021",
      "is_valid_schema": true,
      "redacted_fields": [
        "recipient.name"
      ],
      "status": "EXPIRING_SOON"
    }
  },
  {
    "input": {
      "current_date": "2025-03-01",
      "document": {
        "id": "SGP-DG-0001",
        "issuers": []
      }
    },
    "expected_output": {
      "actions": [
        "REJECT_INVALID_SCHEMA"
      ],
      "days_to_expiry": null,
      "document_id": "SGP-DG-0001",
      "is_valid_schema": false,
      "redacted_fields": [],
      "status": "MALFORMED"
    }
  }
]
```

## Safety
Documents and cryptographic hashes are processed in local memory; no actual private keys or live blockchain contracts are modified.
Use mock external writes. Require human review before any real deployment.