The most comprehensive Python SDK for processing WITS (Wellsite Information Transfer Standard) data in the oil & gas drilling industry.
Project description
๐ ๏ธ WitsKit
WitsKit is a Python toolkit for decoding and working with WITS (Wellsite Information Transfer Standard) data.
*Please note: Iโm still learning, so if you spot something incorrect or suboptimal, feel free to submit a PR. The codebase isnโt perfect yet, but Iโm working on it!๐ฉ What It Does
- Parses raw WITS frames into structured, validated Python objects
- Ships with 724 symbols across 20+ record typesโauto-parsed from the spec
- Includes CLI tools for symbol search, frame decoding, and validation
- ๐๏ธ SQL Storage: Stream WITS data directly to SQLite, PostgreSQL, or MySQL databases
- ๐ Time-series Analysis: Query and analyze historical drilling data with time-based filtering
- Built to be extended: transports (serial, TCP) and outputs (SQL, JSON) are plug-and-play
๐ก Why Use It?
- ๐ง You get the full WITS symbol database, not someone's half-finished Excel copy
- ๐ CLI lets you find, filter, and explore symbols without opening the spec (again)
- ๐ Works in both metric and FPSโbecause a boat sank and now we have 2 standards
- ๐๏ธ Production-ready SQL storage for time-series drilling data analysis
- ๐ Query historical data with time filters, symbol selection, and export to CSV/JSON
- ๐งฑ Modular and testable, built with real-world telemetry in mind
- ๐ Type-checked with
pydantic, so your data actually means what you think it does
๐งโ๐ป Getting Started
Installation
For Development:
git clone https://github.com/Critlist/witskit
cd witskit
pip install -e .
For Production (when published):
pip install witskit
With SQL storage support:
pip install witskit[sql] # Includes PostgreSQL and MySQL drivers
With uv (recommended):
git clone https://github.com/yourusername/witskit
cd witskit
uv pip install -e .
Quick Start - Decode a WITS Frame
from witskit import decode_frame
frame = """&&
01083650.40
01133.5
01142850.7
!!"""
result = decode_frame(frame)
for dp in result.data_points:
print(f"{dp.symbol_name}: {dp.parsed_value} {dp.unit}")
Output:
DBTM: 3650.4 M
ROPA: 3.5 M/HR
HKLA: 2850.7 KDN
๐น๏ธ CLI Commands
After installation, the witskit command is available globally:
Try the demo:
witskit demo
Explore symbol database:
witskit symbols --list-records
witskit symbols --search "depth"
witskit symbols --record 8 --search "resistivity"
Decode WITS from a file:
witskit decode sample.wits
witskit decode sample.wits --fps
witskit decode sample.wits --output results.json
Decode WITS directly:
witskit decode "&&\n01083650.40\n!!" --format table
Validate WITS data:
witskit validate "&&\n01083650.40\n!!"
Convert units:
witskit convert 3650.4 M F # Convert 3650.4 meters to feet
witskit convert 1000 PSI KPA # Convert 1000 PSI to kilopascals
WITS File Format
Example WITS file format (sample.wits):
&&
01083650.40
01133.5
01142850.7
!!
&&
01083651.20
01133.7
01142855.3
!!
Each frame must include:
- Start line (
&&) - One or more data lines (4-digit symbol code + value)
- End line (
!!)
Multiple frames can be included in a single file.
๐๏ธ SQL Storage & Time-Series Analysis
WitsKit includes production-ready SQL storage for time-series drilling data analysis:
Supported Databases
- SQLite: Perfect for development and single-user analysis
- PostgreSQL: Production-ready with advanced time-series capabilities
- MySQL: Enterprise database support
Key Features
- Optimized Schema: Time-series optimized tables with proper indexing
- Batch Processing: Configurable batch sizes for high-performance streaming
- Time-Based Queries: Filter data by time ranges with ISO timestamp support
- Symbol Management: Automatic population of WITS symbol definitions
- Export Options: JSON, CSV, and table formats for data analysis
- Multi-source Support: Handle data from multiple drilling rigs simultaneously
Quick Example
from witskit.storage.sql_writer import SQLWriter, DatabaseConfig
# Configure database
config = DatabaseConfig.sqlite("drilling_data.db")
writer = SQLWriter(config)
# Stream and store data
await writer.initialize()
async for frame in stream_source:
await writer.store_frame(frame)
# Query historical data
async for data_point in writer.query_data_points(
symbol_codes=["0108", "0113"],
start_time=datetime(2024, 1, 1),
limit=1000
):
print(f"{data_point.symbol_name}: {data_point.parsed_value}")
See docs/sql_storage.md for complete documentation.
๐งฑ Project Layout
witskit/
โโโ witskit/ # Main package
โ โโโ models/ # Symbol metadata, Pydantic schemas
โ โโโ decoder/ # WITS frame parsing
โ โโโ transport/ # Serial, TCP, file readers
โ โโโ storage/ # SQL storage backends
โ โ โโโ base.py # Abstract storage interface
โ โ โโโ schema.py # Database schema definitions
โ โ โโโ sql_writer.py # SQL storage implementation
โ โโโ cli.py # Command-line interface
โโโ tests/ # Unit tests
โโโ docs/ # Documentation
โ โโโ sql_storage.md # Complete SQL storage guide
โ โโโ guide/ # User guides
โ โ โโโ getting-started.md
โ โ โโโ cli-usage.md
โ โ โโโ wits-format.md
โ โโโ api/ # API documentation
โโโ examples/ # Example scripts and demos
โโโ pyproject.toml # Package configuration
โโโ README.md # This file
๐ Supported Record Types
| Record | Category | Description | Symbols |
|---|---|---|---|
| 1 | Drilling | Time-Based | 40 |
| 2 | Drilling | Depth-Based | 26 |
| 8 | MWD/LWD | Formation Evaluation | 46 |
| 15 | Evaluation | Cuttings/Lithology | 54 |
| 19 | Configuration | Equipment setup | 89 |
| ... | ... | 20+ types total | 724 |
Records 5, 22โ25 are defined but not implemented. You're not missing much.
๐งช Testing
# Run the full test suite
pytest tests/ -v
# Run specific test categories
pytest tests/test_decoder.py -v
pytest tests/test_symbols.py -v
๐ Roadmap
- โ Symbol parser & decoder engine
- ๐ง Transport support (serial, TCP, file) (WIP)
- โ SQL Storage (SQLite, PostgreSQL, MySQL)
- โ Time-series analysis with time-based filtering and export
- ๐ Real-time decoding pipeline with WebSocket/MQTT
- ๐ Web UI for monitoring decoded streams
- ๐ Parquet export for big data analysis
๐ค Contributing
This project uses:
- Python 3.11+
- pydantic for type validation
- typer for CLI
- rich for terminal formatting
- pytest for testing
- SQLAlchemy for SQL storage
- asyncpg/aiomysql for async database drivers
PRs welcome. Bonus points if you've ever debugged WITS Comms while on standby waiting for the Rig to pick up tools.
๐ References
๐ License
MIT. Do what you want with itโjust don't sell it back to Halliburton.
Made by someone who got bored and wanted a tool to create a diferent approach to WITS data transfer. If you work with WITS data, WitsKit's here to make your life less painful.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file witskit-0.1.0.tar.gz.
File metadata
- Download URL: witskit-0.1.0.tar.gz
- Upload date:
- Size: 69.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d2318474a7ef1d9908d7e8282495c603aec0e47b7fd0daafedc1188ae76e85c
|
|
| MD5 |
85aec57d033d525a01f2839fc30d2bab
|
|
| BLAKE2b-256 |
c9a2371ae3d9b87c4165a48da49f60a3f95e93b0ebab2da286e51c09b2402bac
|
File details
Details for the file witskit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: witskit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d704fb8aa35a60e246553439bf09a26bbc181be627383e19edb975a4bf7afa4
|
|
| MD5 |
a8a444a0d17992061766886655d32c79
|
|
| BLAKE2b-256 |
e0839d0fb5487b5d568350f963a506c379f19c6da30722a0fd7de2bfe0eea5aa
|