Skip to content

Commit 7372861

Browse files
committed
Add MultiViz client and upload functionality for vibration data
- Created a Jupyter notebook for uploading time waveform vibration data to MultiViz, covering client setup, data storage, and measurement uploading. - Implemented `MultivizClient` class for API interactions, including methods for creating sources and uploading measurements. - Added helper functions for loading JSON payloads, localizing timestamps, and reading CSV data. - Introduced logging configuration for better error tracking and debugging. - Added requirements for `requests` and `pytz` libraries. - Implemented example usage for uploading measurements from JSON and CSV files.
1 parent 9fc1cbb commit 7372861

File tree

13 files changed

+75665
-1
lines changed

13 files changed

+75665
-1
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"python-envs.defaultEnvManager": "ms-python.python:conda",
3+
"python-envs.defaultPackageManager": "ms-python.python:conda",
4+
"python-envs.pythonProjects": []
5+
}

README.md

Lines changed: 195 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,195 @@
1-
# multiviz-connector-template
1+
# Vibium / MultiViz Time Waveform Upload Example
2+
3+
This repository contains a small Python project and a Jupyter notebook showing how to upload **time waveform vibration data** to **MultiViz** using the `MultivizClient`.
4+
The notebook demonstrates working with both **JSON payloads** and **CSV files**.
5+
6+
---
7+
8+
## 📂 Project Structure
9+
10+
```
11+
.
12+
├── data/
13+
│ ├── information.txt # Metadata for CSV example
14+
│ ├── sample_payload.json # JSON waveform example
15+
│ ├── values_1.csv # X-axis data
16+
│ ├── values_2.csv # Y-axis data
17+
│ └── values_3.csv # Z-axis data
18+
├── notebooks/
19+
│ └── upload_to_vibium.ipynb # Main demonstration notebook
20+
├── src/
21+
│ ├── helper.py # Helper functions (I/O, parsing, utils)
22+
│ ├── logger.py # Basic logger
23+
│ ├── multiviz_client.py # MultiViz communication layer
24+
│ └── vibium_client.py
25+
├── requirements.txt
26+
└── README.md
27+
```
28+
29+
---
30+
31+
## 🚀 Setup Instructions
32+
33+
### 1. Create & activate a virtual environment
34+
35+
**Windows:**
36+
```bash
37+
python -m venv .venv
38+
.\.venv\Scripts\activate
39+
```
40+
41+
**macOS / Linux:**
42+
```bash
43+
python3 -m venv .venv
44+
source .venv/bin/activate
45+
```
46+
47+
---
48+
49+
### 2. Install dependencies
50+
51+
```bash
52+
pip install --upgrade pip
53+
pip install -r requirements.txt
54+
```
55+
56+
If you plan to run the notebook and Jupyter is not included:
57+
```bash
58+
pip install jupyterlab
59+
```
60+
61+
---
62+
63+
## 🔑 Configure MultiViz API Key
64+
65+
Open the notebook:
66+
67+
```
68+
notebooks/upload_to_vibium.ipynb
69+
```
70+
71+
Set your API key in the first code cell:
72+
73+
```python
74+
MULTIVIZ_API_KEY = "YOUR_API_KEY_HERE"
75+
MULTIVIZ_BASE_URL = "https://api.beta.multiviz.com"
76+
```
77+
78+
---
79+
80+
## 📘 Running the Notebook
81+
82+
From the project root:
83+
84+
```bash
85+
jupyter lab
86+
```
87+
88+
Then open:
89+
90+
```
91+
notebooks/upload_to_vibium.ipynb
92+
```
93+
94+
Run all cells from top to bottom.
95+
96+
The notebook will:
97+
98+
- Initialize the `MultivizClient`
99+
- Show how to create waveform **sources**
100+
- Upload waveform **measurements** from JSON or CSV
101+
102+
---
103+
104+
## 📑 Example 1 — JSON Upload
105+
106+
This example uses:
107+
108+
```
109+
data/sample_payload.json
110+
```
111+
112+
The function `upload_example_measurement_json()`:
113+
114+
- Loads payload
115+
- Builds waveform sources
116+
- Uploads waveform samples (X/Y/Z axes)
117+
- Sends metadata (location, asset, sensor, gateway, process_data, etc.)
118+
119+
To run:
120+
121+
```python
122+
upload_example_measurement_json()
123+
```
124+
125+
---
126+
127+
## 📑 Example 2 — CSV Upload
128+
129+
Files:
130+
131+
```
132+
data/information.txt
133+
data/values_1.csv
134+
data/values_2.csv
135+
data/values_3.csv
136+
```
137+
138+
`information.txt` includes metadata such as:
139+
140+
```
141+
Snapshot Id : 202804
142+
Recorded At : 10/22/2025 00:58:37
143+
Recorded by User: Unknown
144+
Device Name : UT-CMP-201
145+
Device Serial : VW8AQ5A840
146+
Machine Name : cylinder
147+
Sensor Serial : 1890727266
148+
Sensor Name : Sensor 1890727266
149+
Samples : 8192
150+
Time Period : 640ms
151+
Sensor Position : 1
152+
Axis : All
153+
Freq Max : 5000
154+
FFT Res : 1.563
155+
Avg. Number : 1
156+
Slice/Bin Duration : 0ms
157+
```
158+
159+
The function `upload_example_measurement_csv()` will:
160+
161+
- Parse metadata
162+
- Load CSV sample columns
163+
- Create waveform sources (X/Y/Z)
164+
- Upload each measurement
165+
166+
Run:
167+
168+
```python
169+
upload_example_measurement_csv()
170+
```
171+
172+
---
173+
174+
## 🛠 Troubleshooting
175+
176+
### Import errors:
177+
If you get:
178+
```
179+
ModuleNotFoundError: No module named 'src'
180+
```
181+
182+
Ensure you launched Jupyter from the **project root**.
183+
184+
Or manually add it:
185+
186+
```python
187+
import sys
188+
sys.path.append(".")
189+
```
190+
191+
---
192+
193+
## 📬 Support
194+
195+
If anything is unclear or you want the README adapted for internal documentation, just let me know!

data/information.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Snapshot Id : 202804
2+
Recorded At : 10/22/2025 00:58:37
3+
Recorded by User: Unknown
4+
Device Name : UT-CMP-201
5+
Device Serial : VW8AQ5A840
6+
Machine Name : cylinder
7+
Sensor Serial : 1890727266
8+
Sensor Name : Sensor 1890727266
9+
Samples : 8192
10+
Time Period : 640ms
11+
Sensor Position : 1
12+
Axis : All
13+
Freq Max : 5000
14+
FFT Res : 1.563
15+
Avg. Number : 1
16+
Slice/Bin Duration : 0ms

0 commit comments

Comments
 (0)