Recipes/Energy/stateful
durable operation2–3 hr5 stages8 code languages

Operating journey: Restore the grid from alarm to verified service

Faster, safer restoration with an explainable view of affected assets, customers, crews, and residual risk.

The real-world moment

A monsoon storm trips feeders across two districts while flood exposure changes road access by the minute. Grid operations must correlate alarms against an exact network version, estimate affected service points, obtain an independently approved switching plan, dispatch capable crews, preserve every field observation, and avoid declaring restoration until telemetry and customer-impact evidence converge.

Make ownership visible before code.

Operate the full lifecycle with versioned state, hostile-path recovery, audit, and release evidence.

Application state
stateful
Planning calls
0
Credentials accepted
No
Write authority
None
01
Network and hazard authority

Version the network and hazard context

The utility system of record owns assets, connectivity, protection settings, switching authority and customer-service relationships; versioned mGIS layers add terrain, flood, access and vegetation context without replacing that authority.

Grid asset ↔ topology/configuration version, owner and safety class

GETRouting API/{REST_KEY}/{resources}/{profile}/{geopositions}This is a supporting operation from the selected product stack, not proof of an exact provider contract for this stage. Resolve the stage through its product source or adapter boundary before live implementation.

Record stage 1 with the application identity, source fingerprint, request or aggregate identity, timestamp, and observable outcome.

Many alarms collapse onto the wrong feeder

Retain each source alarm, topology version and correlation reason; require operator correction and create a new incident revision rather than rewriting prior evidence.

02
Outage correlation

Correlate alarms into bounded outage incidents

Append-only alarms and calls map to exact network versions and form bounded incidents under a versioned correlation rule with operator correction.

Record stage 2 with the application identity, source fingerprint, request or aggregate identity, timestamp, and observable outcome.

A road route crosses a newly flooded segment

Append the hazard revision, invalidate the route identity, keep the switching plan separate, and require dispatch to approve a safe replacement.

03
Switching and dispatch

Approve a switching and crew plan

An application-owned plan separates electrical safety approval from skill-, equipment- and ETA-aware Workmate assignments; no map or route result authorizes switching.

Switching plan ↔ exact assets, sequence, approver, version and expiry

GETTo get the list of tasks and their details/tasksThis normalized operation matches the stage intent and remains subject to its source, lifecycle, authentication, entitlement, host, and regional gates.

Record stage 3 with the application identity, source fingerprint, request or aggregate identity, timestamp, and observable outcome.

Crew completion arrives before telemetry recovery

Keep the task evidence complete but the outage in reconciliation; query authoritative device and customer-impact sources before closure.

04
Field execution

Guide crews and capture field evidence

Offline-safe tasks, route evidence, asset identity, observations and proof submissions preserve stable command IDs, expected versions and event/receipt time.

Crew task ↔ eligibility snapshot, route evidence, provider identity and proof

GETTo get the list of tasks and their details/tasksThis normalized operation matches the stage intent and remains subject to its source, lifecycle, authentication, entitlement, host, and regional gates.

Record stage 4 with the application identity, source fingerprint, request or aggregate identity, timestamp, and observable outcome.

Many alarms collapse onto the wrong feeder

Retain each source alarm, topology version and correlation reason; require operator correction and create a new incident revision rather than rewriting prior evidence.

05
Restoration reconciliation

Reconcile telemetry, customer impact, and restoration

Closure requires authoritative device state, switching completion, crew evidence and customer-impact recovery; mismatches remain an owned exception.

Restoration ↔ telemetry, customer-impact and operator reconciliation evidence

GETTo get the list of tasks and their details/tasksThis is a supporting operation from the selected product stack, not proof of an exact provider contract for this stage. Resolve the stage through its product source or adapter boundary before live implementation.

Record stage 5 with the application identity, source fingerprint, request or aggregate identity, timestamp, and observable outcome.

A road route crosses a newly flooded segment

Append the hazard revision, invalidate the route identity, keep the switching plan separate, and require dispatch to approve a safe replacement.

Edit once. Generate eight trusted-runtime implementations.

The recipe starts from the normalized GET /alarm/alarmLog/ contract. Execute six deterministic fixture outcomes before an issued account is involved.

Local request composerCode stays local · fixtures are explicit
GETRequest inputs
4 editable · 0 protected
Generated in eight languages
Environment-backed credentials
GEThttps://intouch.mapmyindia.com/iot/api/alarm/alarmLog/?deviceId=1909%2C2545&alarmType=21%2C26&startTime=1700000000000&endTime=1700000000000
Credential-free sandboxExecute this contract without a provider call
How fixtures work
Generated from your inputs
curl --request GET \
  --url 'https://intouch.mapmyindia.com/iot/api/alarm/alarmLog/?deviceId=1909%2C2545&alarmType=21%2C26&startTime=1700000000000&endTime=1700000000000' \
  --header "Accept: application/json" \
  --header "Authorization: Bearer ${MAPPLS_INTOUCH_TOKEN}"

Credential-safe by constructionSet MAPPLS_INTOUCH_TOKEN only in your trusted runtime. Code generation stays local. Sandbox execution sends only bounded fixture inputs to this developer platform and never reads a credential or calls Mappls.

Break the journey before customers do.

These controls are required at this operating depth; deeper recipes add durable truth rather than merely more API calls.

Idempotent commandsOptimistic aggregate versionsEvent and receipt timeTransactional outboxUnknown-outcome reconciliationIndependent human decisionsRestart recoveryImmutable audit evidence

Definition of done

Every aggregate has an invariant, expected version, stable command identity, and attributable actor.

Duplicate, late, reordered, invalid, stale, timed-out, and restarted execution preserve one durable truth.

Unknown provider outcomes reconcile by original identity before replay or compensation.

Terminal decisions, human review, audit, outbox delivery, privacy, retention, and rollback remain independently evidenced.

Contracts, tutorials, and journeys stay linked.

Contract set

GETGets The List Of Alarm Config(s)/alarm/alarmLog/GETTo get the list of tasks and their details/tasksGETRouting API/{REST_KEY}/{resources}/{profile}/{geopositions}GETThis API will get all the alarm configurations for a user./alarmGETTo get all your client details/clientsGETDistance Matrix Predictive ETA API/{REST_KEY}/distance_matrix_predictive/driving/{coordinates}GETGets The List Of Alarm Config(s)/alarms/alarmlogs/GETTo get the list of client category in an account/configurations/categoriesGETRouting API with driving profile/{REST_KEY}/{resources}/driving/{geopositions}GETThis API will get all the alarm configurations for a user./alarmsGETTo get the form's Id and their details from your account./configurations/formsGETDistance Matrix API/{rest-key}/{resources}/{profile}/{geopositions}

Durable state machines

statefulField-service task lifecycle8 states · 8 transitionsstatefulConnected fleet trip6 states · 7 transitionsstatefulFleet geofence exception6 states · 5 transitionsstatefulCoordinated incident response7 states · 8 transitionshybridRecoverable navigation session6 states · 6 transitionshybridGoverned spatial analysis7 states · 6 transitionshybridDurable multi-stop itinerary6 states · 9 transitionshybridiOS direction planning and navigation handoff8 states · 8 transitionshybridiOS geofence draft and publication boundary6 states · 6 transitionshybridiOS feedback report and review9 states · 9 transitionshybridConsent-bound location capture evidence8 states · 9 transitionsstatefulGoverned place contribution and publication7 states · 8 transitions

Grid Restoration Desk

Correlate an outage, govern independent switching approval, dispatch an assigned crew, preserve rework, and reconcile restoration from telemetry and customer-impact evidence.

Source-grounded, not authority-granting

This recipe composes source-derived contracts, application architecture, fixtures, and maintained learning evidence. It does not prove package availability, provider payload shape, account entitlement, regional behavior, production compatibility, or release approval.