Skip to content

Commit 5a07ec6

Browse files
authored
Merge pull request #20 from QualitativeDataRepository/QDAS-redacted
QDAS Redacted
2 parents dccd54c + 695e702 commit 5a07ec6

9 files changed

Lines changed: 571 additions & 110 deletions

File tree

5.2curlcommands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
754754
"toolName":"jupyterPreviewer",
755755
"scope":"file",
756756
"types":["preview"],
757-
"toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/betatest/JupyterPreview.html",
757+
"toolUrl":"https://qualitativedatarepository/dataverse-previewers/previewers/betatest/JupyterPreview.html",
758758
"toolParameters": {
759759
"queryParameters":[
760760
{"fileid":"{fileId}"},
@@ -781,7 +781,7 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
781781
"toolName":"mapShpPreviewer",
782782
"scope":"file",
783783
"types":["preview"],
784-
"toolUrl":"qualitativedatarepository.github.io/dataverse-previewers/previewers/v1.5/MapShpPreview.html",
784+
"toolUrl":"https://qualitativedatarepository.github.io/dataverse-previewers/previewers/v1.5/MapShpPreview.html",
785785
"toolParameters": {
786786
"queryParameters":[
787787
{"fileid":"{fileId}"},
@@ -810,7 +810,7 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
810810
"toolName":"mapShpPreviewer",
811811
"scope":"file",
812812
"types":["preview"],
813-
"toolUrl":"qualitativedatarepository.github.io/dataverse-previewers/previewers/v1.5/MapRasterPreview.html",
813+
"toolUrl":"https://qualitativedatarepository.github.io/dataverse-previewers/previewers/v1.5/MapRasterPreview.html",
814814
"toolParameters": {
815815
"queryParameters":[
816816
{"fileid":"{fileId}"},

6.1curlcommands.md

Lines changed: 126 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,61 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
20082008
These previewers support the [REFI-QDA standard](https://www.qdasoftware.org/) format for qualitative research files.
20092009
They allow viewing of the authors, codes, sources, annotations, and relationships listed in the codebook,
20102010
with added functionality to view code use frequency and filter by the entries in these tables. The REFI-QDA Project previewer
2011-
also allows viewing the annotation anchor text retrieved from the zipped source files.
2011+
also allows viewing the annotation anchor text retrieved from the zipped source files and download of the original and text versions of source files.
2012+
Further, for users who can edit the dataset, the Codebook and Project Previewers allow creation of "redacted" versions that become publicly previewable
2013+
even when the datafiles themselves are restricted. The "View *" previewers will only show when the user can download the datafile, while the "View Redacted *" previewers
2014+
will show all the time. As the first available previewer shows as the default one in the dataset files table, it is recommended that these previewers
2015+
be installed in the order shown below (so the full previewers are the default for those who can download the datafile).
2016+
2017+
2018+
2019+
```bash
2020+
curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
2021+
'{
2022+
"displayName":"View REFI-QDA Codebook",
2023+
"description":"View the contents of a REFI-QDA codebook file.",
2024+
"toolName":"refiqdaCodebookPreviewer",
2025+
"scope":"file",
2026+
"types":["preview"],
2027+
"toolUrl":"/dataverse-previewers/previewers/betatest/REFIQDAPreview.html",
2028+
"toolParameters": {
2029+
"queryParameters":[
2030+
{"fileid":"{fileId}"},
2031+
{"siteUrl":"{siteUrl}"},
2032+
{"datasetid":"{datasetId}"},
2033+
{"datasetversion":"{datasetVersion}"},
2034+
{"locale":"{localeCode}"}
2035+
]
2036+
},
2037+
"contentType":"text/x-xml-refiqda",
2038+
"allowedApiCalls": [
2039+
{
2040+
"name": "retrieveFileContents",
2041+
"httpMethod": "GET",
2042+
"urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=true",
2043+
"timeOut": 3600
2044+
},
2045+
{
2046+
"name": "downloadFile",
2047+
"httpMethod": "GET",
2048+
"urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=false",
2049+
"timeOut": 3600
2050+
},
2051+
{
2052+
"name": "uploadRedactedFile",
2053+
"httpMethod": "POST",
2054+
"urlTemplate": "/api/v1/access/datafile/{fileId}/auxiliary/qdc/1.0",
2055+
"timeOut": 3600
2056+
},
2057+
{
2058+
"name": "getDatasetVersionMetadata",
2059+
"httpMethod": "GET",
2060+
"urlTemplate": "/api/v1/datasets/{datasetId}/versions/{datasetVersion}",
2061+
"timeOut": 3600
2062+
}
2063+
]
2064+
}'
2065+
```
20122066

20132067
```bash
20142068
curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
@@ -2018,7 +2072,7 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
20182072
"toolName":"refiqdaProjectPreviewer",
20192073
"scope":"file",
20202074
"types":["preview"],
2021-
"toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/betatest/REFIQDPXPreview.html",
2075+
"toolUrl":"/dataverse-previewers/previewers/betatest/REFIQDPXPreview.html",
20222076
"toolParameters": {
20232077
"queryParameters":[
20242078
{"fileid":"{fileId}"},
@@ -2042,6 +2096,12 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
20422096
"urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=false",
20432097
"timeOut": 3600
20442098
},
2099+
{
2100+
"name": "uploadRedactedFile",
2101+
"httpMethod": "POST",
2102+
"urlTemplate": "/api/v1/access/datafile/{fileId}/auxiliary/qdpx/1.0",
2103+
"timeOut": 3600
2104+
},
20452105
{
20462106
"name": "getDatasetVersionMetadata",
20472107
"httpMethod": "GET",
@@ -2055,12 +2115,62 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
20552115
```bash
20562116
curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
20572117
'{
2058-
"displayName":"View REFI-QDA Codebook",
2059-
"description":"View the contents of a REFI-QDA codebook file.",
2060-
"toolName":"refiqdaCodebookPreviewer",
2118+
"displayName":"View Redacted REFI-QDA Project",
2119+
"description":"View the contents of a redacted EFI-QDA project file.",
2120+
"toolName":"refiqdaRedactedProjectPreviewer",
20612121
"scope":"file",
20622122
"types":["preview"],
2063-
"toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/betatest/REFIQDAPreview.html",
2123+
"toolUrl":"/dataverse-previewers/previewers/betatest/REFIQDPXPreview.html",
2124+
"toolParameters": {
2125+
"queryParameters":[
2126+
{"fileid":"{fileId}"},
2127+
{"siteUrl":"{siteUrl}"},
2128+
{"datasetid":"{datasetId}"},
2129+
{"datasetversion":"{datasetVersion}"},
2130+
{"locale":"{localeCode}"}
2131+
]
2132+
},
2133+
"contentType":"application/x-zip-refiqda",
2134+
"requirements": {
2135+
"auxFilesExist": [
2136+
{
2137+
"formatTag": "qdpx",
2138+
"formatVersion": "1.0"
2139+
}
2140+
]
2141+
},
2142+
"allowedApiCalls": [
2143+
{
2144+
"name": "retrieveFileContents",
2145+
"httpMethod": "GET",
2146+
"urlTemplate": "/api/v1/access/datafile/{fileId}/auxiliary/qdpx/1.0?gbrecs=true",
2147+
"timeOut": 3600
2148+
},
2149+
{
2150+
"name": "downloadFile",
2151+
"httpMethod": "GET",
2152+
"urlTemplate": "/api/v1/access/datafile/{fileId}/auxiliary/qdpx/1.0?gbrecs=false",
2153+
"timeOut": 3600
2154+
},
2155+
{
2156+
"name": "getDatasetVersionMetadata",
2157+
"httpMethod": "GET",
2158+
"urlTemplate": "/api/v1/datasets/{datasetId}/versions/{datasetVersion}",
2159+
"timeOut": 3600
2160+
}
2161+
]
2162+
}'
2163+
```
2164+
2165+
```bash
2166+
curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
2167+
'{
2168+
"displayName":"View Redacted REFI-QDA Codebook",
2169+
"description":"View the contents of a redacted REFI-QDA codebook file.",
2170+
"toolName":"refiqdaRedactedCodebookPreviewer",
2171+
"scope":"file",
2172+
"types":["preview"],
2173+
"toolUrl":"/dataverse-previewers/previewers/betatest/REFIQDAPreview.html",
20642174
"toolParameters": {
20652175
"queryParameters":[
20662176
{"fileid":"{fileId}"},
@@ -2071,17 +2181,25 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
20712181
]
20722182
},
20732183
"contentType":"text/x-xml-refiqda",
2184+
"requirements": {
2185+
"auxFilesExist": [
2186+
{
2187+
"formatTag": "qdc",
2188+
"formatVersion": "1.0"
2189+
}
2190+
]
2191+
},
20742192
"allowedApiCalls": [
20752193
{
20762194
"name": "retrieveFileContents",
20772195
"httpMethod": "GET",
2078-
"urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=true",
2196+
"urlTemplate": "/api/v1/access/datafile/{fileId}/auxiliary/qdc/1.0?gbrecs=true",
20792197
"timeOut": 3600
20802198
},
20812199
{
20822200
"name": "downloadFile",
20832201
"httpMethod": "GET",
2084-
"urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=false",
2202+
"urlTemplate": "/api/v1/access/datafile/{fileId}/auxiliary/qdc/1.0?gbrecs=false",
20852203
"timeOut": 3600
20862204
},
20872205
{

previewers/betatest/REFIQDAPreview.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
<title class="refiqdaPreviewText">REFI-QDA Preview</title>
77
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
88
<script type="text/javascript" src="js/xss.js"></script>
9-
<link href="https://cdn.datatables.net/v/dt/dt-2.3.5/sb-1.8.4/sl-3.1.3/datatables.min.css" rel="stylesheet" integrity="sha384-DpDi3pDJ2463LMrQcpHQvB1a5fUBPyXzbcEwddvQf8pQoEV7wcuoPRmD80IcKSui" crossorigin="anonymous">
10-
<script src="https://cdn.datatables.net/v/dt/dt-2.3.5/sb-1.8.4/sl-3.1.3/datatables.min.js" integrity="sha384-3uEOa3r5q7Ds0Hy3F6S6bAIKatT3XgusNgosaq0b6RbFdy+AtzwpqMPmCxosv6T9" crossorigin="anonymous"></script>
11-
<script src="https://unpkg.com/@popperjs/core@2"></script>
9+
<link href="https://cdn.datatables.net/v/dt/dt-2.3.7/b-3.2.6/sl-3.1.3/datatables.min.css" rel="stylesheet" integrity="sha384-9yFi5daN2JbhIggBjwc0HdEbwVl9JkZIJtEJqe9jj1tvEQNNnBAn+kgqPlXDrSDD" crossorigin="anonymous">
10+
<script src="https://cdn.datatables.net/v/dt/dt-2.3.7/b-3.2.6/sl-3.1.3/datatables.min.js" integrity="sha384-vKlJ3Fd2BmxNNmrgkf/yAi4RQ8BJvEurqwWXHtJZYcWkIfUFJEoBxxOpSgNBOGW1" crossorigin="anonymous"></script> <script src="https://unpkg.com/@popperjs/core@2"></script>
1211
<script src="https://unpkg.com/tippy.js@6"></script>
1312
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
1413
<script type="text/javascript" src="js/refiqda.js"></script>

previewers/betatest/REFIQDPXPreview.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
<script src="https://unpkg.com/@popperjs/core@2"></script>
1010
<script src="https://unpkg.com/tippy.js@6"></script>
1111
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
12+
<script type="text/javascript" src="js/retriever.js"></script>
1213
<script type="text/javascript" src="js/refiqdpx.js"></script>
1314
<script type="text/javascript" src="js/refiqdacore.js"></script>
1415
<script type="text/javascript" src="js/ziplocal.js"></script>
1516
<script src="lib/jquery.i18n.js"></script>
1617
<script src="lib/jquery.i18n.messagestore.js"></script>
1718
<script src="lib/jquery.i18n.language.js"></script>
18-
<link href="https://cdn.datatables.net/v/dt/dt-2.3.5/sb-1.8.4/sl-3.1.3/datatables.min.css" rel="stylesheet" integrity="sha384-DpDi3pDJ2463LMrQcpHQvB1a5fUBPyXzbcEwddvQf8pQoEV7wcuoPRmD80IcKSui" crossorigin="anonymous">
19-
<script src="https://cdn.datatables.net/v/dt/dt-2.3.5/sb-1.8.4/sl-3.1.3/datatables.min.js" integrity="sha384-3uEOa3r5q7Ds0Hy3F6S6bAIKatT3XgusNgosaq0b6RbFdy+AtzwpqMPmCxosv6T9" crossorigin="anonymous"></script>
20-
<script type="text/javascript" src="js/retriever.js"></script>
19+
<link href="https://cdn.datatables.net/v/dt/dt-2.3.7/b-3.2.6/sl-3.1.3/datatables.min.css" rel="stylesheet" integrity="sha384-9yFi5daN2JbhIggBjwc0HdEbwVl9JkZIJtEJqe9jj1tvEQNNnBAn+kgqPlXDrSDD" crossorigin="anonymous">
20+
<script src="https://cdn.datatables.net/v/dt/dt-2.3.7/b-3.2.6/sl-3.1.3/datatables.min.js" integrity="sha384-vKlJ3Fd2BmxNNmrgkf/yAi4RQ8BJvEurqwWXHtJZYcWkIfUFJEoBxxOpSgNBOGW1" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.21.0/cytoscape.min.js"></script>
2121
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.21.0/cytoscape.min.js"></script>
2222
<!-- Latest compiled and minified CSS -->
2323
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"

previewers/betatest/css/refiqdas.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,19 @@
6363

6464
.tooltip-text {
6565
margin-top: 5px;
66+
}
67+
68+
label {
69+
margin-left:5px;
70+
}
71+
72+
.redacted-notice {
73+
background-color: #fffbe6; /* A light yellow background */
74+
border: 1px solid #ffe58f; /* A slightly darker yellow border */
75+
border-radius: 4px; /* Softens the corners */
76+
padding: 15px; /* Adds space inside the box */
77+
margin-bottom: 20px; /* Adds space below the notice */
78+
color: #8a6d3b; /* A dark, brownish-yellow text color for good contrast */
79+
text-align: center; /* Centers the notice text */
80+
font-weight: bold; /* Makes the text bold */
6681
}

previewers/betatest/js/refiqda.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
function writeContent(fileUrl, file, title, authors) {
2-
addStandardPreviewHeader(file, title, authors);
3-
options = {
4-
"stripIgnoreTag": true,
5-
"stripIgnoreTagBody": ['script', 'head']
6-
}; // Custom rules
7-
wait = $('<div/>').attr('id', 'waiting');
8-
$('<img/>').width('15%').attr('src','images/Loading_icon.gif').attr('id','throbber').appendTo(wait);
9-
$('<span/>').text('Retrieving File...').appendTo(wait);
10-
wait.appendTo($('.preview'));
2+
addStandardPreviewHeader(file, title, authors);
3+
options = {
4+
"stripIgnoreTag": true,
5+
"stripIgnoreTagBody": ['script', 'head']
6+
}; // Custom rules
7+
wait = $('<div/>').attr('id', 'waiting');
8+
$('<img/>').width('15%').attr('src', 'images/Loading_icon.gif').attr('id', 'throbber').appendTo(wait);
9+
$('<span/>').text('Retrieving File...').appendTo(wait);
10+
wait.appendTo($('.preview'));
1111

12-
fetch(fileUrl)
13-
.then(response => response.text())
14-
.then(data => parseData(data));
12+
if (fileUrl.includes('auxiliary/qdpx')) {
13+
redactedMode = true;
14+
} else {
15+
redactedMode = false;
16+
}
17+
fetch(fileUrl)
18+
.then(response => response.text())
19+
.then(data => parseData(data, file));
1520
}

0 commit comments

Comments
 (0)