Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions docs/mapping/chargecloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Chargecloud Mapping

This documents the input data model from Chargecloud and the mapping to
[OCPI 2.2.1 Locations / EVSEs / Connectors](https://github.com/ocpi/ocpi/blob/release-2.2.1-bugfixes/mod_locations.asciidoc#131-location-object). It is an extension to the `_general.md`, for global mapping
decisions, please have a look at the general document.

Chargecloud data uses some fields from OCPI, but adds several further fields. It also supports `null` as unset
value.

## Source Location

| Field | Type | Cardinality | Mapping | Comment |
|---------------|---------------------------------------------------------|-------------|------------------------|-------------------------------------------------------------------------|
| id | string | 1 | location.id | |
| name | string | 1 | location.name | |
| status | [ChargecloudLocationStatus](#ChargecloudLocationStatus) | 1 | | |
| address | string | 1 | location.address | |
| city | string | 1 | location.city | |
| postal_code | string | 1 | location.postal_code | |
| country | string | 1 | location.country | Transformation from 2 digit language code to OCPI 3 digit language code |
| directions | string | 1 | location.directions | Transformation to OCPI `DisplayText` with language DE |
| comment | string | 1 | | |
| coordinates | [ChargecloudCoordinates](#ChargecloudCoordinates) | 1 | location.coordinates | |
| distance_in_m | integer as string | 1 | | |
| operator | [ChargecloudBusiness](#ChargecloudBusiness) | 1 | location.operator | |
| opening_times | [ChargecloudOpeningTimes](#ChargecloudOpeningTimes) | 1 | location.opening_times | |
| owner | [ChargecloudBusiness](#ChargecloudBusiness) | ? | location.owner | Always null in our dataset |
| roaming | boolean | 1 | | |
| evses | [ChargecloudEvse](#ChargecloudEvse) | * | location.evse | |


#### ChargecloudLocationStatus

| Key | Mapping |
|-----------|---------|
| active | |

In our example data, no other value then `active` is set.


### ChargecloudCoordinates

| Field | Type | Cardinality | Mapping |
|-----------|-------------|-------------|--------------------------------|
| latitude | string | 1 | location.coordinates.latitude |
| longitude | string | 1 | location.coordinates.longitude |


### ChargecloudBusiness

| Field | Type | Cardinality | Mapping |
|------------|--------|-------------|---------------|
| operatorId | string | 1 | |
| name | string | 1 | business.name |
| hotline | string | 1 | |


### ChargecloudOpeningTimes

| Field | Type | Cardinality | Mapping |
|-----------------|---------|-------------|----------------------------------------|
| twentyfourseven | boolean | 1 | location.opening_times.twentyfourseven |

In our example data, no other opening time representation then `twentyfourseven: true` is set.


## ChargecloudEvse

| Field | Type | Cardinality | Mapping |
|--------------------------------|---------------------------------------------------|-------------|-------------------------|
| uid | string | 1 | evse.uid |
| id | string | 1 | evse.evse_id |
| status | EvseStatus | 1 | evse.status |
| reservable | boolean | 1 | |
| capabilities | EvseCapability | * | evse.capabilities |
| physical_reference | string | 1 | evse.physical_reference |
| floor_level | boolean | 1 | evse.floor_level |
| vehicle_type | [ChargecloudVehicleType](#ChargecloudVehicleType) | 1 | |
| chargePointPosition | ? | ? | |
| chargePointPublicComment | ? | ? | |
| chargePointParkingSpaceNumbers | string | ? | |
| chargingStationPosition | string | ? | |
| roaming | boolean | 1 | |
| connectors | [ChargecloudConnector](#ChargecloudConnector) | * | evse.connectors |


### ChargecloudVehicleType

| Key | Mapping |
|---------------|---------|
| four_wheeled | |

In our example data, no other value then `four_wheeled` is set.


## ChargecloudConnector

| Field | Type | Cardinality | Mapping | Comment |
|--------------|--------------------|-------------|------------------------------|-----------------------------------------------------|
| id | string | 1 | connector.id | |
| status | EvseStatus | 1 | | |
| standard | ConnectorStandard | 1 | connector.standard | |
| format | ConnectorFormat | 1 | connector.format | |
| power_type | ConnectorPowerType | 1 | connector.power_type | |
| ampere | integer as string | 1 | connector.max_amperage | |
| voltage | integer as string | 1 | connector.max_voltage | |
| max_power | integer | 1 | connector.max_electric_power | Unit is kW and has to be transformed in Wh for OCPI |
| tariff_id | Coordinates | ? | | |
106 changes: 0 additions & 106 deletions docs/mapping/sw_stuttgart.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from webapp.common.sqlalchemy import SQLAlchemy
from webapp.dependencies import dependencies
from webapp.models import Connector, Evse, Location
from webapp.services.import_services.ocpi.sw_stuttgart import SWStuttgartImportService
from webapp.services.import_services.ocpi.chargecloud.sw_stuttgart import SWStuttgartImportService


def test_sw_stuttgart_import(db: SQLAlchemy, requests_mock: Mocker) -> None:
Expand All @@ -45,7 +45,7 @@ def test_sw_stuttgart_import(db: SQLAlchemy, requests_mock: Mocker) -> None:

# define mocked response
requests_mock.get(
'mock://sw-stuttgart/SW-Stuttgart',
'mock://sw-stuttgart',
status_code=200,
json=sw_stuttgart_response_json,
)
Expand Down
1 change: 1 addition & 0 deletions webapp/common/remote_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class RemoteServerType(Enum):
OCHP_ALBWERK = 'OCHP_ALBWERK'
STADTNAVI = 'STADTNAVI'
SW_STUTTGART = 'SW_STUTTGART'
PFORZHEIM = 'PFORZHEIM'


@dataclass
Expand Down
6 changes: 5 additions & 1 deletion webapp/services/import_services/import_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
from webapp.services.import_services.giroe import GiroeImportService
from webapp.services.import_services.ochp.albwerk import AlbwerkOchpImportService
from webapp.services.import_services.ochp.ladenetz import LadenetzOchpImportService
from webapp.services.import_services.ocpi.chargecloud.pforzheim import PforzheimImportService
from webapp.services.import_services.ocpi.chargecloud.sw_stuttgart import SWStuttgartImportService
from webapp.services.import_services.ocpi.stadtnavi.stadtnavi_service import StadtnaviImportService
from webapp.services.import_services.ocpi.sw_stuttgart.sw_stuttgart_service import SWStuttgartImportService


class ImportServices(BaseService):
Expand All @@ -46,6 +47,7 @@ class ImportServices(BaseService):
giroe_import_service: GiroeImportService
stadtnavi_import_service: StadtnaviImportService
sw_stuttgart_import_service: SWStuttgartImportService
pforzheim_import_service: PforzheimImportService

importer_by_uid: dict[str, BaseImportService]

Expand Down Expand Up @@ -82,6 +84,7 @@ def __init__(
self.ladenetz_ochp_import_service = LadenetzOchpImportService(**kwargs, **default_dependencies)
self.stadtnavi_import_service = StadtnaviImportService(**kwargs, **default_dependencies)
self.sw_stuttgart_import_service = SWStuttgartImportService(**kwargs, **default_dependencies)
self.pforzheim_import_service = PforzheimImportService(**kwargs, **default_dependencies)

self.importer_by_uid = {
self.bnetza_import_service.source_info.uid: self.bnetza_import_service,
Expand All @@ -91,6 +94,7 @@ def __init__(
self.ladenetz_ochp_import_service.source_info.uid: self.ladenetz_ochp_import_service,
self.stadtnavi_import_service.source_info.uid: self.stadtnavi_import_service,
self.sw_stuttgart_import_service.source_info.uid: self.sw_stuttgart_import_service,
self.pforzheim_import_service.source_info.uid: self.pforzheim_import_service,
}

def fetch_sources(self) -> None:
Expand Down
Loading