From 9e4efea3b8a480200653ce51134caa10516f1f51 Mon Sep 17 00:00:00 2001 From: eric-ott Date: Wed, 15 Jul 2026 18:52:54 -0700 Subject: [PATCH 1/6] Installation Notes 1. added the notes about needing prerelease=allow, and the reason to why. 2. Added the correct command to get the library installed --- .../getting-started/installation.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/osh-connect/getting-started/installation.md b/docs/osh-connect/getting-started/installation.md index 8c2e0ec..26f8508 100644 --- a/docs/osh-connect/getting-started/installation.md +++ b/docs/osh-connect/getting-started/installation.md @@ -14,20 +14,20 @@ OSHConnect can be installed in Python and Java, using *pip* (or *poetry*) for Py **OSHConnect-Python** +OSHConnect is published to [PyPI](https://pypi.org/project/oshconnect/), but +so far **only as alpha pre-releases** (latest `0.5.1a22`) — there is no stable +release yet. `pip` and `uv` skip pre-releases by default, so you must opt in: + [*Link to the GitHub Repository*](https://github.com/Botts-Innovative-Research/OSHConnect-Python) - - - ```py - pip install git+https://github.com/Botts-Innovative-Research/OSHConnect-Python.git - ``` - - - ```py - poetry add git+https://github.com/Botts-Innovative-Research/OSHConnect-Python.git - ``` - - +```bash +pip install "oshconnect==0.5.1a22" # exact pin auto-allows the alpha +pip install --pre oshconnect # or: latest alpha (note below) + +uv add "oshconnect==0.5.1a22" # exact pin auto-allows the alpha +uv add "oshconnect>=0.5.1a0" --prerelease=allow # or: allow future alphas +``` + **OSHConnect-Java** From 3b1a55e924c85eb16e08619a725c6a0e823a923e Mon Sep 17 00:00:00 2001 From: eric-ott Date: Fri, 17 Jul 2026 07:54:32 -0700 Subject: [PATCH 2/6] Updated commands in usage.md I just updated the commands one can copy from the website, since all the pervious updates were outdated and half the libraries there are importing no longer exist. --- docs/osh-connect/getting-started/usage.md | 113 ++++++++++++++-------- 1 file changed, 74 insertions(+), 39 deletions(-) diff --git a/docs/osh-connect/getting-started/usage.md b/docs/osh-connect/getting-started/usage.md index cd6e652..1250d10 100644 --- a/docs/osh-connect/getting-started/usage.md +++ b/docs/osh-connect/getting-started/usage.md @@ -16,9 +16,9 @@ To do this you must first create an instance of OSHConnect: ```python -from oshconnect.oshconnectapi import OSHConnect, TemporalModes +from oshconnect import OSHConnect, TemporalModes -osh_connect = OSHConnect(name='OSHConnect', playback_mode=TemporalModes.REAL_TIME) +app = OSHConnect(name='MyApp') ``` @@ -45,12 +45,10 @@ The OSHConnect instance can support multiple Nodes at once. ```python -from oshconnect.oshconnectapi import OSHConnect, TemporalModes -from oshconnect.osh_connect_datamodels import Node - -connect_app = OSHConnect(name='OSHConnect', playback_mode=TemporalModes.REAL_TIME) -node = Node(protocol='http', address="localhost", port=8585, username="test", password="test") -connect_app.add_node(node) +node = Node(protocol='http', address='localhost', port=8585, + username='test', password='test', + enable_mqtt=True, mqtt_port=1883) +app.add_node(node) ``` @@ -77,7 +75,7 @@ This is done by calling the system discovery method on the OSHConnect instance. ```python -osh_connect.discover_systems() +app.discover_systems() ``` @@ -100,7 +98,7 @@ This is done by calling the datastream discovery method on the OSHConnect instan ```python -osh_connect.discover_datastreams() +app.discover_datastreams() ``` @@ -116,16 +114,34 @@ oshSystem.discoverDatastreams(); ``` + ## Retrieving Observations + Once you have discovered the datastreams available for a system, you can fetch observations from a datastream. This is done by calling the fetch observations method on the OSHDataStream instance. -TODO +```python +from oshconnect import StreamableModes +import time + +for ds in app.get_datastreams(): + ds.set_connection_mode(StreamableModes.PULL) + ds.initialize() + ds.start() + +time.sleep(2) # allow messages to arrive +for ds in app.get_datastreams(): + while ds.get_inbound_deque(): + msg = ds.get_inbound_deque().popleft() + print(msg) +``` +```java TODO +``` @@ -143,11 +159,21 @@ The first major step in a common workflow is to add a new system to the OSH Conn ```python -from oshconnect.osh_connect_datamodels import System - -new_system = app.insert_system( - System(name="Test System", description="Test System Description", label="Test System", - urn="urn:system:test"), node) +from oshconnect import OSHConnect, Node + +app = OSHConnect(name='MyApp') +node = Node(protocol='http', address='localhost', port=8585, + username='admin', password='admin') +app.add_node(node) + +new_system = app.create_and_insert_system( + system_opts={ + 'name': 'Test System', + 'description': 'A test system', + 'uid': 'urn:system:test:001', + }, + target_node=node +) ``` @@ -182,23 +208,30 @@ so you can be sure that your datastream is valid before inserting it. ```python -from oshconnect.osh_connect_datamodels import Datastream - -datarecord_schema = DataRecordSchema(label='Example Data Record', description='Example Data Record Description', - definition='www.test.org/records/example-datarecord', fields=[]) -time_schema = TimeSchema(label="Timestamp", definition="http://test.com/Time", name="timestamp", - uom=URI(href="http://test.com/TimeUOM")) -continuous_value_field = QuantitySchema(name='continuous-value-distance', label='Continuous Value Distance', - description='Continuous Value Description', - definition='www.test.org/fields/continuous-value', - uom=UCUMCode(code='m', label='meters')) -example_text_field = TextSchema(name='example-text-field', label='Example Text Field', definition='www.test.org/fields/example-text-field') -# add the fields to the datarecord schema, these can also be added added to the datarecord when it is created -datarecord_schema.fields.append(time_schema) # TimeSchema is required to be the first field in the datarecord for OSH -datarecord_schema.fields.append(continuous_value_field) -datarecord_schema.fields.append(example_text_field) -# Add the datastream to the system -datastream = new_system.add_insert_datastream(datarecord_schema) +from oshconnect import DataRecordSchema, TimeSchema, QuantitySchema, TextSchema +from oshconnect.api_utils import URI, UCUMCode + +datarecord = DataRecordSchema( + label='Example Record', + description='Example datastream record', + definition='http://example.org/records/example', + fields=[] +) + +# TimeSchema must be the first field for OSH +datarecord.fields.append( + TimeSchema(label='Timestamp', definition='http://www.opengis.net/def/property/OGC/0/SamplingTime', + name='timestamp', uom=URI(href='http://www.opengis.net/def/uom/ISO-8601/0/Gregorian')) +) +datarecord.fields.append( + QuantitySchema(name='distance', label='Distance', definition='http://example.org/Distance', + uom=UCUMCode(code='m', label='meters')) +) +datarecord.fields.append( + TextSchema(name='label', label='Label', definition='http://example.org/Label') +) + +datastream = new_system.add_insert_datastream(datarecord) ``` @@ -240,13 +273,15 @@ Upon successfully adding a new datastream to a system, it is now possible to sen ```python +from oshconnect import TimeInstant + datastream.insert_observation_dict({ - "resultTime": TimeInstant.now_as_time_instant().get_iso_time(), # resultTime is required for OSH - "phenomenonTime": TimeInstant.now_as_time_instant().get_iso_time(), # phenomenonTime is required for OSH - "result": { - "timestamp": TimeInstant.now_as_time_instant().epoch_time, - "continuous-value-distance": 1.0, - "example-text-field": "Here is some text" + 'resultTime': TimeInstant.now_as_time_instant().get_iso_time(), + 'phenomenonTime': TimeInstant.now_as_time_instant().get_iso_time(), + 'result': { + 'timestamp': TimeInstant.now_as_time_instant().epoch_time, + 'distance': 1.0, + 'label': 'example observation', } }) ``` From 4ffbda3a5ff79742847d459ce1f69919cb3513d6 Mon Sep 17 00:00:00 2001 From: eric-ott Date: Sat, 18 Jul 2026 16:43:31 -0700 Subject: [PATCH 3/6] Usage Update Notes Added a section that goes over that one must get a running OSH Node set up. And adds the link to get there. --- docs/osh-connect/getting-started/installation.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/osh-connect/getting-started/installation.md b/docs/osh-connect/getting-started/installation.md index 26f8508..d0aa6ae 100644 --- a/docs/osh-connect/getting-started/installation.md +++ b/docs/osh-connect/getting-started/installation.md @@ -8,7 +8,9 @@ import TabItem from '@theme/TabItem'; # Installation -OSHConnect can be installed in Python and Java, using *pip* (or *poetry*) for Python, and *gradle* for Java. +OSHConnect can be installed in Python and Java, using *uv* (or *pip*) for Python, and *gradle* for Java. + +Before working with OSH Connect, there must be a running OSH Node. Thus, you first must create a OSH [Node](../../osh-node/quickstart/requirements.md), then you can begin working connected systems. **Installing OSHConnect** From f73f3f44b1e25eaf82fe90af1365172794322c75 Mon Sep 17 00:00:00 2001 From: eric-ott Date: Sat, 18 Jul 2026 17:05:53 -0700 Subject: [PATCH 4/6] Usage updates Updates link in installation, to go from requirements to introduction instead Just made the lanaguge more clear for instructions, From the top and stopping at Resource Insertion NEED TO CONTINUE ON RESOURCE INSERTION AFTER I WORK FULLY WITH THOSE COMMANDS --- docs/osh-connect/getting-started/installation.md | 2 +- docs/osh-connect/getting-started/usage.md | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/osh-connect/getting-started/installation.md b/docs/osh-connect/getting-started/installation.md index d0aa6ae..bec097c 100644 --- a/docs/osh-connect/getting-started/installation.md +++ b/docs/osh-connect/getting-started/installation.md @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem'; OSHConnect can be installed in Python and Java, using *uv* (or *pip*) for Python, and *gradle* for Java. -Before working with OSH Connect, there must be a running OSH Node. Thus, you first must create a OSH [Node](../../osh-node/quickstart/requirements.md), then you can begin working connected systems. +Before working with OSH Connect, there must be a running OSH Node. Thus, you first must create a OSH [Node](../../osh-node/introduction.md), then you can begin working connected systems. **Installing OSHConnect** diff --git a/docs/osh-connect/getting-started/usage.md b/docs/osh-connect/getting-started/usage.md index 1250d10..9947c6e 100644 --- a/docs/osh-connect/getting-started/usage.md +++ b/docs/osh-connect/getting-started/usage.md @@ -11,8 +11,7 @@ For information regarding usage of OSHConnect-JavaScript, please refer to the [O ::: ## Instantiating OSHConnect -The intended method of interacting with OpenSensorHub is through the main OSHConnect class. -To do this you must first create an instance of OSHConnect: +The intended method of interacting with OpenSensorHub is through the main OSHConnect class, which just allows for ways to interact with the OSH Node, through different coding langauges. To do this you must first create an instance of OSHConnect: ```python @@ -39,8 +38,8 @@ The name parameter is optional, but can be useful for debugging purposes. ::: ## Adding a Node -The next step is to add a Node to the OSHConnect instance. -A Node is a representation of a server that you want to connect to. +The next step is to add your running Node to the OSHConnect instance. +A Node is a representation of a server that you want to be connected to, which can be augmented from your OSH Connect Project. The OSHConnect instance can support multiple Nodes at once. From 3a443d362eca4af60202e360176376490d746f64 Mon Sep 17 00:00:00 2001 From: eric-ott Date: Sat, 18 Jul 2026 17:10:57 -0700 Subject: [PATCH 5/6] Adding a link to the actual OSH Connect Python Docs --- docs/osh-connect/getting-started/installation.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/osh-connect/getting-started/installation.md b/docs/osh-connect/getting-started/installation.md index bec097c..fe3c718 100644 --- a/docs/osh-connect/getting-started/installation.md +++ b/docs/osh-connect/getting-started/installation.md @@ -22,6 +22,9 @@ release yet. `pip` and `uv` skip pre-releases by default, so you must opt in: [*Link to the GitHub Repository*](https://github.com/Botts-Innovative-Research/OSHConnect-Python) +[*Link*](https://botts-innovative-research.github.io/OSHConnect-Python/tutorial.html#creating-an-oshconnect-instance) to a more indepth documentation for OSH Connect - Python + + ```bash pip install "oshconnect==0.5.1a22" # exact pin auto-allows the alpha pip install --pre oshconnect # or: latest alpha (note below) From 60c9d9f00eb9003a52bae20ae1e9b36b9f6131b0 Mon Sep 17 00:00:00 2001 From: eric-ott Date: Mon, 20 Jul 2026 20:48:36 -0700 Subject: [PATCH 6/6] Editting some text was not proper --- docs/osh-connect/getting-started/installation.md | 2 +- docs/osh-connect/getting-started/usage.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/osh-connect/getting-started/installation.md b/docs/osh-connect/getting-started/installation.md index fe3c718..72621f0 100644 --- a/docs/osh-connect/getting-started/installation.md +++ b/docs/osh-connect/getting-started/installation.md @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem'; OSHConnect can be installed in Python and Java, using *uv* (or *pip*) for Python, and *gradle* for Java. -Before working with OSH Connect, there must be a running OSH Node. Thus, you first must create a OSH [Node](../../osh-node/introduction.md), then you can begin working connected systems. +Before working with OSH Connect, there must be a running OSH Node. Thus, you first must create a OSH [Node](../../osh-node/introduction.md), then you can begin working with connected systems. **Installing OSHConnect** diff --git a/docs/osh-connect/getting-started/usage.md b/docs/osh-connect/getting-started/usage.md index 9947c6e..c37e3fe 100644 --- a/docs/osh-connect/getting-started/usage.md +++ b/docs/osh-connect/getting-started/usage.md @@ -11,7 +11,7 @@ For information regarding usage of OSHConnect-JavaScript, please refer to the [O ::: ## Instantiating OSHConnect -The intended method of interacting with OpenSensorHub is through the main OSHConnect class, which just allows for ways to interact with the OSH Node, through different coding langauges. To do this you must first create an instance of OSHConnect: +The intended method of interacting with OpenSensorHub is through the main OSHConnect class, which allows for ways to interact with the OSH Node, through different coding langauges. To do this you must first create an instance of OSHConnect: ```python