# if.api demo — Geocoder.ca adapter (receipt-backed)

**Audience:** external reviewers + operators  
**Reality gate:** demo of a single live geocoder.ca call, not a deployed integration.

---

## Links (HTML-first)

if.trace receipt:
https://infrafabric.io/static/trace/7yAj1YtQDPn6pVEncpmkLQ

Pack (HTML view):
https://infrafabric.io/static/pack/7yAj1YtQDPn6pVEncpmkLQ

Pack (raw Markdown):
https://infrafabric.io/static/pack/7yAj1YtQDPn6pVEncpmkLQ.md

Source bundle (tgz):
https://infrafabric.io/static/source/7dbac6f467087ac2b930cf7d16a60781b2fc49907b2f982ec85bd0261e5e2420.tgz

---

## What this proves (black/white)

This demo proves:
- the adapter can format a geocoder.ca request and capture the response bytes
- the output bytes are bound to an if.trace receipt (hash checks)

This demo does not prove:
- coverage, accuracy, or stability of geocoder.ca responses
- a production integration or any deployed if.bus runtime

---

## Demo artifacts

Source bundle sha256 (tgz):

    7dbac6f467087ac2b930cf7d16a60781b2fc49907b2f982ec85bd0261e5e2420

Input JSON sha256:

    6f6951d0f63388a12e60f31c8ba59e85b4f21576c61a00de705e747b63082f35

Output JSON sha256:

    ebb170f717b28a1d206065bc4c538ae3b30543378726834237f29ca75b4754a4

---

## How to reproduce (no internal access)

```bash
curl -fsSL -o if-api-geocoder-ca-demo-source.tgz "https://infrafabric.io/static/source/7dbac6f467087ac2b930cf7d16a60781b2fc49907b2f982ec85bd0261e5e2420.tgz"
sha256sum if-api-geocoder-ca-demo-source.tgz

tar -xzf if-api-geocoder-ca-demo-source.tgz
python3 if_api_geocoder_ca_adapter.py \
  --allow-no-auth \
  --pretty \
  geocode \
  --locate "Montreal, QC, Canada" \
  > geocoder_output.json
sha256sum geocoder_output.json
```

Expected `sha256sum` (source bundle):

    7dbac6f467087ac2b930cf7d16a60781b2fc49907b2f982ec85bd0261e5e2420  if-api-geocoder-ca-demo-source.tgz

Note: geocoder.ca responses can change; a fresh run may not match the stored output hash.

---

## Output (adapter response envelope)

```json
{
  "adapter_id": "geocoder.ca",
  "attribution": {
    "html": "<a href=\"https://geocoder.ca\">Geocoding provided by GeoCoder.ca</a>",
    "required": true,
    "text": "Geocoding provided by GeoCoder.ca",
    "url": "https://geocoder.ca"
  },
  "cache": {
    "hit": false,
    "key": "2294c76c811e769acbd45cd51131d104ea84f875",
    "path": "/root/tmp/if_api_geocoder_ca_cache/2294c76c811e769acbd45cd51131d104ea84f875.json"
  },
  "endpoint": "geocode",
  "request": {
    "params": {
      "geoit": "xml",
      "json": "1",
      "locate": "Montreal, QC, Canada"
    },
    "url": "https://geocoder.ca/?locate=Montreal%2C+QC%2C+Canada&geoit=xml&json=1"
  },
  "requested_at": "2026-02-03T19:15:14Z",
  "response": {
    "body_json": {
      "Dissemination_Area": {
        "adauid": "24660125",
        "dauid": "24661537"
      },
      "latt": "45.528325",
      "longt": "-73.629251",
      "postal": "H2X0A4",
      "standard": {
        "city": "Montreal",
        "confidence": "0.1",
        "prov": "QC",
        "staddress": {},
        "stnumber": "1"
      }
    },
    "body_sha256": "c86d5f0799c4b62bf7f5c8125ea7c44cadc3e80d66b9207d600e88d4daaeedd8",
    "body_text": null,
    "error": null,
    "status": 200
  }
}
```
