This project is organized into two main directories: node and python. Each directory contains two subdirectories: feed and history. These subdirectories represent different functionalities related to real-time data feeds and historical statistics, respectively, for the Samsara Telematics API. Both the Node.js and Python implementations are provided, making the project versatile for users familiar with either language.
Learn more about the Feed Stats and History Stats APIs from Samsara Telematics.
.
├── node
│ ├── feed
│ │ ├── feedRealTimeData.js
│ │ └── README.md
│ ├── history
│ │ ├── historicalStatsData.js
│ │ └── README.md
│ ├── package-lock.json
│ └── package.json
├── python
│ ├── feed
│ │ ├── feedRealTimeData.py
│ │ └── README.md
│ ├── history
│ │ ├── historicalStatsData.py
│ │ └── README.md
├── .env
└── .gitignoreThe node directory contains implementations using JavaScript (Node.js). It includes:
feedRealTimeData.js: Handles fetching and processing real-time data in Node.js.historicalStatsData.js: Manages historical statistics data in Node.js.package.jsonandpackage-lock.json: These files manage the project's dependencies and configurations for Node.js.
Each subdirectory in the node folder has its own README.md file for more detailed explanations specific to that module.
The python directory provides equivalent implementations using Python. It includes:
feedRealTimeData.py: A Python script for processing real-time data from the feed API.historicalStatsData.py: A Python script for handling historical statistics data from the history API.
Each subdirectory in the python folder also has its own README.md file to explain the specifics of the respective modules.
.env: Environment configuration file used to store sensitive information like API keys and database credentials..gitignore: Specifies which files and directories Git should ignore to keep the repository clean, such as thenode_modulesfolder and environment files.
-
Navigate to the
nodedirectory:cd node -
Install dependencies:
npm install
-
Run the real-time data feed script:
npm run feed
-
Run the historical stats data script:
npm run history
-
Navigate to the
pythondirectory:cd python -
Install dependencies
pip3 install requests python-dotenv
-
Run the real-time data feed script:
python3 feed/feedRealTimeData.py
-
Run the historical stats data script:
python3 history/historicalStatsData.py
This project is licensed under the MIT License. See the LICENSE file for details.