-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tutorial for consider and when. Better glossary, general clean-ups
- Loading branch information
1 parent
af1f810
commit 87d0c83
Showing
35 changed files
with
152 additions
and
59 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
DataTagsLib/DOCS/sphinx-source/source/code/policy-model-full.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
<policy-model> | ||
<title>Model with Lots of Metadata</title> | ||
<subtitle>An example of a policy-model with full metadata.</subtitle> | ||
<version doi="xyz.abc.eg5">2.0.4</version> | ||
<version>2.0.4</version> | ||
<date>2017-05-29</date> | ||
<keywords>Policy model, metadata, full</keywords> | ||
<authors> | ||
<person orcid="123-2345-67890"> | ||
<person orcid="123-2345-67890" url="http://www.example.com/jd"> | ||
<name>Jane Doe</name> | ||
<affiliation>Institute A</affiliation> | ||
<email>[email protected]</email> | ||
</person> | ||
<person orcid="321-2345-67890"> | ||
<name>Joe Smith</name> | ||
</person> | ||
<group> | ||
<group url="http://www.example.com/mwg"> | ||
<name>Metadata Working Group</name> | ||
<contact>[email protected]</contact> | ||
</group> | ||
|
2 changes: 2 additions & 0 deletions
2
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/ask-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
:doc:`Home <../index>` | ||
|
||
.. index:: Ask Node | ||
|
||
Ask Node | ||
======== | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/call-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
:doc:`Home <../index>` | ||
|
||
.. index:: Call Node | ||
|
||
Call Node | ||
========= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/end-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
:doc:`Home <../index>` | ||
|
||
.. index:: End Node | ||
|
||
End Node | ||
======== | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/import-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
:doc:`Home <../index>` | ||
|
||
.. index:: #import Node | ||
|
||
#Import Node | ||
============= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/reject-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
:doc:`Home <../index>` | ||
|
||
.. index:: Reject Node | ||
|
||
Reject Node | ||
=========== | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/section-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
:doc:`Home <../index>` | ||
|
||
.. index :: Section Node | ||
Section Node | ||
============ | ||
|
||
|
9 changes: 6 additions & 3 deletions
9
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/set-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
DataTagsLib/DOCS/sphinx-source/source/decision-graphs/todo-node.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
:doc:`Home <../index>` | ||
|
||
|
||
.. index:: To-do Node | ||
|
||
|
||
To-Do Node | ||
========== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
DataTagsLib/DOCS/sphinx-source/source/tutorial/call-and-end.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+302 KB
...TagsLib/DOCS/sphinx-source/source/tutorial/code/consider-when/basic-tags-dg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
DataTagsLib/DOCS/sphinx-source/source/tutorial/code/consider-when/policy-model.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<policy-model> | ||
<title>Consider and When</title> | ||
<model> | ||
<space root="DataTags">consider-when.ts</space> | ||
<graph>consider-when.dg</graph> | ||
</model> | ||
</policy-model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
DataTagsLib/DOCS/sphinx-source/source/tutorial/consider.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
:doc:`Home <../index>` / :doc:`index` | ||
|
||
=================================================== | ||
``consider`` and ``when`` and Conditional Branching | ||
=================================================== | ||
|
||
:doc:`[ask] nodes<../decision-graphs/ask-node>` specify a question to the user, and then further specify a list of possible answers, complete with a sub-graph to run for each answer. PolicyModels offers another way of branching between sub-graphs: based on the current values in the slots. This is done using the ``[consider]`` and ``[when]`` nodes. It might be useful to think about them as ``[ask]`` nodes that ask the runtime engine instead of the user. Or, for people familiar with programming, as the PolicyModels equivalent of an ``if`` statement. | ||
|
||
``Consider``\ing a Single Slot | ||
------------------------------ | ||
|
||
Consider a questionnaire pretaining to medical datasets. The granularity of the dataset in question matters a lot when one needs to decide how protected it should be. After spending some time with the user, asserting the granularity of the data, the :download:`below questionnaire <code/consider-when/consider-when.dg>` uses a :doc:`consider<../decision-graphs/consider-when-node>` node to decide whether the data should be encrypted at rest and/or while in transit. | ||
|
||
|
||
.. literalinclude :: code/consider-when/consider-when.dg | ||
:linenos: | ||
:lines: 45-55 | ||
A ``[consider]`` node has to specify the slot it is considering - this is done by the ``{slot:}`` sub-node (line 2 in the code above). It then lists the sub-graph to traverse for each option, under the ``{options:}`` sub-slot (lines 3-7). An optional ``{else:}`` sub-node (line 8) specifies what to do if none of values listed in ``{options:}`` is current when the considered slot is traversed. | ||
|
||
|
||
``when`` Considering More Than a Single Slot | ||
-------------------------------------------- | ||
|
||
The ``[consider]`` node considers only a single slot. To consider the values of a few slots, we use the ``[when]`` node. The sample code below invokes the privacy section of the questionnaire, if the data subjects are living persons, or if they are deceased persons and the data contains medical information. | ||
|
||
.. literalinclude :: code/consider-when/consider-when.dg | ||
:linenos: | ||
:lines: 18-24 | ||
The ``[when]`` node has a sub-node for each value combination that requires special action (lines 2 and 3 above). Again, an optional ``{else:}`` sub-nodes allows the model developer to specify what needs to be done in case none of the explicitly specified options match the current slot values. | ||
|
||
|
||
.. note:: :doc:`later<inference>` in this tutorial, we'll examine another way of achieving similar functionality, but in a very different way. | ||
|
||
In the :doc:`next tutorial<todo-node>`, we'll see how to create placeholder nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.