Skip to main content
Loading navigation
Back to prompt library

Build an Offline-First Multilingual Stock Catalog Sync for Rural Retailers — implementation

Linked challenge: Build an Offline-First Multilingual Stock Catalog Sync for Rural Retailers

Prompt source

implementation73 lines11 sectionsNo variables1 code block
## Build
Cache local merchant inventory changes during network outages and synchronize catalog diffs when connectivity resumes. Translate informal item names into standardized vernacular product cards for decentralized marketplaces.

## User
Rural retail operations coordinator

## Workflow
1. Store locally captured product adjustments in an offline SQLite store using normalized Beckn item schemas.
2. Detect network availability and queue outgoing catalog changes with optimistic conflict resolution.
3. Translate vernacular product names and unit descriptions using ISO-639 language-tagged translation fixtures.
4. Assemble synchronization manifests and alert merchants to conflicting quantity updates for manual sign-off.

## Interface
Progressive Web App with offline local storage indicators, pending sync badges, and conflict review panels.

## Data
Generate local SQLite mock inventory records and synthetic multilingual text pairs covering Hindi, Tamil, and English.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Bhashini documentation](https://bhashini.gitbook.io/bhashini-apis)
Adopts Bhashini ISO-639 language code standards and translation pipeline concepts for vernacular catalog representations.

## Tools
ollama, sqlite3, pydantic.
Enables completely local, offline execution of small models for on-device product attribute extraction.
Quantized 7B parameter open-weights model running locally via Ollama without cloud internet dependencies.

## 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
- Persists inventory updates locally when simulated connectivity is toggled off.
- Formats synced catalog diffs using standard Beckn context and catalog item structures.
- Flags dual-write stock quantity conflicts without automatically overwriting remote entries.

## Starter Examples
```json
[
  {
    "input": {
      "device_id": "POS-DEV-01",
      "offline_mutation": {
        "item_id": "PROD-882",
        "vernacular_name": "चावल बासमती",
        "language_code": "hi",
        "quantity_change": -10,
        "timestamp": "2023-10-24T10:15:00Z"
      },
      "server_stock": 50
    },
    "expected_output": {
      "sync_status": "ready_to_commit",
      "standard_title": "Basmati Rice",
      "new_stock_level": 40,
      "conflict_detected": false
    }
  },
  {
    "input": {
      "device_id": "POS-DEV-01",
      "offline_mutation": {
        "item_id": "PROD-882",
        "vernacular_name": "चावल बासमती",
        "language_code": "hi",
        "quantity_change": -60,
        "timestamp": "2023-10-24T10:30:00Z"
      },
      "server_stock": 50
    },
    "expected_output": {
      "sync_status": "conflict_held",
      "standard_title": "Basmati Rice",
      "new_stock_level": 50,
      "conflict_detected": true
    }
  }
]
```

## Safety
Maintains an offline sandboxed ledger without accessing sensitive identity stores or live external inventory mainframes.
Use mock external writes. Require human review before any real deployment.