Matching Eco-Movement's Data with Other Data Sources
Eco-Movement's data can be matched with data from other sources.
What Do You Need?
- Eco-Movement’s data and the data from the other source.
- One or more matching methods to help you match both data sources.
- The code logic to perform the comparison and matching.
Matching Methods
There are several ways to match the data from Eco-Movement Data API with other data sources.
Match Using OCPI EVSE ID
The response from the /location and /location/{id} endpoints usually contain the data.evses.evse_id
attribute for each EVSE in a location. It may not always be available, but when it is available you can use this attribute to compare and identify if two or more locations are the same.
This value is the unique ID of an EVSE for the outside world and is unique across all databases (compliant with "eMI3standard version V1.0"). Eco-Movement can also enable an extra feature for you which normalizes the value so that the separators (for example, *, -, etc.) are changed to an asterisk (*) for easy comparison and matching.
Match Using Original Location ID or EVSE UID
At Location Level
Each location has a unique ID in the system of the CPO, which is the original location ID. Eco-Movement can enable data.evses.cpo_external_id
attribute, which contains this unique, original location ID. You can use this attribute to compare and identify if two or more locations are the same.
This attribute is registered at location level in the system of the CPO, but Eco-Movement stores it at EVSE level. This is because we sometimes merge or split locations to improve the user experience.
As data.evses.cpo_external_id
is a custom Eco-Movement attribute, please contact your focal point at Eco-Movement to enable it.
At EVSE Level
The data.evses.uid
attribute is unique in the CPO's system for each EVSE, even though it is not unique in the responses from Eco-Movement Data API. You can use this attribute to compare and identify if two or more locations are the same at the EVSE level.
Match Using EVSE Endpoint
If the OCPI EVSE ID is available from another data source, you can use it to retrieve location details with our /evse endpoint. This value is the unique ID of an EVSE for the outside world and is unique across all databases (compliant with "eMI3standard version V1.0"). Therefore, you can use it to compare and identify if two or more locations are the same.
The endpoint also accepts normalized values, so you can remove the separators (for example, *, -, etc.) when calling the endpoint during comparison.
Match Using E-Mobility Account Identifier (eMA ID)
Eco-Movement can send eMA IDs for a location’s operator and also for the location’s owner, suboperator, and payment providers (roaming partners). We create eMA IDs by combining the country code where the charging station is located, and the party id of the operator. For example, NL-ECO
. You can use these eMA IDs to compare and identify if two or more locations are the same.
Note
A location’s operator, owner, suboperator, and payment providers can have multiple eMA IDs due to acquisitions. For example, if a company named 'Example Company A' acquired 'Example Company B' and operates the charging stations of Example Company B, then we map Example Company B's eMA IDs to Example Company A's eMA IDs.
eMA IDs are sent using data.operator.ema_id
, data.owner.ema_id
, data.suboperator.ema_id
, and data.roaming.ema_id
attributes. As these are custom Eco-Movement attributes, please contact your focal point at Eco-Movement to enable them.
Examples
The following examples help you get started with comparison and matching using one of the explained matching methods. You can further customize these examples based on the data you have.
Example 1: Using Original Location ID, EVSE UID, or OCPI EVSE ID
import requests
headers = {'Authorization': 'Token DG5rv4GfXMCK06EH9Bjq0WbAr2LhTmGtUha3rWaMYzbJKnsr'}
# Retrieve locations data
response = requests.get('https://api.eco-movement.com/api/ocpi/cpo/2.1.1/locations', headers=headers)
data = response.json()['data']
# Retrieve the ids used for matching
location_ids_em = {}
evse_uids_em = {}
evse_ids_em = {}
for location in data:
for evse in location['evses']:
location_ids_em[evse['cpo_external_id']] = location['id']
evse_uids_em[evse['uid']] = location['id']
evse_ids_em[evse['evse_id']] = location['id']
# Match location id
location_id = '50198'
if location_id in location_ids_em:
matched_location = location_ids_em[location_id]
print("Found matching location for location_id " + location_id + ": " + matched_location)
else:
print("Found no match for location_id: " + location_id)
# Match evse uid
evse_uid = '5002817'
if evse_uid in evse_uids_em:
matched_location = evse_uids_em[evse_uid]
print("Found matching location for evse_uid " + evse_uid + ": " + matched_location)
else:
print("Found no match for evse_uid: " + evse_uid)
# Match evse id
evse_id = 'CHFASE4140208'
if evse_id in evse_ids_em:
matched_location = evse_ids_em[evse_id]
print("Found matching location for evse_id " + evse_id + ": " + matched_location)
else:
print("Found no match for evse_id: " + evse_id)
Example 2: Using EVSE Endpoint
import requests
headers = {'Authorization': 'Token DG5rv4GfXMCK06EH9Bjq0WbAr2LhTmGtUha3rWaMYzbJKnsr'}
# Add evse_ids to match
evse_ids = [
'CHFASE4140208',
'CHFASE4140206',
'unknownid'
]
for evse_id in evse_ids:
# Call the evse endpoint
response = requests.get('https://api.eco-movement.com/api/ocpi/cpo/2.1.1/evse/' + evse_id, headers=headers)
data = response.json()['data']
# Check the JSON response for matches
if 'data' in data:
print("Found matched location for evse_id " + evse_id + ": " + response['data']['id'])
else:
print('Could not find match for ' + evse_id)
Example 3: Using eMA ID
import requests
headers = {'Authorization': 'Token DG5rv4GfXMCK06EH9Bjq0WbAr2LhTmGtUha3rWaMYzbJKnsr'}
# Retrieve locations data
response = requests.get('https://api.eco-movement.com/api/ocpi/cpo/2.1.1/locations', headers=headers)
data = response.json()['data']
ema_id = 'CH-FAS'
# Add ema_id to operator of one of the locations as example
data[2]['operator']['ema_id'] = [ema_id]
locations_matching_ema_id = []
for location in data:
# check if operator and ema_id are set in location
if 'operator' in location and 'ema_id' in location['operator']:
if ema_id in location['operator']['ema_id']:
locations_matching_ema_id.append(location)
print('Number of locations with ema_id ' + ema_id + ": " + str(len(locations_matching_ema_id)))
Updated 10 months ago