Open sjdonado opened 1 year ago
The approach sending operatorId
filtered by countries is not possible. Although the documentation shows that it is a valid property:
It is null
for almost all of them:
I'll try with countryid
+ dataproviderid
.
poiListSnapshots
+ pois
documents.export const POI_LIST_CHUNK_SIZE = 1000;
export const POI_LIST_MAX_RESULTS = 5000;
openChargeMapConsumer.spec.ts
(readability), applyPagination
and getPageInfo
missing unit tests, graphql-subgraph warning "Too many nested callbacks (5)".
Context
There are two use cases:
It is proposed to have two services -> to avoid having a single point of failure Plus, the nature of the use cases allows to perform isolate and concurrent operations.
Approach
Folder structure: MVC design pattern, responsibilities separated by layers. Plus, tasks directory for the publishers/consumers.
Code style: ESLint + prettier.
Database Models: For the scope of the requirements, it is discarded using an ORM. It will be a single collection, where each document is a "Snapshot" of the data extracted from OpenChargeMap.
Message queue: The main idea is to execute sequential requests to get small chunks of data from OpenChargeMap. Each message posted will contain an
operatorid
, then when consuming the results they will be pushed to an array in the lastpoiListSnapshot
document.Fault tolerance: Messages with errors will be sent to a dead letter queue, a document in the collection
poiListSnapshots
with statuscompleted: false
will not be publicly available.POI list data deleted: If a site is removed from OpenChargeMap, our system will reflect the changes when the last snapshot become public. This means that, at any time, it will be at most two documents in the database: one with the last snapshot (public) and another with the in-progress data obtained by the extraction service.
Consequences
References