Skip to content

Commit

Permalink
Merge pull request #242 from w3c/gregorio-updates
Browse files Browse the repository at this point in the history
Hazards technique for ONIX
  • Loading branch information
gregoriopellegrino authored Mar 12, 2024
2 parents 38e803e + 4ffff96 commit 33a7ff8
Showing 1 changed file with 101 additions and 5 deletions.
106 changes: 101 additions & 5 deletions UX-Guide-Metadata/draft/techniques/onix-metadata/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
code[id]::after {
content: "[ID: " attr(id) "]";
}
/*html::before { content: "<html>"; }*/
</style>
</head>
<body>
Expand Down Expand Up @@ -217,13 +216,13 @@ <h4>Instructions</h4>
<ol class="condition">
<li>
<span><b>IF</b> <var>all_textual_content_can_be_modified</var>:</span>
<span><b>THEN</b> display <code id="visual-adjustments-1">"Appearance can be modified"</code>.</span>
<span><b>THEN</b> display <code id="visual-adjustments-modifiable">"Appearance can be modified"</code>.</span>
</li>
<li>
<span><b>ELSE IF</b> <var>is_fixed_layout</var>:</span>
<span><b>THEN</b> display <code id="visual-adjustments-2">"Appearance cannot be modified"</code>.</span>
<span><b>THEN</b> display <code id="visual-adjustments-unmodifiable">"Appearance cannot be modified"</code>.</span>
</li>
<li><b>ELSE</b> display <code id="visual-adjustments-3">"Appearance modifiability not known"</code>.</li>
<li><b>ELSE</b> display <code id="visual-adjustments-unknown">"Appearance modifiability not known"</code>.</li>
</ol>
</section>

Expand All @@ -242,7 +241,104 @@ <h3>Charts, diagrams, and formulas</h3>
<section id="hazards">
<h3>Hazards</h3>
<p>This technique relates to <a href="https://www.w3.org/2021/09/UX-Guide-metadata-2.0/principles/#hazards">Hazards key information</a>.</p>

<p>This algorithm takes the <var>onix_record_as_text</var> argument: a UTF-8 string representing the ONIX record.</p>
<h4>Understanding the variables</h4>
<dl>
<dt><var>no_hazards_or_warnings_confirmed</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/143/00">code 00 of codelist 143</a> (No known hazards or warnings) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means there is a positive indication in the ONIX record confirming there are no associated hazard warnings with this product.</p>
</dd>
<dt><var>flashing_hazard</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/143/13">code 13 of codelist 143</a> (WARNING - Flashing hazard) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means that there is a positive indication that the product has a flashing hazard which must be displayed.</p>
</dd>
<dt><var>no_flashing_hazards</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/143/14">code 14 of codelist 143</a> (No flashing hazard warning necessary) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means there is a positive indication in the ONIX record confirming there are no flashing hazards associated with this product.</p>
</dd>
<dt><var>motion_simulation_hazard</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/143/17">code 17 of codelist 143</a> (WARNING - Motion simulation hazard) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means that there is a positive indication that the product has a motion simulation hazard which must be displayed.</p>
</dd>
<dt><var>no_motion_hazards</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/143/18">code 18 of codelist 143</a> (No motion simulation hazard warning necessary) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means there is a positive indication in the ONIX record confirming there are no motion simulation hazards associated with this product.</p>
</dd>
<dt><var>sound_hazard</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/143/15">code 15 of codelist 143</a> (WARNING - Sound hazard) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means that there is a positive indication that the product has a sound hazard which must be displayed.</p>
</dd>
<dt><var>no_sound_hazards</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/143/16">code 16 of codelist 143</a> (No sound hazard warning necessary) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means there is a positive indication in the ONIX record confirming there are no sound hazards associated with this product.</p>
</dd>
<dt><var>unknown_if_contains_hazards</var></dt>
<dd>
<p>If true it indicates that the <a href="https://ns.editeur.org/onix/en/196/08">code 08 of codelist 196</a> (Unknown accessibility) is present in the ONIX record, otherwise if false it means that the metadata is not present.</p>
<p>This means that the product has not been assessed for hazards and there is no information about potential hazards.</p>
</dd>
</dl>
<h4>Variables setup</h4>
<ol class="condition">
<li><b>LET</b> <var>onix</var> be the result of calling <a href="#pre-processing">pre processing</a> given <var>onix_record_as_text</var>.</li>
<li><b>LET</b> <var>no_hazards_or_warnings_confirmed</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "12" and ProductFormFeatureValue = "00"]</code>.</li>
<li><b>LET</b> <var>flashing_hazard</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "12" and ProductFormFeatureValue = "13"]</code>.</li>
<li><b>LET</b> <var>no_flashing_hazards</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "12" and ProductFormFeatureValue = "14"]</code>.</li>
<li><b>LET</b> <var>motion_simulation_hazard</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "12" and ProductFormFeatureValue = "17"]</code>.</li>
<li><b>LET</b> <var>no_motion_hazards</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "12" and ProductFormFeatureValue = "18"]</code>.</li>
<li><b>LET</b> <var>sound_hazard</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "12" and ProductFormFeatureValue = "15"]</code>.</li>
<li><b>LET</b> <var>no_sound_hazards</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "12" and ProductFormFeatureValue = "16"]</code>.</li>
<li><b>LET</b> <var>unknown_if_contains_hazards</var> be the result of calling <a href="#check-for-node">check for node</a> on <var>onix</var>, <code class="xpath">/ONIXMessage/Product/DescriptiveDetail/ProductFormFeature[ProductFormFeatureType = "09" and ProductFormFeatureValue = "08"]</code>.</li>
</ol>
<h4>Instructions</h4>
<ol class="condition">
<li>
<span><b>IF</b> <var>no_hazards_or_warnings_confirmed</var> <b>OR</b> (<var>no_flashing_hazards</var> <b>AND</b> <var>no_motion_hazards</var> <b>AND</b> <var>no_sound_hazards</var>):</span>
<span><b>THEN</b> display <code id="hazards-none">"No hazards"</code>.</span>
</li>
<li>
<span><b>ELSE IF</b> <var>flashing_hazard</var> <b>OR</b> <var>motion_simulation_hazard</var> <b>OR</b> <var>sound_hazard</var>:</span>
<span><b>THEN</b> <b>LET</b> <var>hazards</var> be an empty array.</span>
<ol class="condition">
<li>
<span><b>IF</b> <var>flashing_hazard</var>:</span>
<span><b>THEN</b> <b>APPEND</b> <code id="hazards-flashing">"flashing"</code> to <var>hazards</var>.</span>
</li>
<li>
<span><b>IF</b> <var>motion_simulation_hazard</var>:</span>
<span><b>THEN</b> <b>APPEND</b> <code id="hazards-motion">"motion"</code> to <var>hazards</var>.</span>
</li>
<li>
<span><b>IF</b> <var>sound_hazard</var>:</span>
<span><b>THEN</b> <b>APPEND</b> <code id="hazards-sound">"sound"</code> to <var>hazards</var>.</span>
</li>
<li><b>LET</b> <var>hazards_string</var> be the result of:
<ul class="condition">
<li>calling join on <var>hazards</var> with the separator <code>", "</code></li>
<li>making uppercase the first character</li>
<li>replacing the last occurence of <code>", "</code> with <code id="join-array-and">" and "</code></li>
<li>concatenating <code id="hazards-plural">" hazards"</code> to the end of the string <b>IF</b> (length of <var>hazards</var>) > 1 <b>ELSE</b> concatenating <code id="hazards-singular">" hazard"</code> to the end of the string.</li>
</ul>
</li>
<li>display <var>hazards_string</var>.</li>
</ol>
</li>
<li>
<span><b>ELSE IF</b> <var>unknown_if_contains_hazards</var>:</span>
<span><b>THEN</b> display <code id="hazards-unknown">"The presence of hazards is unknown"</code>.</span>
</li>
<li>
<b>ELSE</b> display <code id="hazards-no-metadata">"No information about possible hazards"</code>.
<p class="note">This key information can be hidden if metadata is missing.</p>
</li>
</ol>
</section>

<section id="conformance-group">
Expand Down

0 comments on commit 33a7ff8

Please sign in to comment.