Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ datastream schemas.
A TimeSchema is required to be the first field in the DataRecordSchema for OSH.

Inserting an Observation into and OpenSensorHub Node
-----------------------------------------
-----------------------------------------------------
Upon successfully adding a new datastream to a system, it is now possible to send observation data to the node.

.. code-block:: python
Expand Down
3 changes: 2 additions & 1 deletion oshconnect/core_datamodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

from typing import List

from conSys4Py import DatastreamSchema, Geometry
from conSys4Py.datamodels.swe_components import Geometry
from conSys4Py.datamodels.datastreams import DatastreamSchema
from conSys4Py.datamodels.api_utils import Link
from pydantic import BaseModel, ConfigDict, Field, SerializeAsAny
from shapely import Point
Expand Down
2 changes: 1 addition & 1 deletion oshconnect/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import requests
import websockets
from conSys4Py import APIResourceTypes
from conSys4Py.constants import APIResourceTypes
from conSys4Py.datamodels.observations import ObservationOMJSONInline
from conSys4Py.datamodels.swe_components import DataRecordSchema

Expand Down
7 changes: 5 additions & 2 deletions oshconnect/osh_connect_datamodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import uuid
from dataclasses import dataclass, field

from conSys4Py import APIResourceTypes, DataRecordSchema
from conSys4Py.constants import APIResourceTypes
from conSys4Py.core.default_api_helpers import APIHelper
from conSys4Py.datamodels.datastreams import SWEDatastreamSchema
from conSys4Py.datamodels.encoding import JSONEncoding
from conSys4Py.datamodels.swe_components import DataRecordSchema

from .core_datamodels import DatastreamResource, ObservationResource, SystemResource
from .timemanagement import TimeInstant, TimePeriod, TimeUtils
Expand Down Expand Up @@ -188,7 +189,9 @@ def from_system_resource(system_resource: SystemResource):
# case 1: has properties a la geojson
if 'properties' in other_props:
new_system = System(name=other_props['properties']['name'],
label=other_props['properties']['name'])
label=other_props['properties']['name'],
urn=other_props['properties']['uid'],
resource_id=system_resource.system_id)
else:
new_system = System(name=system_resource.name,
label=system_resource.label, urn=system_resource.urn,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"
consys4py = { git = "https://github.com/Botts-Innovative-Research/CSAPI4Py.git", branch = "dev" }
conSys4Py = { git = "https://github.com/Botts-Innovative-Research/CSAPI4Py.git", branch = "dev" }
swecommondm = { git = "https://github.com/ChainReaction31/SWECommonDMPython.git", branch = "master" }
pydantic = "^2.7.4"
shapely = "^2.0.4"
Expand Down
7 changes: 4 additions & 3 deletions tests/test_oshconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@


class TestOSHConnect:
TEST_PORT = 8282

def test_time_period(self):
tp = TimePeriod(start="2024-06-18T15:46:32Z", end="2024-06-18T20:00:00Z")
Expand Down Expand Up @@ -44,15 +45,15 @@ def test_oshconnect_create(self):

def test_oshconnect_add_node(self):
app = OSHConnect(name="Test OSH Connect")
node = Node(address="http://localhost", port=8585)
node = Node(address="http://localhost", port=self.TEST_PORT, protocol="http", username="admin", password="admin")
# node.add_basicauth("admin", "admin")
app.add_node(node)
assert len(app._nodes) == 1
assert app._nodes[0] == node

def test_find_systems(self):
app = OSHConnect(name="Test OSH Connect")
node = Node(address="localhost", port=8585, username="admin", password="admin", protocol="http")
node = Node(address="localhost", port=self.TEST_PORT, username="admin", password="admin", protocol="http")
# node.add_basicauth("admin", "admin")
app.add_node(node)
app.discover_systems()
Expand All @@ -62,7 +63,7 @@ def test_find_systems(self):

def test_oshconnect_find_datastreams(self):
app = OSHConnect(name="Test OSH Connect")
node = Node(address="localhost", port=8585, username="admin", password="admin", protocol="http")
node = Node(address="localhost", port=self.TEST_PORT, username="admin", password="admin", protocol="http")
app.add_node(node)
app.discover_systems()

Expand Down
Loading