Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge risk assessment questionnaire #351

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d9489b5
add checklist wizard
thomasguenzel Jan 31, 2017
309b0ca
remove debug prints, add comments
thomasguenzel Feb 1, 2017
9886a7e
try to fix conflicts
thomasguenzel Feb 1, 2017
45d7d9f
change to upstream
thomasguenzel Feb 1, 2017
82c3756
use upstream mainwindow
thomasguenzel Feb 1, 2017
b3bbd71
rename checklist file
thomasguenzel Feb 1, 2017
4637ba6
fix monitor visualization bug
thomasguenzel Feb 1, 2017
3edf215
try matching code layout to upstream
thomasguenzel Feb 1, 2017
3767f2c
comments
thomasguenzel Feb 1, 2017
c9c21b4
fix typos in message.properties
thomasguenzel Feb 1, 2017
aab5a77
persist risk wizard config in model
thomasguenzel Feb 2, 2017
90d63d9
Merge branch 'master' of https://github.com/arx-deidentifier/arx
thomasguenzel Feb 2, 2017
9806971
remove debug log
thomasguenzel Feb 2, 2017
134419a
remove “last used” from messages
thomasguenzel Feb 2, 2017
85ec1d0
Initial rework of the code implementing the questionnaire
prasser Feb 2, 2017
03ddcdb
Add
prasser Feb 3, 2017
0fd6b52
Update
prasser Feb 3, 2017
66ede45
Update
prasser Feb 8, 2017
3d502fb
Update documentation
prasser Feb 9, 2017
d28f12d
Some further updates
prasser Feb 9, 2017
b65394c
Merge remote-tracking branch 'origin/master' into risk
prasser Jan 15, 2018
4c171c9
Merge remote-tracking branch 'origin/changes-for-3.7.0' into risk
prasser Jan 15, 2018
007bd18
Bugfix: rename classes
prasser Jan 15, 2018
ad4a7f0
Add further files
prasser Mar 8, 2020
ecef52c
Merge remote-tracking branch 'origin/master' into risk
prasser Mar 8, 2020
5a426fa
Add comment
prasser Mar 8, 2020
85fe39b
Merge branch 'master' into risk
prasser Feb 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions default.weights
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#Fri Feb 03 11:20:12 CET 2017
privacy.sensitive-data=1.0
mitigating.privacy-policy=1.0
privacy.injury-serious=1.0
motives.recipient-only-choice=1.0
motives=1.0
motives.recipient-wants-harm=1.0
mitigating.security-documentation=1.0
mitigating.staff-confidential=1.0
privacy.injury-risk=1.0
motives.re-identify-resources=1.0
mitigating.staff-trained=1.0
mitigating.sharing-forbids=1.0
privacy.sensitive-context=1.0
privacy.foreign-laws-risk=1.0
mitigating.physically-privatearea=1.0
mitigating.sharing-dblimits=1.0
privacy.large-database=1.0
mitigating.staff-restricted=1.0
mitigating.breach-protocol=1.0
mitigating.data-destruction=1.0
mitigating.physically-secure=1.0
motives.criminal-value=1.0
motives.re-identify-expertise=1.0
mitigating.system-full-control=1.0
mitigating.sharing-enforceable=1.0
mitigating.privacy-on-site=1.0
privacy.highly-detailed=1.0
mitigating.recipient-assessment=1.0
mitigating=1.0
privacy.no-promise=1.0
motives.re-identify-motive=1.0
privacy.no-expectation=1.0
mitigating.sharing-audits=1.0
privacy.no-guarantee=1.0
mitigating.system-backlog=1.0
privacy=1.0
7 changes: 7 additions & 0 deletions src/gui/org/deidentifier/arx/gui/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,13 @@ public void actionMenuFileSaveAs() {
public void actionMenuHelpAbout() {
main.showAboutDialog();
}

/**
* Shows the "risk analysis" dialog.
*/
public void actionMenuHelpChecklistWizard() {
main.showChecklistWizard();
}

/**
* Shows the "debug" dialog.
Expand Down
51 changes: 47 additions & 4 deletions src/gui/org/deidentifier/arx/gui/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
import org.deidentifier.arx.io.CSVSyntax;
import org.deidentifier.arx.metric.MetricConfiguration;
import org.deidentifier.arx.metric.MetricDescription;
import org.deidentifier.arx.risk.HIPAAConstants;
import org.deidentifier.arx.risk.RiskQuestionnaire;
import org.deidentifier.arx.risk.RiskQuestionnaireWeights;

/**
* This class implements a large portion of the model used by the GUI.
Expand Down Expand Up @@ -304,6 +307,14 @@ public static enum Perspective {
/** Model */
private ModelClassification classificationModel = new ModelClassification();

/* *****************************************
* RISK WIZARD
******************************************/
/** Current configuration for the risk wizard */
private RiskQuestionnaireWeights riskQuestionnaireWeights = null;
/** Current configuration for the risk wizard */
private RiskQuestionnaire riskQuestionnaire = null;

/* *****************************************
* Information about the last anonymization process
* *****************************************
Expand Down Expand Up @@ -1044,6 +1055,29 @@ public ModelRisk getRiskModel() {
return riskModel;
}

/**
* Returns the risk wizard configuration
* @return
* @throws IOException
*/
public RiskQuestionnaire getRiskQuestionnaire() throws IOException {
if (this.riskQuestionnaire == null) {
this.riskQuestionnaire = new RiskQuestionnaire(HIPAAConstants.getUSData());
}
return this.riskQuestionnaire;
}

/**
* Returns the risk wizard configuration
* @return
*/
public RiskQuestionnaireWeights getRiskQuestionnaireWeights() {
if (this.riskQuestionnaireWeights == null) {
this.riskQuestionnaireWeights = new RiskQuestionnaireWeights();
}
return this.riskQuestionnaireWeights;
}

/**
* Returns the currently selected attribute.
*
Expand Down Expand Up @@ -1108,7 +1142,7 @@ public String[] getSelectedFeaturesAsArray() {
public ARXNode getSelectedNode() {
return selectedNode;
}

/**
* Returns a set of quasi identifiers selected for risk analysis
* @return
Expand Down Expand Up @@ -1697,6 +1731,15 @@ public void setResult(final ARXResult result) {
setModified();
}

/**
* Sets the risk wizard configuration
* @param weights
* @return
*/
public void setRiskQuestionnaireWeights(RiskQuestionnaireWeights weights) {
this.riskQuestionnaireWeights = weights;
}

/**
* Sets the selected attribute.
*
Expand Down Expand Up @@ -1765,9 +1808,9 @@ public void setSelectedQuasiIdentifiers(Set<String> set) {
this.selectedQuasiIdentifiers = set;
this.setModified();
}
/**
*

/**
* Delegate method
*
* @param snapshotSize
*/
Expand Down
28 changes: 28 additions & 0 deletions src/gui/org/deidentifier/arx/gui/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ MainMenu.21=Anonymize
MainMenu.23=Create hierarchy...
MainMenu.25=Settings...
MainMenu.27=Help
MainMenu.28=Risk analysis questionnaire...
MainMenu.29=About
MainMenu.3=New project...
MainMenu.30=Find/replace...
Expand Down Expand Up @@ -377,6 +378,8 @@ MainWindow.5=Error
MainWindow.6=This dialog can only be used for data types with format
MainWindow.7=Default
MainWindow.8=Error\!
MainWindow.9=An unexpected error happened (
MainWindow.30=Error opening questionnaire
MainWindow.9=An unexpected error occurred (
Model.0a=Threshold must be in range [0,1]
Model.0b=Internal error: invalid variant of risk-based privacy model
Expand Down Expand Up @@ -1417,6 +1420,10 @@ ViewStatisticsClassificationInput.11=Sensitivity
ViewStatisticsClassificationInput.12=Baseline ROC
ViewStatisticsClassificationInput.13=Relative accuracy
ViewStatisticsClassificationInput.14=Baseline AUC
ViewStatisticsClassificationInput.15=Precision
ViewStatisticsClassificationInput.16=Recall
ViewStatisticsClassificationInput.17=Value [%]
ViewStatisticsClassificationInput.18=F-Score
ViewStatisticsClassificationInput.19=True positive rate
ViewStatisticsClassificationInput.20=False positive rate
ViewStatisticsClassificationInput.21=Target variable:
Expand All @@ -1429,6 +1436,27 @@ ViewStatisticsClassificationInput.27=Overview
ViewStatisticsClassificationInput.28=ROC curves
ViewStatisticsClassificationInput.29=Update
ViewStatisticsClassificationInput.30=Brier skill score
RiskWizard.0=Risk analysis questionnaire
RiskWizard.1=Answer the following questions
RiskWizard.2=Total
RiskWizard.3=Yes
RiskWizard.4=No
RiskWizard.5=N/A
RiskWizard.6=Edit
RiskWizard.7=Load
RiskWizard.8=Save
RiskWizard.9=Evaluation
RiskWizard.10=Risk Evaluation
RiskWizard.11=This is the risk evaluation based on your answers.
RiskWizard.12=Monitor
RiskWizard.13=Stacks
RiskWizard.15=Positive
RiskWizard.16=Neutral
RiskWizard.17=Negative
RiskWizard.18=Weighted Answers
RiskWizard.19=Visualization:
RiskWizard.20=Error saving weights
RiskWizard.21=Error loading weights
ViewStatisticsQuality.0=Attribute
ViewStatisticsQuality.1=Data type
ViewStatisticsQuality.10=Dataset-level quality
Expand Down
23 changes: 23 additions & 0 deletions src/gui/org/deidentifier/arx/gui/view/impl/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
import org.deidentifier.arx.gui.view.impl.menu.DialogTopBottomCoding;
import org.deidentifier.arx.gui.view.impl.risk.LayoutRisks;
import org.deidentifier.arx.gui.view.impl.utility.LayoutUtility;
import org.deidentifier.arx.gui.view.impl.wizard.RiskWizard;
import org.deidentifier.arx.gui.view.impl.wizard.RiskWizardDialog;
import org.deidentifier.arx.gui.worker.Worker;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
Expand Down Expand Up @@ -528,6 +530,18 @@ public void showHelpDialog(String id) {
this.showErrorDialog(Resources.getMessage("MainWindow.12"), e); //$NON-NLS-1$
}
}

/**
* Shows the checklist wizard
*/
public void showChecklistWizard() {
try {
RiskWizardDialog dialog = new RiskWizardDialog(new RiskWizard(controller));
dialog.open();
} catch (Exception e) {
controller.actionShowInfoDialog(this.getShell(), Resources.getMessage("Controller.13"), Resources.getMessage("MainWindow.30")); //$NON-NLS-1$ //$NON-NLS-2$
}
}

/**
* Shows an info dialog.
Expand Down Expand Up @@ -1077,6 +1091,15 @@ private MainMenuItem getMenuHelp() {

items.add(new MainMenuSeparator());

items.add(new MainMenuItem(Resources.getMessage("MainMenu.28"), //$NON-NLS-1$
controller.getResources().getManagedImage("information.png"), //$NON-NLS-1$
true) {
public void action(Controller controller) { controller.actionMenuHelpChecklistWizard(); }
public boolean isEnabled(Model model) { return true; }
});

items.add(new MainMenuSeparator());

items.add(new MainMenuItem(Resources.getMessage("MainMenu.29"), //$NON-NLS-1$
controller.getResources().getManagedImage("information.png"), //$NON-NLS-1$
false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,4 @@ protected Button getLoadButton(){
protected Button getSaveButton(){
return super.getButton(buttonSave);
}
}
}
113 changes: 113 additions & 0 deletions src/gui/org/deidentifier/arx/gui/view/impl/wizard/RiskWizard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* ARX: Powerful Data Anonymization
* Copyright 2012 - 2017 Fabian Prasser, Florian Kohlmayer and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.deidentifier.arx.gui.view.impl.wizard;

import java.io.IOException;

import org.deidentifier.arx.gui.Controller;
import org.deidentifier.arx.gui.resources.Resources;
import org.deidentifier.arx.risk.RiskQuestionnaire;
import org.deidentifier.arx.risk.RiskQuestionnaireSection;
import org.eclipse.jface.wizard.Wizard;

/**
* The questionnaire wizard for evaluating data sharing risks
*
* @author Thomas Guenzel
* @author Fabian Prasser
*/
public class RiskWizard extends Wizard {

/** Array containing each section's wizard page */
protected RiskWizardPageSection[] pages;

/** Final page showing the evaluation */
protected RiskWizardPageEvaluation evaluationPage;

/** The questionnaire used for the wizard */
private RiskQuestionnaire questionnaire;

/** Controller */
private Controller controller;

/**
* Create a new questionnaire wizard
*
* @param controller
* @throws IOException
*/
public RiskWizard(Controller controller) throws IOException {
super();
this.questionnaire = controller.getModel().getRiskQuestionnaire();
this.questionnaire.setWeights(controller.getModel().getRiskQuestionnaireWeights());
this.controller = controller;
this.setWindowTitle(Resources.getMessage("RiskWizard.0"));
}

@Override
public void addPages() {
// add a page for each section
RiskQuestionnaireSection[] sections = questionnaire.getSections();
pages = new RiskWizardPageSection[sections.length];
for (int i = 0; i < sections.length; i++) {
RiskQuestionnaireSection s = sections[i];
RiskWizardPageSection p = new RiskWizardPageSection(s);
this.addPage(p);
pages[i] = p;
}

// add the final evaluation page
evaluationPage = new RiskWizardPageEvaluation(questionnaire, controller);
this.addPage(evaluationPage);
}

/**
* Returns the controller
* @return
*/
public Controller getController() {
return this.controller;
}

/**
* Returns the questionnaire
* @return
*/
public RiskQuestionnaire getQuestionnaire() {
return this.questionnaire;
}

/**
* Called when the dialog is finished, saves the current weights
*/
@Override
public boolean performFinish() {
this.controller.getModel().setRiskQuestionnaireWeights(this.questionnaire.getWeights());
return true;
}

/**
* Updates the weights for each section and the evaluation
*/
protected void updateWeights() {
for (RiskWizardPageSection page : pages) {
page.updateWeights();
}
evaluationPage.updateWeights();
}
}
Loading