Skip to content

Commit 89c0a2d

Browse files
committed
Merge branch 'develop'
2 parents f5a298b + 63f3876 commit 89c0a2d

File tree

19 files changed

+276
-231
lines changed

19 files changed

+276
-231
lines changed
Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,68 @@
11
<*
2-
DISCLAIMER:
3-
NOT TO BE USED AS A LEGAL ADVICE
2+
DISCLAIMER:
3+
NOT TO BE USED AS A LEGAL ADVICE
44
*>
55
[#import ppra: ppra.dg ]
66
[#import medical: medical.dg ]
77
[#import ferpa: ferpa.dg ]
88
[#import dppa: dppa.dg ]
99
[#import gov: government-records.dg ]
1010
[>global-start< ask:
11-
{text: Do the data concern living persons?}
11+
{text: Do the data concern living persons?}
1212
{answers:
1313
{yes:
1414
[set: Code=green] <-- Explicit settings of colors is going away soon!
15-
[>filter-medical< ask:
16-
{text: Do the data contain health or medical information?}
17-
{answers:
18-
{yes: [call: medical>start]}}
19-
]
20-
[>filter-ppra< ask:
21-
{text: Was the data collected from students in an elementary or secondary school?}
22-
{answers:
23-
{yes: [call: ppra>start]}
24-
}
25-
]
26-
[>filter-ferpa< ask:
27-
{text: Do the data contain any information derived from ministry of education data?}
28-
{answers:
29-
{yes: [call: ferpa>start]}
30-
}]
31-
[call: gov>Gov1]
32-
[call: dppa>DPPA1]
33-
[>futures< todo: Future additions go here.]}
15+
[>filter-medical< ask:
16+
{text: Do the data contain health or medical information?}
17+
{answers:
18+
{yes: [call: medical>start]}}
19+
]
20+
[>filter-ppra< ask:
21+
{text: Was the data collected from students in an elementary or secondary school?}
22+
{answers:
23+
{yes: [call: ppra>start]}
24+
}
25+
]
26+
[>filter-ferpa< ask:
27+
{text: Do the data contain any information derived from ministry of education data?}
28+
{answers:
29+
{yes: [call: ferpa>start]}
30+
}]
31+
[call: gov>Gov1]
32+
[call: dppa>DPPA1]
33+
[>futures< todo: Future additions go here.]}
3434
{no: [set: Code=blue; Identity=noPersonData] }
35-
}]
36-
[call: dua]
37-
[end]
35+
}]
36+
[call: dua]
37+
[end]
3838

39-
[>dua< section:
40-
{title: Data Use Agreements}
41-
[>dua-ext< todo: Data use agreements]
42-
[>duaTimeLimit< ask:
43-
{text: Is there any reason why we cannot store the data indefinitely? }
44-
{answers:
45-
{no: [set: TimeLimit=none] }
46-
{yes:
47-
[ask:
48-
{text:For how long should we keep the data?}
49-
{answers:
50-
{ indefinitely: [set: TimeLimit=none] }
51-
{ 50 years: [set: TimeLimit=_50yr] }
52-
{ 5 years: [set: TimeLimit=_5yr] }
53-
{ 2 years: [set: TimeLimit=_2yr] }
54-
{ 1 year: [set: TimeLimit=_1yr] }
55-
}]}}]
56-
[>duaAdditional< ask:
57-
{text: Did the data have any restrictions on sharing, e.g. stated in an agreement or policy statement?}
58-
{answers:
59-
{yes: [set: ContractOrPolicy=yes]}
60-
{no: [set: ContractOrPolicy=no]}}
61-
]
39+
[>dua< section:
40+
{title: Data Use Agreements}
41+
[>dua-ext< todo: Data use agreements]
42+
[>duaTimeLimit< ask:
43+
{text: Is there any reason why we cannot store the data indefinitely? }
44+
{answers:
45+
{no: [set: TimeLimit=none] }
46+
{yes:
47+
[ask:
48+
{text:For how long should we keep the data?}
49+
{answers:
50+
{ indefinitely: [set: TimeLimit=none] }
51+
{ 50 years: [set: TimeLimit=_50yr] }
52+
{ 5 years: [set: TimeLimit=_5yr] }
53+
{ 2 years: [set: TimeLimit=_2yr] }
54+
{ 1 year: [set: TimeLimit=_1yr] }
55+
}]}}]
56+
[>duaAdditional< ask:
57+
{text: Did the data have any restrictions on sharing, e.g. stated in an agreement or policy statement?}
58+
{answers:
59+
{yes: [set: ContractOrPolicy=yes]}
60+
{no: [set: ContractOrPolicy=no]}
61+
}
62+
]
6263
]
6364
[end]
6465
<*
65-
DISCLAIMER:
66-
NOT TO BE USED AS A LEGAL ADVICE
66+
DISCLAIMER:
67+
NOT TO BE USED AS A LEGAL ADVICE
6768
*>

DataTagsLib/WORK/policy-models/import/cats.dg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[>iii< ask:
2+
{text: Noname node #1 }
3+
{answers:
4+
{yes: [todo: todo in cats.dg]}
5+
}
6+
]
17
[>cat< section:
28
{title: Cats}
39
[>q-cats-group< ask:

DataTagsLib/WORK/policy-models/import/dogs.dg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[>WW< ask:
2+
{text: Noname node #1 }
3+
{answers:
4+
{yes: [todo: first TODO in dogs.dg]}
5+
}
6+
]
17
[>dog< section:
28
{title: Dogs!}
39
[>q-dogType< ask:

DataTagsLib/WORK/policy-models/import/graph.dg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
[#import dogs: dogs.dg]
22
[#import cats: cats.dg]
3-
43
[>q-order< ask:
54
{text: Do the dogs first?}
65
{answers:
7-
{yes: [call: dogs>dog][call: cats>cat]}
8-
{no: [call: cats>cat][call:dogs>dog]}
6+
{yes: [call: dogs>dog]<*[call: cats>cat]*>}
7+
{no: <*[call: cats>cat]*>[call:dogs>dog]}
98
}
109
]
1110
[todo: specify mice]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
application.args=policy-models/test
1+
application.args=policy-models/import
22
work.dir=WORK

DataTagsLib/nbproject/private/private.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ javadoc.preview=true
66
<<<<<<< HEAD
77
user.properties.file=/Users/michael/Library/Application Support/NetBeans/8.1/build.properties
88
=======
9-
user.properties.file=C:\\Users\\user\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
9+
user.properties.file=/Users/michael/Library/Application Support/NetBeans/8.2/build.properties
1010
>>>>>>> 3e85a56f4c480fd33c660bb30999ba6bf4a8e64b

DataTagsLib/nbproject/private/private.xml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@
1010
<file>file:/C:/Users/user/Desktop/DataTagging/DataTaggingLibrary%20-%20import/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/parser/decisiongraph/CompilationUnit.java</file>
1111
</group>
1212
<group name="DataTags">
13-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/model/graphs/DecisionGraph.java</file>
14-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/model/types/AtomicSlot.java</file>
15-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/test/edu/harvard/iq/datatags/runtime/ChartRunningTest.java</file>
16-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/model/values/AtomicValue.java</file>
17-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/parser/decisiongraph/CompilationUnit.java</file>
18-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/parser/decisiongraph/DecisionGraphCompiler.java</file>
19-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/model/values/AggregateValue.java</file>
20-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/test/edu/harvard/iq/datatags/parser/decisiongraph/DecisionGraphParseResultTest.java</file>
21-
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/model/values/CompoundValue.java</file>
13+
<file>file:/Users/michael/Documents/PhD/IQSS/Data-Tags/DataTaggingLibrary/DataTagsLib/src/edu/harvard/iq/datatags/tools/processors/EndNodeOptimizer.java</file>
2214
</group>
2315
</open-files>
2416
</project-private>

DataTagsLib/src/edu/harvard/iq/datatags/cli/commands/StatisticsCommand.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
import edu.harvard.iq.datatags.model.types.CompoundSlot;
77
import edu.harvard.iq.datatags.model.types.SlotType;
88
import edu.harvard.iq.datatags.model.types.ToDoSlot;
9+
import static edu.harvard.iq.datatags.util.CollectionHelper.C;
10+
import java.util.HashMap;
911
import java.util.List;
12+
import java.util.Map;
13+
import java.util.concurrent.atomic.AtomicInteger;
1014

1115
/**
1216
* Prints statistics about the questionnaire.
@@ -31,6 +35,18 @@ public void execute(CliRunner rnr, List<String> args) throws Exception {
3135
rnr.println("Slot count: %d", cnt.slotsCount);
3236
rnr.println("Value count: %d", cnt.valuesCount);
3337
rnr.println("Decision graph nodes: %d", rnr.getModel().getDecisionGraph().nodeIds().size() );
38+
final Map<Class<?>, AtomicInteger> countsByClass = new HashMap<>();
39+
rnr.getModel().getDecisionGraph().nodes().forEach(
40+
nd -> countsByClass.computeIfAbsent(nd.getClass(), c -> new AtomicInteger(0)).incrementAndGet() );
41+
42+
final Map<String, Integer> counts = new HashMap<>();
43+
countsByClass.entrySet().forEach( ent -> {
44+
String className = C.last(ent.getKey().getName().split("\\."));
45+
counts.put(className, ent.getValue().intValue());
46+
});
47+
48+
counts.entrySet().stream().sorted((e1,e2)->e2.getValue().compareTo(e1.getValue()))
49+
.forEach( ent -> rnr.println(" %s\t%d", ent.getKey(), ent.getValue()));
3450
}
3551

3652
}

DataTagsLib/src/edu/harvard/iq/datatags/mains/DecisionGraphValidations.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import edu.harvard.iq.datatags.parser.decisiongraph.ast.AstNode;
1414
import edu.harvard.iq.datatags.tools.DecisionGraphAstValidator;
1515
import edu.harvard.iq.datatags.tools.NodeValidationMessage;
16-
import edu.harvard.iq.datatags.tools.RepeatIdValidator;
16+
import edu.harvard.iq.datatags.tools.DuplicateIdValidator;
1717
import edu.harvard.iq.datatags.tools.UnreachableNodeValidator;
1818
import edu.harvard.iq.datatags.tools.ValidationMessage;
1919
import edu.harvard.iq.datatags.visualizers.graphviz.GraphvizGraphNodeAstVisualizer;
@@ -66,7 +66,7 @@ public static void main(String[] args) {
6666
System.out.println("===============");
6767

6868
System.out.println("Validating repeating ids");
69-
RepeatIdValidator riv = new RepeatIdValidator();
69+
DuplicateIdValidator riv = new DuplicateIdValidator();
7070
List<ValidationMessage> repeatIdMessages = riv.validate(refs);
7171
if (repeatIdMessages.size() > 0) {
7272
System.out.println(repeatIdMessages);

DataTagsLib/src/edu/harvard/iq/datatags/parser/PolicyModelLoader.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import edu.harvard.iq.datatags.tools.DecisionGraphAstValidator;
1515
import edu.harvard.iq.datatags.tools.DecisionGraphValidator;
1616
import edu.harvard.iq.datatags.tools.DuplicateNodeAnswerValidator;
17-
import edu.harvard.iq.datatags.tools.RepeatIdValidator;
17+
import edu.harvard.iq.datatags.tools.DuplicateIdValidator;
1818
import edu.harvard.iq.datatags.tools.UnreachableNodeValidator;
1919
import edu.harvard.iq.datatags.tools.ValidationMessage;
2020
import edu.harvard.iq.datatags.tools.processors.YesNoAnswersSorter;
@@ -32,7 +32,7 @@
3232
* Loads policy models from {@link PolicyModelData}. Each loader has a list of
3333
* validators and post-processors that is runs in the appropriate places.
3434
*
35-
* Use the class' statis methods to obtain instances that fit certain contexts
35+
* Use the class' static methods to obtain instances that fit certain contexts
3636
* (e.g. dev, production).
3737
*
3838
* @author michael
@@ -50,7 +50,7 @@ public static PolicyModelLoader verboseLoader() {
5050
PolicyModelLoader res = new PolicyModelLoader();
5151

5252
res.add( new DuplicateNodeAnswerValidator() );
53-
res.add( new RepeatIdValidator() );
53+
res.add(new DuplicateIdValidator() );
5454

5555
res.add( new UnreachableNodeValidator() );
5656

@@ -64,7 +64,7 @@ public static PolicyModelLoader productionLoader() {
6464
PolicyModelLoader res = new PolicyModelLoader();
6565

6666
res.add( new DuplicateNodeAnswerValidator() );
67-
res.add( new RepeatIdValidator() );
67+
res.add(new DuplicateIdValidator() );
6868

6969

7070
res.add( new EndNodeOptimizer() );
@@ -124,22 +124,23 @@ public PolicyModelLoadResult load( PolicyModelData data ) {
124124
}
125125
model.setDecisionGraph(dg);
126126

127+
// Load localizations
128+
Path localizations;
129+
try {
130+
localizations = ciResolve(data.getMetadataFile().getParent(), LocalizationLoader.LOCALIZATION_DIRECTORY_NAME);
131+
if ( localizations != null ) {
132+
Files.list(localizations).filter(Files::isDirectory)
133+
.map(p->p.getFileName().toString())
134+
.forEach(res.getModel()::addLocalization);
135+
}
136+
} catch (IOException ex) {
137+
res.addMessage( new ValidationMessage(Level.WARNING, "IO Error reading localizations: " + ex.getMessage()));
138+
}
139+
127140
} else {
128141
res.addMessage( new ValidationMessage(Level.ERROR, "Failed to create decision graph; see previous errors.") );
129142
}
130143

131-
// Load localizations
132-
Path localizations;
133-
try {
134-
localizations = ciResolve(data.getMetadataFile().getParent(), LocalizationLoader.LOCALIZATION_DIRECTORY_NAME);
135-
if ( localizations != null ) {
136-
Files.list(localizations).filter(Files::isDirectory)
137-
.map(p->p.getFileName().toString())
138-
.forEach(res.getModel()::addLocalization);
139-
}
140-
} catch (IOException ex) {
141-
res.addMessage( new ValidationMessage(Level.WARNING, "IO Error reading localizations: " + ex.getMessage()));
142-
}
143144

144145
} catch (NoSuchFileException ex) {
145146
res.addMessage( new ValidationMessage(Level.ERROR, "File " + ex.getMessage() + " cannot be found."));

0 commit comments

Comments
 (0)