{"action":"opened","issue":{"url":"https://api.github.com/repos/w3c/wot/issues/281","repository_url":"https://api.github.com/repos/w3c/wot","labels_url":"https://api.github.com/repos/w3c/wot/issues/281/labels{/name}","comments_url":"https://api.github.com/repos/w3c/wot/issues/281/comments","events_url":"https://api.github.com/repos/w3c/wot/issues/281/events","html_url":"https://github.com/w3c/wot/issues/281","id":190985266,"number":281,"title":"[TF-TD] streams and compound values","user":{"login":"draggett","id":1876790,"avatar_url":"https://avatars.githubusercontent.com/u/1876790?v=3","gravatar_id":"","url":"https://api.github.com/users/draggett","html_url":"https://github.com/draggett","followers_url":"https://api.github.com/users/draggett/followers","following_url":"https://api.github.com/users/draggett/following{/other_user}","gists_url":"https://api.github.com/users/draggett/gists{/gist_id}","starred_url":"https://api.github.com/users/draggett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draggett/subscriptions","organizations_url":"https://api.github.com/users/draggett/orgs","repos_url":"https://api.github.com/users/draggett/repos","events_url":"https://api.github.com/users/draggett/events{/privacy}","received_events_url":"https://api.github.com/users/draggett/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-22T12:21:35Z","updated_at":"2016-11-22T12:21:35Z","closed_at":null,"body":"We need to consider streaming in respect to thing descriptions.\r\n\r\nI am working on a demo for access to a stream of electrocardiogram sensor readings. In the simple case there is one channel with an integer value. These are streamed at 100 Hz. One idea for the corresponding thing description is as follows:\r\n\r\n```\r\n{\r\n\tproperties: {\r\n\t\tecg: {\r\n\t\t\ttype: “number”;\r\n\t\t\tupper: 1023;\r\n\t\t\tlower: 0;\r\n\t\t\trate: 100,\r\n\t\t\tsource: “http://example.com/stream/ecg”,\r\n\t\t\tprotocol: “server-sent-events”\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nThis specifies the upper and lower bounds, the sampling rate in Hertz, the URI for the stream, and its protocol. This example omits the binding to the semantic models.\r\n\r\nA more complex example is where the stream includes linear acceleration, along three axes, in addition to the ECG voltage reading. This could be used to count the steps someone walks, as well as to indicate where ECG data may be unreliable due to the physical movement messing up the readings.\r\n\r\nHere is an example of some successive samples:\r\n\r\n```\r\n5.093750,1891.621105,-0.101894,0.698271,9.961602\r\n5.109375,-156.757717,,,\r\n5.125000,-2117.106552,-0.101894,0.698271,9.961602\r\n5.140625,-1169.248790,,,\r\n```\r\n\r\nWhich has the ECG datum, followed by the acceleration along the X, Y and Z axes.  Note that the acceleration values are missing every other sample, as the sensor operates at half the frequency of the ECG sensor. Here is one idea for the corresponding thing description:\r\n\r\n```\r\n{\r\n\t“types”: {\r\n\t\tacceleration: {\r\n\t\t\ttype: “number”,\r\n\t\t\tmin: -1.0,\r\n\t\t\tmax: 1.0,\r\n\t\t\trate: 50\r\n\t\t}\r\n\t},\r\n\tproperties: {\r\n\t\tecga: {\r\n\t\t\trate: 100,\r\n\t\t\tsource: “http://example.com/stream/ecg”,\r\n\t\t\tprotocol: “server sent events”,\r\n\t\t\tproperties: {\r\n\t\t\t\tecg: {\r\n\t\t\t\t\ttype: “number”,\r\n\t\t\t\t\tupper: 1023,\r\n\t\t\t\t\tlower: 0\r\n\t\t\t\t},\r\n\t\t\t\tx: “acceleration”,\r\n\t\t\t\ty: “acceleration”,\r\n\t\t\t\tz: “acceleration”\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```\r\nThe above illustrates how property definitions can be nested and how type names can be defined implicitly or explicitly.  Metadata can be redefined within an inner scope to override a value defined by an outer scope. This also applies to the explicit type name declarations, so that in this example, the rate for the acceleration values is 50 Hz not 100 Hz.\r\n\r\nMy demo uses Server Sent Events for streaming over HTTP. This is very easy to implement, and automatically reconnects when a connection drops.  My servers are implemented in NodeJS, and I use HTML5 and Canvas2D for the user interface."}}
{"actor":{"display_login":"draggett"}}