MHK ISDB/Help/Measurement Properties

< MHK ISDB‎ | Help
Jump to: navigation, search

The MHK Instrumentation & Sensor Database (MHK ISDB) is a complex semantic mediawiki database. Each device uses a template to assign property values, these assigned values are then stored in the database. Some of these properties, such as the measurement properties, only allow certain values to be stored.

In the MHK ISDB, the measurement properties work slightly different than a typical semantic relationship. Due to the complex nature of these measurements, the architecture is deeper than with typical semantic mediawiki properties.

There are 3 levels of measurement properties: MeasurementType, MeasurementAttribute and Measurement.

MeasurementType
  • MeasurementType is the most meta level in the measurement property hierarchy.
  • This measurement property determines what "category" the lower level measurements belong to.
  • Each device may have one or more assigned MeasurementType values.
  • Allowed values are set by the property page.
MeasurementAttribute
  • MeasurementAttribute is the middle level in the measurement property hierarchy.
  • This property is a secondary attribute descriptor of MeasurementType, and helps determine the independent measurements that may be assigned to the device.
  • Each device may have one or more assigned MeasurementAttribute values.
  • Allowed values are set by the property page, using a query to collect all allowed values of lineage properties (e.g. - OceanographicAttribute).
Measurement
  • Measurement is the most refined level in the measurement property hierarchy.
  • This property is a tertiary descriptor of MeasurementType.
  • This property is a secondary descriptor of MeasurementAttribute.
  • This property defines the independent measurements obsverved/collected by the device.
  • Each device may have one or more assigned Measurement values.
  • Allowed values are set by the property page, using a query to collect all allowed values of lineage properties (e.g. - CurrentMeasurement, IceMeasurement, ...)


MHK ISDB Measurement Property Architecture

 
List of Allowed Values

How it Works

Allowed Values
  1. MeasurementType
  2. The allowed values for MeasurementType are set in typical fashion on the property page

    |allowsvalues=Meteorological;Oceanographic;Structural Loads;Electric & Power;Hydraulic;Pneumatic;Motion;Location;Acoustic Noise;Condition Monitoring;


  3. MeasurementAttribute
  4. The allowed values for MeasurementAttribute are the collective of allowed values of all lineage properties (see chart). On Property:MeasurementAttribute, there is a query to collect values for each lineage property and place them in an array:

    [[:Property: OceanographicAttribute]] {{#arraydefine: attr2|{{#ask: [[Property: OceanographicAttribute]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}

    These arrays are then printed to set MeasurementAttribute allowed values:

    |allowsvalues={{#arrayprint: attr1|;}};{{#arrayprint: attr2|;}};{{#arrayprint: attr3|;}};{{#arrayprint: attr4|;}};{{#arrayprint: attr5|;}};{{#arrayprint: attr6|;}};{{#arrayprint: attr7|;}};


  5. Measurement
  6. The allowed values for Measurement are the collective of allowed values of all lineage properties (see chart). On Property:Measurement, there is a query to collect values for each lineage property and place them in an array:

    [[:Property: CurrentMeasurement]] {{#arraydefine: attr4|{{#ask: [[Property: CurrentMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}
    [[:Property: IceMeasurement]] {{#arraydefine: attr5|{{#ask: [[Property: IceMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}
    [[:Property: TidalMeasurement]] {{#arraydefine: attr6|{{#ask: [[Property: TidalMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}
    [[:Property: WaterMeasurement]] {{#arraydefine: attr7|{{#ask: [[Property: WaterMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}
    [[:Property: WaveMeasurement]] {{#arraydefine: attr8|{{#ask: [[Property: WaveMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}

    These arrays are then printed to set Measurement allowed values:

    |allowsvalues={{#arrayprint: attr1|;}};{{#arrayprint: attr2|;}};{{#arrayprint: attr3|;}};{{#arrayprint: attr4|;}};{{#arrayprint: attr5|;}};{{#arrayprint: attr6|;}};{{#arrayprint: attr7|;}};{{#arrayprint: attr8|;}};{{#arrayprint: attr9|;}};{{#arrayprint: attr10|;}};{{#arrayprint: attr11|;}};{{#arrayprint: attr12|;}};{{#arrayprint: attr13|;}};{{#arrayprint: attr14|;}};{{#arrayprint: attr15|;}};{{#arrayprint: attr16|;}};{{#arrayprint: attr17|;}};{{#arrayprint: attr18|;}};{{#arrayprint: attr19|;}};{{#arrayprint: attr20|;}};{{#arrayprint: attr21|;}};{{#arrayprint: attr22|;}};{{#arrayprint: attr23|;}};{{#arrayprint: attr24|;}};{{#arrayprint: attr25|;}};{{#arrayprint: attr26|;}};{{#arrayprint: attr27|;}};{{#arrayprint: attr28|;}};


Setting Measurements in Templates
Measurement properties are set for each device by their respective template (Template:MHK Instrument or Template:MHK Sensor). The template sets the following properties for each device: Property:MeasurementType, Property:MeasurementAttribute and Property:Measurement.
Lineage properties are not used for devices. They are used strictly to manage allowed values for the measurement properties set by the template.
{{#arraymap:{{{MeasurementType|}}}|,|@@|[[MeasurementType::@@]]}}

{{#if:{{{MeasurementAttribute|}}}|{{#arraymap:{{{MeasurementAttribute|}}}|,|@@|{{#set:MeasurementAttribute=@@}}|}}|}}

{{#vardefine:measurements|{{{Measurement|}}}}}
<ul>{{#arraymap:{{#var:measurements}}|,|@@|<li>[[Measurement::@@]]</li>|}}</ul>


Listing Measurements in Forms
Device forms (Form:MHK Instrument or Form:MHK Sensor) call on all measurement properties to handle displaying the proper checkbox options. Selection options are updated based on what measurement options are checked. For instance, the values for MeasurementAttribute are hidden until a MeasurementType is selected. Likewise, independent measurements are hidden until a measurement attribute is selected.
Example: Selecting Oceanographic in the form will display: Current, Ice, Tidal, Water and Wave. Then selecting Ice, the form will display: Density (Ice), Direction (Ice), Speed (Ice) and Thickness (Ice).
The forms use standard wiki markup to return property values for each field:
{{{field|MeasurementType|input type=checkboxes|property= MeasurementType|mandatory}}}
{{{field|MeasurementAttribute|input type=checkboxes|property=MeasurementAttribute}}}
{{{field|Measurement|input type=checkboxes|property=Measurement}}}


The forms also contain hidden divs, which hold arrays used along with JavaScript in Widget:MHK ISDB FormAssist to handle what measurement selections are available.
FORM ARRAYS

<!--MEASUREMENT ATTRIBUTES-->
<div class="propArray levelOne" data-type="Oceanographic" data-values="{{#vardefineecho: attrOceanographic|{{#ask: [[Property: OceanographicAttribute]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>

<!--MEASUREMENTS-->
<div class="propArray" data-type="Oceanographic" data-attr="Current" data-values="{{#vardefineecho: currentMeas|{{#ask: [[Property:CurrentMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>

<div class="propArray" data-type="Oceanographic" data-attr="Wave" data-values="{{#vardefineecho: waveMeas|{{#ask: [[Property:WaveMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>

<div class="propArray" data-type="Oceanographic" data-attr="Water" data-values="{{#vardefineecho: waterMeas|{{#ask: [[Property:WaterMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>

<div class="propArray" data-type="Oceanographic" data-attr="Tidal" data-values="{{#vardefineecho: tidalMeas|{{#ask: [[Property:TidalMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>

<div class="propArray" data-type="Oceanographic" data-attr="Ice" data-values="{{#vardefineecho: iceMeas|{{#ask: [[Property:IceMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>


WIDGET/JAVASCRIPT
function typeWriter(){
        //reset arrays
        measurementTypes = [];
        attributeTypes = [];
        showAttributes = [];
        showMeasurements = [];

        //find selected measurement types
        $('#measurementType label input:checked').each(function(){var checkedType = $(this).val(); measurementTypes.push(checkedType); });

        //set showAttributes array
        $('.propArray.levelOne').each(function(){
            if($.inArray($(this).data('type'), measurementTypes) > -1){$.merge(showAttributes, $(this).data('values').split(", "));}
        });

        //show measurement attributes for selected measurement types
        $('#attrOptn label').each(function(){if($.inArray($(this).find('input').val(), showAttributes) > -1){$(this).show();}else{$(this).hide().find('input').attr('checked',false);};});

        //find selected measurement types
        $('#attrOptn label input:checked').each(function(){var checkedType = $(this).val(); attributeTypes.push(checkedType); });

        //set showMeasurements array
        $('.propArray').each(function(){
            if($.inArray($(this).data('attr'), attributeTypes) > -1){$.merge(showMeasurements, $(this).data('values').split(", "));}
            //add measurements that may have a null attribute
            if($.inArray($(this).data('attr'), measurementTypes) > -1){$.merge(showMeasurements, $(this).data('values').split(", "));}
        });

        //show measurements for selected measurement attributes
        $('#measOptn label').each(function(){if($.inArray($(this).find('input').val(), showMeasurements) > -1){$(this).show();}else{$(this).hide().find('input').attr('checked',false);};});
    }


Search Facets
The facets used on the Search page are hard coded into Widget:MHK ISDB Filter.


Adding or Removing Measurements

Add a new MeasurementType

  1. Edit Property:MeasurementType
  2. Add the new value to |allowsvalues=
  3. Save Property
  4. Edit Widget:MHK ISDB Filter
  5. Add a new measurement type radio button to <div id="measurements"> in the Measurement Type section</nowiki>
  6. Save Widget
  7. Refresh Forms (Form:MHK Instrument and Form:MHK Sensor)

Adding a new MeasurementType will also require adding new MeasurementAttributes and Measurements


Add a new MeasurementAttribute

  1. Create a new property, use an existing MeasurementAttribute lineage property as a guide
    The name should be in this format: YourNewValueAttribute (e.g. - OceanographicAttribute)
  2. Edit Property:MeasurementAttribute
  3. Add a new array that queries the new property created in the previous steps
    Replace YourNewValue and X in attrX
    *[[:Property: YourNewValueAttribute]] {{#arraydefine: attrX|{{#ask: [[Property: YourNewValueAttribute]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}
  4. Print the new array in the |allowsvalues= parameter
    Replace X in attrX, also be sure to add a semicolon in between arrayprint functions
    |allowsvalues={{#arrayprint: attr1|;}};{{#arrayprint: attr2|;}};{{#arrayprint: attr3|;}};{{#arrayprint: attr4|;}};{{#arrayprint: attr5|;}};{{#arrayprint: attr6|;}};{{#arrayprint: attr7|;}};{{#arrayprint: attrX|;}}
  5. Save Property
  6. Edit Widget:MHK ISDB Filter
  7. Add a new div with class="measurementOption" to <div id="measurements">
    Replace YourNewValue
    <div id="YourNewValue" class="measurementOption filterSection" data-section="YourNewValue" style="display:none;">
        <ul class="hidden">
            <li>
                <label><input class="motionFilter" type="radio" name="Option" value="YourNewValue" checked/>YourNewValue</label>
                <a href="javascript:void(0);" class="filterOptionOnly hidden">only</a>
            </li>
        </ul>
    </div>
        
  8. Save Widget
  9. Edit Form:MHK Instrument and Form:MHK Sensor
  10. Add a new array to the form in the hidden div found at <!--Measurement Attributes-->
    Replace YourNewValue with new attribute and MeasurementType with the new attribute's related measurement type
    <div class="propArray levelOne" data-type="MeasurementType" data-values="{{#vardefineecho: attrYourNewValue|{{#ask: [[Property: YourNewValueAttribute]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>
  11. Save Forms

Adding a new MeasurementAttribute will also require adding new Measurements


Add a new Measurement

  1. Create a new property, use an existing Measurement lineage property as a guide
    The name should be in this format: YourNewValueMeasurement (e.g. - IceMeasurement)
  2. Edit Property:Measurement
  3. Add a new array that queries the new property created in the previous steps
    Replace YourNewValue and X in attrX
    *[[:Property: YourNewValueAttribute]] {{#arraydefine: attrX|{{#ask: [[Property: YourNewValueAttribute]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}
  4. Print the new array in the |allowsvalues= parameter
    Replace X in attrX, also be sure to add a semicolon in between arrayprint functions
    |allowsvalues={{#arrayprint: attr1|;}};{{#arrayprint: attr2|;}};{{#arrayprint: attr3|;}};{{#arrayprint: attr4|;}};{{#arrayprint: attr5|;}};{{#arrayprint: attr6|;}};{{#arrayprint: attr7|;}};{{#arrayprint: attr8|;}};{{#arrayprint: attr9|;}};{{#arrayprint: attr10|;}};{{#arrayprint: attr11|;}};{{#arrayprint: attr12|;}};{{#arrayprint: attr13|;}};{{#arrayprint: attr14|;}};{{#arrayprint: attr15|;}};{{#arrayprint: attr16|;}};{{#arrayprint: attr17|;}};{{#arrayprint: attr18|;}};{{#arrayprint: attr19|;}};{{#arrayprint: attr20|;}};{{#arrayprint: attr21|;}};{{#arrayprint: attr22|;}};{{#arrayprint: attr23|;}};{{#arrayprint: attr24|;}};{{#arrayprint: attr25|;}};{{#arrayprint: attr26|;}};{{#arrayprint: attr27|;}};{{#arrayprint: attr28|;}};;{{#arrayprint: attrX|;}}
  5. Save Property
  6. Edit Widget:MHK ISDB Filter
  7. Add a new div with class="measurementOption" to <div class="observedMeasurement">
    Replace YourNewValue with the new measurement and Attribute with the new measurement's related attribute
    <ul>
        <li><label><input class="measurementFilter" data-option="YourNewValue" type="checkbox" value="YourNewValue (Attribute)" checked/>YourNewValue (Attribute)</label><a href="javascript:void(0);" class="filterOptionOnly hidden">only</a></li>
    </ul> 
        
  8. Save Widget
  9. Edit Form:MHK Instrument and Form:MHK Sensor
  10. Add a new array to the form in the hidden div found at <!--Measurements-->
    Replace YourNewValue with the new measurement and Attr with the measurement's related attribute and MeasurementType with the measurement's related measurement type
    <div class="propArray" data-type="MeasurementType" data-attr="Attr" data-values="{{#vardefineecho: YourNewValueMeas|{{#ask: [[Property:YourNewValueMeasurement]]|?Allows value|format=list|mainlabel=-|headers=hide}} }}"></div>
  11. Save Forms


Remove a MeasurementType

  1. Edit Property:MeasurementType
  2. Delete the value from the |allowsvalues= list
  3. Save Property
  4. Edit Widget:MHK ISDB Filter
  5. Remove any code related to the property being removed
  6. Save Widget
  7. Refresh Forms (Form:MHK Instrument and Form:MHK Sensor)


Remove a MeasurementAttribute

  1. Delete the MeasurementAttribute lineage property (e.g. - OceanographicAttribute)
  2. Perform a null edit on Property:MeasurementAttribute
    Edit the property and save without making any changes.
  3. Edit Widget:MHK ISDB Filter
  4. Remove any code related to the property being removed
  5. Save Widget
  6. Refresh Forms (Form:MHK Instrument and Form:MHK Sensor)


Remove a Measurement

  1. Delete the Measurement lineage property (e.g. - OceanographicMeasurement)
  2. Perform a null edit on Property:Measurement
    Edit the property and save without making any changes.
  3. Edit Widget:MHK ISDB Filter
  4. Remove any code related to the property being removed
  5. Save Widget
  6. Refresh Forms (Form:MHK Instrument and Form:MHK Sensor)


Update Widget:MHK_Architecture

  1. Update the widget that displays the property map on this page to reflect changes in added/removed/changed properties
  2. Widget:MHK_Architecture


Adding or Removing Allowed Values

Edit MeasurementType Values

  1. Edit Property:MeasurementType
  2. Add/remove the value from the |allowsvalues= list
  3. Save Property
  4. Refresh Forms (Form:MHK Instrument and Form:MHK Sensor)


Edit MeasurementAttribute Values

  1. Edit the MeasurementAttribute lineage property (e.g. - OceanographicAttribute)
  2. Add/remove the value from the |allowsvalues= list
  3. Save Property
  4. Perform a null edit on Property:MeasurementAttribute
    Edit the property and save without making any changes.
  5. Refresh Forms (Form:MHK Instrument and Form:MHK Sensor)


Edit Measurement Values

  1. Edit the Measurement lineage property (e.g. - OceanographicMeasurement)
  2. Add/remove the value from the |allowsvalues= list
  3. Save Property
  4. Perform a null edit on Property:Measurement
    Edit the property and save without making any changes.
  5. Refresh Forms (Form:MHK Instrument and Form:MHK Sensor)