-
Notifications
You must be signed in to change notification settings - Fork 52
Add EV mapping guide document #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
codealisha99
wants to merge
2
commits into
beckn:main
Choose a base branch
from
codealisha99:ev-mapping-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+139
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| # EV Charging Mapping (v2-rc → Beckn v2) | ||
|
|
||
| This document provides a mapping guide for Network Participants (NPs) migrating EV charging implementations from **v2-rc** to **Beckn v2** (Final). This guide is specifically designed for NPs using the **Universal Beckn Connector (UBC)**. | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Context | ||
|
|
||
| * **v2-rc**: An older release candidate version (often referred to as v1-EOS in some devkits) which used a flatter, tag-based structure for domain-specific data. | ||
| * **Beckn v2**: The final stable version that introduces **Global Semantic Interoperability** via JSON-LD, standardized prefixes (`beckn:`, `schema:`), and a modular "core + schema packs" model. | ||
|
|
||
| This document helps you migrate your payloads by providing direct field-to-field mappings and structural transformation examples. | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Key Changes (High-Level Summary) | ||
|
|
||
| * **Prefixing**: Almost all keys in v2 are prefixed (e.g., `id` → `beckn:id`, `name` → `schema:name`). | ||
| * **Structural Nesting**: Domain-specific attributes (like connector type or power) move from flat `tags` or `attributes` into a structured `beckn:itemAttributes` object. | ||
| * **JSON-LD Alignment**: Every major object now includes `@context` and `@type` for semantic clarity. | ||
| * **Standardized Formats**: Time and durations follow ISO 8601 (e.g., `PT30S`, `2024-01-15T10:30:00Z`). | ||
| * **GeoJSON Coordinates**: Location coordinates MUST be `[longitude, latitude]`. | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Field Mapping (Core Section) | ||
|
|
||
| ### A. Context Mapping | ||
| | v2-rc Field | Beckn v2 Field | Type/Format Change | Notes | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `domain` | `context.domain` | `beckn.one:deg:ev-charging:*` | Standardized domain string. | | ||
| | `version` | `context.version` | `2.0.0` | Update protocol version. | | ||
| | `timestamp` | `context.timestamp` | ISO 8601 DateTime | Ensure UTC (Z) suffix. | | ||
| | `ttl` | `context.ttl` | ISO 8601 Duration | e.g., `PT30S` for 30 seconds. | | ||
|
|
||
| ### B. Vehicle Details | ||
| These attributes define the vehicle types compatible with the charging service. | ||
|
|
||
| | v2-rc Field | Beckn v2 Field | Type/Format | Notes | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `vehicle-type` | `vehicleType` | `Enum (String)` | `2-WHEELER`, `3-WHEELER`, `4-WHEELER`. | | ||
|
|
||
| ### C. Charging Details | ||
| In v2, these reside inside `beckn:items[].beckn:itemAttributes`. | ||
|
|
||
| | v2-rc Field (Tags/Flat) | Beckn v2 Field | Type/Format | Notes | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `connector-type` | `connectorType` | `Enum (String)` | `CCS2`, `Type2`, `CHAdeMO`, `GB_T`. | | ||
| | `charger-type` | `powerType` | `Enum (String)` | `AC`, `DC` (or `AC_SINGLE_PHASE` etc). | | ||
| | `power-rating` | `maxPowerKW` | `Number` | Convert string "60kW" to number `60`. | | ||
| | `availability` | `stationStatus` | `Enum (String)` | `Available`, `Charging`, `Offline`. | | ||
| | `evse-id` | `evseId` | `String` | Standard OCPI/Hubject style. | | ||
| | `reservation-supported` | `reservationSupported` | `Boolean` | `true` or `false`. | | ||
|
|
||
| ### D. Location & Station Details | ||
| | v2-rc Field | Beckn v2 Field | Parent Object | Notes | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `gps` | `geo.coordinates` | `beckn:availableAt[]` | Array `[long, lat]`. NO comma string. | | ||
| | `address` | `address` | `beckn:availableAt[]` | Nested object (street, city, etc). | | ||
| | `station_id` | `chargingStation.id` | `beckn:itemAttributes` | Unique ID for the physical site. | | ||
|
|
||
| --- | ||
|
|
||
| ## 5. Example Transformation | ||
|
|
||
| ### v2-rc JSON (Before) | ||
| ```json | ||
| { | ||
| "context": { "domain": "ev-charging", "version": "1.1.0" }, | ||
| "message": { | ||
| "catalog": { | ||
| "items": [{ | ||
| "id": "charger-01", | ||
| "descriptor": { "name": "Fast Charger" }, | ||
| "gps": "12.9716, 77.5946", | ||
| "tags": [ | ||
| { "code": "connector-type", "value": "CCS2" }, | ||
| { "code": "power-rating", "value": "60kW" } | ||
| ] | ||
| }] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Beckn v2 JSON (After) | ||
| ```json | ||
| { | ||
| "context": { "domain": "beckn.one:deg:ev-charging:*", "version": "2.0.0" }, | ||
| "message": { | ||
| "catalogs": [{ | ||
| "beckn:items": [{ | ||
| "beckn:id": "charger-01", | ||
| "beckn:descriptor": { "schema:name": "Fast Charger" }, | ||
| "beckn:availableAt": [{ | ||
| "geo": { "type": "Point", "coordinates": [77.5946, 12.9716] } | ||
| }], | ||
| "beckn:itemAttributes": { | ||
| "@type": "ChargingService", | ||
| "connectorType": "CCS2", | ||
| "maxPowerKW": 60 | ||
| } | ||
| }] | ||
| }] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 6. Migration Steps | ||
|
|
||
| 1. **Identify Usage**: Search your codebase for manual payload construction (especially `tags` arrays). | ||
| 2. **Add Prefixes**: Update keys to include `beckn:` or `schema:` as per the v2 specification. | ||
| 3. **Nest Attributes**: Move EV-specific fields from flat tags into the `beckn:itemAttributes` block. | ||
| 4. **Format Data**: Convert numeric strings (e.g., "60kW") to numbers (`60`) and GPS strings to coordinate arrays. | ||
| 5. **Inject `@context`**: Ensure every major object has the required `@context` URL. | ||
| 6. **Validate**: Run your payload through the Beckn v2 validator or test against a v2-compliant UBC instance. | ||
|
|
||
| --- | ||
|
|
||
| ## 7. Deprecated / Removed Fields | ||
|
|
||
| | Old Field | Status | New Alternative | | ||
| | :--- | :--- | :--- | | ||
| | `gps` (String) | **REMOVED** | `geo.coordinates` (Array) | | ||
| | `tags` (Generic) | **DEPRECATED** | `beckn:itemAttributes` (Typed Object) | | ||
| | `images` (String) | **REPLACED** | `beckn:descriptor.schema:image` (Object/Array) | | ||
|
|
||
| --- | ||
|
|
||
| ## 8. Notes & Edge Cases | ||
|
|
||
| > [!IMPORTANT] | ||
| > **Coordinate Order**: Always use `[longitude, latitude]`. Swapping these will place your station in the wrong hemisphere! | ||
|
|
||
| * **Enums**: Values like `CCS2` are case-sensitive and must match the enum exactly. | ||
| * **Timezones**: Always use UTC for timestamps to prevent synchronization issues between BAP and BPP. | ||
| * **Number Precision**: Avoid sending numbers as strings. Use `60.5` instead of `"60.5"`. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @codealisha99 thanks for this.. unfortunately, this v2 payload seems to match v2-rc. The about to be released v2 (LTS) will change the payload yet again, but hopefully for long term stability. This ticket was meant to track ev charging migration to that beckn version.