Skip to main content
Loading navigation

Build a FormSG Chemical Compatibility and OpenAttestation Staging Receipt Issuer — implementation

Prompt source

implementation63 lines11 sectionsNo variables1 code block
## Build
Process chemical cargo declarations submitted via FormSG against Singapore dangerous goods segregation rules. Issue OpenAttestation verified warehouse yard staging receipts indicating designated isolation bays and safe storage compliance.

## User
Warehouse hazardous materials compliance officer

## Workflow
1. Receive hazardous chemical cargo declarations and UN classification details via FormSG webhook payloads.
2. Evaluate cargo compatibility against rigorous dangerous goods segregation matrices using structural reasoning tools.
3. Allocate specific warehouse quarantine or staging bays based on identified safety buffer requirements.
4. Generate and cryptographically issue an OpenAttestation wrapped staging receipt for compliant chemical storage.

## Interface
Warehouse bay allocation grid with OpenAttestation receipt generation panel, highlighting chemical compatibility warnings.

## Data
Mock FormSG webhook payloads with chemical properties; standard IMO dangerous goods segregation tables.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Singapore government FormSG](https://raw.githubusercontent.com/opengovsg/FormSG/develop/README.md)
Utilizes FormSG webhook payloads to ingest structured chemical storage requests for downstream staging verification.

## Tools
pydantic-ai, fastapi, open-attestation.
Pydantic AI enables type-safe tool calling to validate hazardous goods matrix rules and construct verifiable OpenAttestation schema payloads.
Reasoning model capable of strict schema adherence to evaluate dangerous goods matrices.

## 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
- Validates chemical classes and flashpoint requirements from FormSG inputs.
- Correctly denies storage for incompatible chemical classes.
- Produces a valid OpenAttestation schema JSON staging receipt upon successful bay allocation.

## Starter Examples
```json
[
  {
    "input": {
      "intake_submission_id": "DG-882",
      "un_number": "UN1203",
      "hazard_class": "3",
      "adjacent_assigned_class": "5.1"
    },
    "expected_output": {
      "segregation_check": "INCOMPATIBLE_HAZARD",
      "violation_reason": "Class 3 Flammable Liquid cannot be stored adjacent to Class 5.1 Oxidizing Substances",
      "attestation_issued": false,
      "record_type": "Simplified synthetic app record"
    }
  },
  {
    "input": {
      "intake_submission_id": "DG-883",
      "un_number": "UN1993",
      "hazard_class": "3",
      "adjacent_assigned_class": "3"
    },
    "expected_output": {
      "segregation_check": "COMPATIBLE",
      "violation_reason": null,
      "attestation_issued": true,
      "record_type": "Simplified synthetic app record"
    }
  }
]
```

## Safety
Produces simulated receipts and staging plans; requires human oversight and does not automate physical facility interlocks.
Use mock external writes. Require human review before any real deployment.