Skip to main content

Python client for ingesting signals, DTCs, network stats, and GPS data to a GraphQL backend

Project description

Harry what_is_harry 🥹 It’s fine, come to me.

Harry — 30/06/2025, 7:46 PM If the case is to remain in one instance and no fancy caching.. then doable hai kaam Image Haseeb Saif — 30/06/2025, 7:46 PM Thk hai. Harry — 30/06/2025, 7:48 PM Semphores parha hai.. not sure use kar sakty with the calling.. cause hum directly call kartay abhi.. baaki agar hum isko as HTTP request bhejhay hai then semephores use kar sktay..

basically aik way hai tou block or manage multi-request and doesn't make a queue.. Haseeb Saif — 30/06/2025, 9:15 PM Yeh better nahi? Harry — 30/06/2025, 9:22 PM Better hai yeh b… but queue maintain nahi hoti ismay Haseeb Saif — 30/06/2025, 9:24 PM Batching kesay karain gay? Batch queue say bano andar data baijaty howay yeh use kar lo? Harry — 30/06/2025, 9:25 PM Batch k wapis annay ka wait kar sktay Queue na banaye agar Haseeb Saif — 30/06/2025, 9:26 PM Yes wohi kar letay. But check k kya better hai. Ask papa. Both cases Harry — 30/06/2025, 10:16 PM http://lustra.intrepidcs.corp/ics/wivi/issues/-/issues/1843 http://lustra.intrepidcs.corp/ics/wivi/issues/-/issues/1844 http://lustra.intrepidcs.corp/ics/wivi/issues/-/issues/1845 http://lustra.intrepidcs.corp/ics/wivi/issues/-/issues/1846 http://lustra.intrepidcs.corp/ics/wivi/issues/-/issues/1847 Harry — 02/07/2025, 8:10 PM Update for now :

Revamp initialization of the library Created Schema validator for it. Seperate classes for creating configuration

Currently working on test cases of init

Will complete test cases and library intialization testing with validation today!

========================================== 1 hour break for gym

Haseeb Saif — 03/07/2025, 5:10 PM Yo Local pay graph chal raha teray pass? Harry — 03/07/2025, 5:10 PM Yes Haseeb Saif — 03/07/2025, 5:10 PM Latest? Harry — 03/07/2025, 5:10 PM Parso pull liya master ka So yes latest Haseeb Saif — 03/07/2025, 5:11 PM Networkstat k table main hai kuch locally? Harry — 03/07/2025, 5:11 PM Network stat ma nahi add kiya kuch.. Haseeb Saif — 03/07/2025, 5:11 PM And device Version walay table main? Harry — 03/07/2025, 5:11 PM Signal or message or config ma hai Haseeb Saif — 03/07/2025, 5:11 PM query { deviceVersion(input: { configuration: { vehicleId: 87, }, limit:1, order: DESC }) { name lastUpdateTime:time value vehicleId } } Yeh qry chala k deakhni hai Harry — 03/07/2025, 5:11 PM Mere pass device version wgaira nahi chaltay Harry — 03/07/2025, 5:12 PM Ma locally data daal k dekh leta hun.. Haseeb Saif — 03/07/2025, 5:12 PM Han data daaal k deakh zara Harry — 03/07/2025, 5:13 PM Okay Haseeb Saif — 03/07/2025, 5:13 PM 2,2 entries kar lain means veh 87 ki 2,2 Harry — 03/07/2025, 5:13 PM Okay Harry — 03/07/2025, 5:24 PM simple deviceVersion ki query nahi chalai but with vehicle chalai hai Image simple dekhta abh Haseeb Saif — 03/07/2025, 5:25 PM Main awais sath edakh raha Tu lib pay kar Harry — 03/07/2025, 5:26 PM Image Okay Haseeb Saif — 03/07/2025, 5:28 PM join awais cube' ??? Haseeb Saif — 10/07/2025, 4:10 PM @Harry PRs main proper likh dena jesay Umer ny tasks main detail likhi hain k kya kar rahay Haseeb Saif — 10/07/2025, 4:27 PM ??? Harry — 10/07/2025, 5:02 PM join cube Haseeb Saif — Yesterday at 4:36 PM Can we use this as our Read.Me file?

Analytics Ingest Client

A lightweight Python library to batch and push automotive telemetry data—such as signals, Diagnostic Trouble Codes (DTCs), GPS data, and network statistics—to a GraphQL backend.


Expand Readme.txt 4 KB Check the examples before using it. Addsignal and addGPs etc examples. Harry — Yesterday at 4:47 PM Examples needs to be set for dtcs and signals as message info is not there

other than that it's looking far better then existing one Haseeb Saif — Yesterday at 4:51 PM Amend and add. Harry — Yesterday at 4:52 PM Okay  Haseeb Saif haseebsaifullah

Analytics Ingest Client

A lightweight Python library to batch and push automotive telemetry data—such as signals, Diagnostic Trouble Codes (DTCs), GPS data, and network statistics—to a GraphQL backend.


🔧 Features

  • Supports Python 3.11+
  • Clean, single-class interface: IcsAnalytics
  • In-memory caching for resolved IDs (message id or configuration)
  • Batching support (by interval, count, or signal limit)
  • Async-safe request queuing (only 1 request at a time)
  • Minimal dependency footprint
  • Easy to test and integrate
  • Supports signals, DTCs, GPS, and network stats ingestion

📦 Installation

pip install analytics-ingest

🚀 Usage

Basic Example

from analytics_ingest import IcsAnalytics

client = IcsAnalytics(
    device_id=123,
    vehicle_id=456,
    fleet_id=789,
    org_id=1011,
    graphql_endpoint="https://your-backend/graphql",
    batch_size=100,
    batch_interval_seconds=10,
    max_signal_count=100
)

# Add signals (list of dicts)
client.add_signal([
    {"name": "rpm", "unit": "rpm", "data": [{"value": 3000, "timestamp": "2024-01-01T00:00:00Z"}]},
    # ... more signals ...
])

# Add DTCs (list of dicts)
client.add_dtc([
    {"dtcId": "P0300", "status": "active", "description": "Random/Multiple Cylinder Misfire Detected", "data": []},
    # ... more DTCs ...
])

# Add GPS data (dict)
client.add_gps({
    "latitude": 37.7749,
    "longitude": -122.4194,
    "timestamp": "2024-01-01T00:00:00Z"
})

# Add network stats (dict)
client.add_network_stats({
    "name": "CAN1",
    "vehicleId": 456,
    "uploadId": 1,
    "totalMessages": 1000,
    "matchedMessages": 950,
    "unmatchedMessages": 50,
    "errorMessages": 0,
    "longMessageParts": 0,
    "rate": 500.0
})

# Graceful shutdown (flushes any remaining data)
client.close()

⚙️ Configuration

You can configure the client via constructor arguments or environment variables (e.g., GRAPH_ENDPOINT).

  • device_id, vehicle_id, fleet_id, org_id: Required identifiers
  • graphql_endpoint: URL to your GraphQL backend
  • batch_size: Number of items per batch (default: 100)
  • batch_interval_seconds: Max seconds between batch sends (default: 10)
  • max_signal_count: Max signals per batch (default: 100)

🛠️ Error Handling & Logging

  • Uses exceptions for invalid input or backend errors
  • Replaceable print statements with logging recommended for production
  • Retries failed batch sends on next interval

🧪 Testing

Run all test cases:

PYTHONPATH=src python3 -m unittest discover -s tests -v

Build and upload package:

python3 -m build
python -m twine upload dist/*

💡 Improvements & Roadmap

  • Add more usage examples and API documentation
  • Integrate a logging framework
  • Increase test coverage and add integration tests
  • Allow dynamic runtime configuration
  • Expose a fully async API
  • Add metrics and monitoring hooks
  • Enforce linting and type checking in CI

🤝 Contributing

Pull requests and issues are welcome! Please add tests for new features and follow PEP8 style guidelines.


📄 License

MIT License Readme.txt 4 KB

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

analytics_ingest-0.1.43.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

analytics_ingest-0.1.43-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file analytics_ingest-0.1.43.tar.gz.

File metadata

  • Download URL: analytics_ingest-0.1.43.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for analytics_ingest-0.1.43.tar.gz
Algorithm Hash digest
SHA256 91278662e7286d686522e42db1ba8c3c4c32906c401f7bfd7f263ca3fe3b6a2c
MD5 2d3d713a18859cd00ee993aed6fa0186
BLAKE2b-256 b9309a1b84e277c88ee66abfb3aa799b8e40482fdd9c64756cda25a38f76dec9

See more details on using hashes here.

File details

Details for the file analytics_ingest-0.1.43-py3-none-any.whl.

File metadata

File hashes

Hashes for analytics_ingest-0.1.43-py3-none-any.whl
Algorithm Hash digest
SHA256 2f44035455a38fdfb14e9817d82373a6731b04d6a2d67d21dd4ef9d78eee88c8
MD5 4cc0820266c30fc43cb73add53843b59
BLAKE2b-256 bff9a9dc1c379b0de94e6eb26dc96a2ffa1d6ea1475f6d8892e0d61c189d5c01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page