{"id":77,"date":"2017-03-24T23:29:49","date_gmt":"2017-03-24T23:29:49","guid":{"rendered":"https:\/\/test.warrensoft.co.uk\/wp-test\/home-hub\/?p=77"},"modified":"2018-12-08T07:32:38","modified_gmt":"2018-12-08T07:32:38","slug":"design-database-schema","status":"publish","type":"post","link":"https:\/\/test.warrensoft.co.uk\/wp-test\/2017\/03\/24\/design-database-schema\/","title":{"rendered":"Design &#8211; Database Schema"},"content":{"rendered":"<p>It&#8217;s worth stepping back at this point to take a look at the database schema, and highlight some of the key tables.<\/p>\n<p><em>Zone<\/em> &#8211; a zone is a physical sub-space within the area being monitored. Typically a room: Kitchen, Bathroom, etc. but can represent larger spaces such as Outside or Locality. Zones have x, y, z co-ordinates which enable the website to display values overlayed on a floor-plan. Sensors, Actuators and Impulses are all associated with a Zone.<\/p>\n<p><em>Measurand<\/em> &#8211; a measurand is a physical quantity to be measured e.g. Temperature, Relative Humidity, etc. Sensors are associated with a Measurand.<\/p>\n<p><em>Sensor<\/em> holds the key data for each sensor. There is no Sensor Type, but the SensorFunction column effectively has a pointer to the code which handles the reading.<\/p>\n<p>The <em>Actuator<\/em> table keeps track of the hub outputs such as fan relays, indicators, etc.<\/p>\n<p><em>Sample<\/em> is where current values are logged, which becomes the source for graphs on the website.<\/p>\n<p>The <em>EventQueue<\/em> is important, because it queues events such as a threshold being reached or an impulse from the occupant, until they can be processed by the Rules Engine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-79 aligncenter\" src=\"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-content\/uploads\/2017\/03\/DatabaseBlockDiagram-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-content\/uploads\/2017\/03\/DatabaseBlockDiagram-300x158.png 300w, https:\/\/test.warrensoft.co.uk\/wp-test\/wp-content\/uploads\/2017\/03\/DatabaseBlockDiagram.png 677w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>In the next post we will test that our controller can access the database.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s worth stepping back at this point to take a look at the database schema, and highlight some of the key tables. Zone &#8211; a zone is a physical sub-space within the area being monitored. Typically a room: Kitchen, Bathroom, etc. but can represent larger spaces such as Outside or Locality. Zones have x, y, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/test.warrensoft.co.uk\/wp-test\/2017\/03\/24\/design-database-schema\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Design &#8211; Database Schema&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-77","post","type-post","status-publish","format-aside","hentry","category-design-concepts","post_format-aside"],"_links":{"self":[{"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/posts\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":6,"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":442,"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/posts\/77\/revisions\/442"}],"wp:attachment":[{"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/test.warrensoft.co.uk\/wp-test\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}