Skip to content

Commit

Permalink
added extractor info
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasDroid committed Nov 22, 2024
1 parent 7aded42 commit 69b612e
Show file tree
Hide file tree
Showing 14 changed files with 247 additions and 53 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ gem "jekyll", "~> 4.3.4" # installed by `gem jekyll`

gem "just-the-docs", "0.10.0" # pinned to the current release
# gem "just-the-docs" # always download the latest release
gem "jekyll-relative-links", "0.7.0"
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ GEM
webrick (~> 1.7)
jekyll-include-cache (0.2.1)
jekyll (>= 3.7, < 5.0)
jekyll-relative-links (0.7.0)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0)
Expand Down Expand Up @@ -83,6 +85,7 @@ PLATFORMS

DEPENDENCIES
jekyll (~> 4.3.4)
jekyll-relative-links (= 0.7.0)
just-the-docs (= 0.10.0)

BUNDLED WITH
Expand Down
42 changes: 0 additions & 42 deletions README.md

This file was deleted.

3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ logo: /assets/fologos.png

aux_links:
FleetOptimiser OS2: https://github.com/OS2fleetoptimiser/OS2fleetoptimiser

plugins:
- jekyll-relative-links
2 changes: 1 addition & 1 deletion developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,5 @@ docker run -p 6379:6379 redis -d
npm run dev
```

See [production](production.html) for environment variables for the backend.
See [production](production.md) for environment variables for the backend.

7 changes: 0 additions & 7 deletions extractors.md

This file was deleted.

30 changes: 30 additions & 0 deletions extractors/clevertrack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Clevertrack
layout: default
parent: Extractors
has_children: false
---
# Clevertrack

Clevertrack uses a method of patching already read trips.
If one does not patch you would continuously have to load already _known_ trips, because it's not possible to query
based off of vehicle id. Hence, you have to define a date from which you want to load trips, and manage patching.

The connection requires a `TOKEN` environment which is a classic uid format.
In addition, you should provide a pickle path to;
- `CAR_TRIPS_IDS` : path to a pickle that stores mapping between vehicle ids and patched trips
- `PATCHED_IDS` : path to a pickle that stores record of patched trips


Use the `docker-compose-extractor.yaml` file and define the functions you want to use in the extractor:

| function | description |
|------------------|--------------------------------------|
| set-vehicles | syncs the vehicles |
| set-roundtrips | loads, aggregate and save roundtrips |
| patch-roundtrips | patches read trips on the connection |


```
["/bin/sh", "-c", "python -m fleetmanager.extractors.clevertrack set-vehicles && python -m fleetmanager.extractors.clevertrack set-roundtrips && python -m fleetmanager.extractors.clevertrack patch-roundtrips"]
```
32 changes: 32 additions & 0 deletions extractors/extractors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Extractors
layout: default
nav_order: 4
has_children: true
---

# Extractors
The extractors are an important part of FleetOptimiser, which asserts that data is synced from the fleetmanagement systems.
The extractor will synchronise available metadata with vehicles, and will delta load the latest trips.
Trips will be aggregated from single GPS logs, to an aggregated format that will only contain coordinates of a saved start location,
such that the system does not save sensitive information.


The amount of exposed metadata differ from system to system, so with some integrations there are more sanitation of data.


All extractors expect the following env variables:

| env | description |
|-----|-------------|
| DB_NAME | name of the database |
| DB_USER | user of the database |
| DB_PASSWORD | password of the user on the database |
| DB_URL | host and port to the database |
| DB_SERVER | dialect and driver |
| TRIP_DURATION | maximum duration of a roundtrip |
| MAX_DATE | first delta load date |
| DESCRIPTION_FIELDS | additional fields to save from APIs



29 changes: 29 additions & 0 deletions extractors/fleetcomplete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: FleetComplete
layout: default
parent: Extractors
has_children: false
---
# FleetComplete

The FleetComplete extractor expects the connection key to be present in the env as a single string, like:

```
KEYS=keyToFleetComplete
```


Use the `docker-compose-extractor.yaml` file and define the functions you want to use in the extractor:

| function | description |
|------------------| ----------- |
| set-starts | loads and saves new locations |
| set-vehicles | syncs the vehicles |
| set-roundtrips | loads, aggregate and save roundtrips |
| clean-roundtrips | deletes X (keep_data in DB) month old roundtrips |



```
entrypoint: ["/bin/sh", "-c", "python -m fleetmanager.extractors.fleetcomplete set-starts && python -m fleetmanager.extractors.fleetcomplete set-vehicles && python -m fleetmanager.extractors.fleetcomplete set-roundtrips && python -m fleetmanager.extractors.fleetcomplete clean-roundtrips"]
```
30 changes: 30 additions & 0 deletions extractors/gamfleet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Gamfleet
layout: default
parent: Extractors
has_children: false
---
# Gamfleet

You must modify the urls in the Gamfleet extractor code in order to point to the correct endpoints.

To make the load more effective, we use a `LOAD_RECORD_PATH` to store load history of each vehicle.
This asserts that we don't load _old_ unusable trips.

- `LOAD_RECORD_PATH` : path to json history (optional)
- `KEY` : key to the Gamfleet API

Use the `docker-compose-extractor.yaml` file and define the functions you want to use in the extractor:

| function | description |
|------------------| ----------- |
| set-starts | loads and saves new locations |
| set-vehicles | syncs the vehicles |
| set-roundtrips | loads, aggregate and save roundtrips |
| clean-roundtrips | deletes X (keep_data in DB) month old roundtrips |



```
entrypoint: ["/bin/sh", "-c", "python -m fleetmanager.extractors.gamfleet set-starts && python -m fleetmanager.extractors.gamfleet set-vehicles && python -m fleetmanager.extractors.gamfleet set-roundtrips && python -m fleetmanager.extractors.gamfleet clean-roundtrips"]
```
28 changes: 28 additions & 0 deletions extractors/mileagebook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: MileageBook
layout: default
parent: Extractors
has_children: false
---
# MileageBook

The MileageBook extractor expects the connection key as environment variable:

```
KEY=apiKey
```


Use the `docker-compose-extractor.yaml` file and define the functions you want to use in the extractor:

| function | description |
|------------------| ----------- |
| set-starts | loads and saves new locations |
| set-vehicles | syncs the vehicles |
| set-roundtrips | loads, aggregate and save roundtrips |
| clean-roundtrips | deletes X (keep_data in DB) month old roundtrips |


```
entrypoint: ["/bin/sh", "-c", "python -m fleetmanager.extractors.fleetcomplete set-starts && python -m fleetmanager.extractors.fleetcomplete set-vehicles && python -m fleetmanager.extractors.fleetcomplete set-roundtrips && python -m fleetmanager.extractors.fleetcomplete clean-roundtrips"]
```
36 changes: 36 additions & 0 deletions extractors/puma.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Puma
layout: default
parent: Extractors
has_children: false
---
# Puma

PUMA connection requires VPN access, which details will not be explained here.
In addition to VPN access, it's also required to have read access to the PUMA database.

We use a load record path to make loading of trips more efficient. In order not to continuously load unused _old_ trips.

- `LOAD_RECORD_PATH` : path to a json mapping that stores load history
- `FORVALTNINGER` : list of forvaltninger to load trips from
- `PUMA_DRIVER` : the dialect of puma connection
- `PUMA_USER` : user on the puma connection
- `PUMA_URL` : url to the puma connection
- `PUMA_NAME` : name of the puma connection
- `PUMA_PASSWORD` : password to the puma connection


Use the `docker-compose-extractor.yaml` file and define the functions you want to use in the extractor:

| function | description |
|------------------| ----------- |
| set-starts | loads and saves new locations |
| set-vehicles | syncs the vehicles |
| set-roundtrips | loads, aggregate and save roundtrips |
| clean-roundtrips | deletes X (keep_data in DB) month old roundtrips |


```
entrypoint: ["/bin/sh", "-c", "python -m fleetmanager.extractors.puma set-starts && python -m fleetmanager.extractors.puma set-vehicles && python -m fleetmanager.extractors.puma set-roundtrips && python -m fleetmanager.extractors.puma clean-roundtrips"]
```

51 changes: 51 additions & 0 deletions extractors/skyhost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: SkyHost
layout: default
parent: Extractors
has_children: false
---
# SkyHost

First version extracts data through a SOAP API. The environment must contain variable `KEYS` with value string that evaluates to list of strings e.g.

```
KEYS="['firstKey', 'secondKey']"
```

Use the `docker-compose-extractor.yaml` file and define the entrypoints function you want to use

| function | description |
| -------- | ----------- |
| set-trackers | syncs the vehicles |
| set-roundtrips | loads, aggregate and save roundtrips |
| clean-roundtrips | deletes X (keep_data in DB) month old roundtrips |

````
entrypoint: ["/bin/sh", "-c", "python -m fleetmanager.extractors.skyhost set-trackers && python -m fleetmanager.extractors.skyhost set-roundtrips && python -m fleetmanager.extractors.skyhost clean-roundtrips"]
````


# SkyHost V2

Second version uses the rest api, and uses env variables `ACCOUNT_IDS` and `API_KEYS` as a comma-separated list.
Each connection has exactly one account id and one api key. E.g.

```
ACCOUNT_IDS="accountId#1,accountId#2"
API_KEYS="apiKey#1,apiKey#2"
```

Use the `docker-compose-extractor.yaml` file and define the functions you want to use in the extractor:

| function | description |
|--------------------| ----------- |
| set-allowed-starts | loads and saves new locations |
| set-trackers | syncs the vehicles |
| set-roundtrips | loads, aggregate and save roundtrips |
| clean-roundtrips | deletes X (keep_data in DB) month old roundtrips |


````
entrypoint: ["/bin/sh", "-c", "python -m fleetmanager.extractors.skyhost set-allowed-starts && python -m fleetmanager.extractors.skyhost set-trackers && python -m fleetmanager.extractors.skyhost set-roundtrips && python -m fleetmanager.extractors.skyhost clean-roundtrips"]
````

6 changes: 3 additions & 3 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ Running FleetOptimiser in developer mode is easy and can be done in multiple way
In addition to the description of how to run FleetOptimiser, we also offer extraction modules to fleet management systems that loads and aggregate driving-data.
For more details go the [Extractors] page.

[Extractors]: extractors.html
[Production]: production.html
[Developing]: developing.html
[Extractors]: extractors.md
[Production]: production.md
[Developing]: developing.md

0 comments on commit 69b612e

Please sign in to comment.