File size: 657 Bytes
e8ecd68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import typer
import json
from deepboreai_sdk.sdk import DeepBoreAI

app = typer.Typer()
client = DeepBoreAI()

@app.command()
def ingest(file: str):
    with open(file, 'r') as f:
        data = json.load(f)
    result = client.post_telemetry(data)
    typer.echo(result)

@app.command()
def export(out: str = 'drilling_data.csv'):
    path = client.export_csv(out)
    typer.echo(f"Exported to {path}")

@app.command()
def stream():
    def callback(data):
        typer.echo(f"Live Alert: {data}")
    typer.echo("Listening to live data stream...")
    client.watch_live(callback)
    input("Press Enter to stop...
")

if __name__ == "__main__":
    app()