Build / Web apps

Adjuster route planner

Sort a day's stops by county forecast status, worst first.

PythonBatch endpoint
Adjuster route planner: illustrative mockup with sample data
Example build (illustrative). Sample data, not a real product, not real results.

What it does

Send your list of stops (lat, lon) in one call. The API returns the current county forecast grade for each. Your code sorts so the riskiest sites come first.

  • Worst-first is a plain sort. Add your own travel-time logic on top.
  • Forecasts show what could happen, not what will.

API calls

Set your key once: export TFX_KEY=tfx_live_.... Free previews need no key.

Grade up to 500 locations in one call

request
curl -X POST -H "Authorization: Bearer $TFX_KEY" -H "Content-Type: application/json" -d '{"locations":[{"lat":30.27,"lon":-97.74,"label":"Stop 1"}],"window":"24h"}' https://data.truefixr.com/v1/portfolio/risk

Code (Python)

Cut down on purpose. Print the real response keys on your first call before you map fields.

route-planner.py
import os
import requests

URL = "https://data.truefixr.com/v1/portfolio/risk"
HEAD = {"Authorization": f"Bearer {os.environ['TFX_KEY']}"}
RANK = {"F": 0, "D": 1, "C": 2, "B": 3, "A": 4}  # worst first


def grade_stops(stops):
    body = {"locations": stops, "window": "24h"}
    r = requests.post(URL, json=body, headers=HEAD, timeout=60)
    r.raise_for_status()
    return r.json()


def order(stops, graded_rows):
    """graded_rows: list of dicts in the same order as stops, each with a 'grade' key.
    Check the real field names on your first response."""
    paired = list(zip(stops, graded_rows))
    paired.sort(key=lambda p: RANK.get(p[1].get("grade", "A"), 4))
    return [s for s, _ in paired]


if __name__ == "__main__":
    stops = [{"lat": 30.27, "lon": -97.74, "label": "Stop 1"}]
    print(grade_stops(stops))