Only add manual redactions, if they are approved
This commit is contained in:
parent
467daee2d2
commit
78bd529bc7
@ -17,7 +17,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.iqser.red.service</groupId>
|
<groupId>com.iqser.red.service</groupId>
|
||||||
<artifactId>redaction-service-api-v1</artifactId>
|
<artifactId>redaction-service-api-v1</artifactId>
|
||||||
<version>1.1.3</version>
|
<version>1.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- This dependency contains annotations that are used in specifying REST endpoints. -->
|
<!-- This dependency contains annotations that are used in specifying REST endpoints. -->
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import com.iqser.red.service.redaction.report.v1.api.model.MultiFileRedactionLog;
|
import com.iqser.red.service.redaction.report.v1.api.model.MultiFileRedactionLog;
|
||||||
import com.iqser.red.service.redaction.report.v1.server.utils.ResourceLoader;
|
import com.iqser.red.service.redaction.report.v1.server.utils.ResourceLoader;
|
||||||
|
import com.iqser.red.service.redaction.v1.model.Status;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ReportGenerationService {
|
public class ReportGenerationService {
|
||||||
@ -49,6 +50,9 @@ public class ReportGenerationService {
|
|||||||
multiFileRedactionLog.getRedactionLogs().forEach(fileRedactionLog -> {
|
multiFileRedactionLog.getRedactionLogs().forEach(fileRedactionLog -> {
|
||||||
fileRedactionLog.getRedactionLogEntry().forEach(redactionLogEntry -> {
|
fileRedactionLog.getRedactionLogEntry().forEach(redactionLogEntry -> {
|
||||||
if(redactionLogEntry.isRedacted()) {
|
if(redactionLogEntry.isRedacted()) {
|
||||||
|
if(redactionLogEntry.isManual() && !redactionLogEntry.getStatus().equals(Status.APPROVED)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
Set<Integer> pages = new HashSet<>();
|
Set<Integer> pages = new HashSet<>();
|
||||||
redactionLogEntry.getPositions().forEach(position -> {
|
redactionLogEntry.getPositions().forEach(position -> {
|
||||||
pages.add(position.getPage());
|
pages.add(position.getPage());
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class RedactionReportIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testReportGeneration() throws IOException {
|
public void testReportGeneration() throws IOException {
|
||||||
|
|
||||||
ClassPathResource redactionLogResource = new ClassPathResource("files/RedactionLog.txt");
|
ClassPathResource redactionLogResource = new ClassPathResource("files/RedactionLogManual.txt");
|
||||||
|
|
||||||
RedactionLog redactionLog = objectMapper.readValue(redactionLogResource.getInputStream(), RedactionLog.class);
|
RedactionLog redactionLog = objectMapper.readValue(redactionLogResource.getInputStream(), RedactionLog.class);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public class RedactionReportIntegrationTest {
|
|||||||
|
|
||||||
ReportResult reportResult = redactionReportController.generateReport(multiFileRedactionLog);
|
ReportResult reportResult = redactionReportController.generateReport(multiFileRedactionLog);
|
||||||
|
|
||||||
try (FileOutputStream fileOutputStream = new FileOutputStream("/tmp/document.docx")) {
|
try (FileOutputStream fileOutputStream = new FileOutputStream("/tmp/document2.docx")) {
|
||||||
fileOutputStream.write(reportResult.getDocument());
|
fileOutputStream.write(reportResult.getDocument());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,416 @@
|
|||||||
|
{
|
||||||
|
"redactionLogEntry": [
|
||||||
|
{
|
||||||
|
"id": "e5be0f1d941bbb92a068e198648d06c4",
|
||||||
|
"type": "name",
|
||||||
|
"value": "Robinson N.",
|
||||||
|
"reason": "Not redacted because row is not a vertebrate study",
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0.8,
|
||||||
|
0.8,
|
||||||
|
0.8
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 142.04396,
|
||||||
|
"y": 241.282
|
||||||
|
},
|
||||||
|
"width": 7.648056,
|
||||||
|
"height": 42.43087,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 3,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "0295bbdff66926ebb57b03641bba7ba8",
|
||||||
|
"type": "address",
|
||||||
|
"value": "Syngenta Crop Protection AG, Basel, Switzerland",
|
||||||
|
"reason": "Not redacted because row is not a vertebrate study",
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0.8,
|
||||||
|
0.8,
|
||||||
|
0.8
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 289.44595,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 82.51475,
|
||||||
|
"page": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 298.67056,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 75.32377,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 4,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "1bd556e9b3dd82987f9775b19bb26fa4",
|
||||||
|
"type": "address",
|
||||||
|
"value": "RCC Ltd., Itingen, Switzerland",
|
||||||
|
"reason": "Not redacted because row is not a vertebrate study",
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0.8,
|
||||||
|
0.8,
|
||||||
|
0.8
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 307.89517,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 61.670967,
|
||||||
|
"page": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 316.99985,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 38.104286,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 4,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "e4eb6f849b60753c59897d1da21f3d83",
|
||||||
|
"type": "hint_only",
|
||||||
|
"value": "N",
|
||||||
|
"reason": null,
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0,
|
||||||
|
0.9882353,
|
||||||
|
0.69411767
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 145.03896,
|
||||||
|
"y": 448.34
|
||||||
|
},
|
||||||
|
"width": 7.648056,
|
||||||
|
"height": 4.000008,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 3,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "76dcc148fca080479fb3856d6e404813",
|
||||||
|
"type": "address",
|
||||||
|
"value": "Syngenta Crop Protection AG, Basel, Switzerland",
|
||||||
|
"reason": "Not redacted because row is not a vertebrate study",
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0.8,
|
||||||
|
0.8,
|
||||||
|
0.8
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 169.62755,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648056,
|
||||||
|
"height": 82.51475,
|
||||||
|
"page": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 178.73225,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648056,
|
||||||
|
"height": 75.32377,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 3,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "109c034945053697a8c3ff5449d4dbd5",
|
||||||
|
"type": "name",
|
||||||
|
"value": "Wolf S.",
|
||||||
|
"reason": "Not redacted because row is not a vertebrate study",
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0.8,
|
||||||
|
0.8,
|
||||||
|
0.8
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 261.87195,
|
||||||
|
"y": 241.282
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 26.739037,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 4,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "8d4060e4761dfccfdaa6310d6e9c3407",
|
||||||
|
"type": "hint_only",
|
||||||
|
"value": "N",
|
||||||
|
"reason": null,
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0,
|
||||||
|
0.9882353,
|
||||||
|
0.69411767
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 264.88797,
|
||||||
|
"y": 448.34
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 4.000008,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 4,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "6b1338e3a108d3993c6da186f57ea019",
|
||||||
|
"type": "vertebrate",
|
||||||
|
"value": "rats",
|
||||||
|
"reason": null,
|
||||||
|
"redacted": false,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 381.84018,
|
||||||
|
"y": 377.10638
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 12.379707,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 5,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "258d1236aa4ff9de4260a9d4284efdc5",
|
||||||
|
"type": "name",
|
||||||
|
"value": "Casey, H.W.",
|
||||||
|
"reason": "Redacted because Section contains Vertebrate",
|
||||||
|
"redacted": true,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 421.61328,
|
||||||
|
"y": 241.282
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 42.66442,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 5,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "0836727c3508a0b2ea271da69c04cc2f",
|
||||||
|
"type": "address",
|
||||||
|
"value": "Toxigenics, Inc., Decatur, IL 62526, USA",
|
||||||
|
"reason": "Redacted because Section contains Vertebrate",
|
||||||
|
"redacted": true,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 400.16907,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 91.46436,
|
||||||
|
"page": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 409.39368,
|
||||||
|
"y": 327.567
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 38.232735,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 5,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "0372ec83feed162bdd478b201027bc25",
|
||||||
|
"type": "name",
|
||||||
|
"value": "Salamon, C.M.",
|
||||||
|
"reason": "Redacted because Section contains Vertebrate",
|
||||||
|
"redacted": true,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 394.0594,
|
||||||
|
"y": 241.282
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 32.012077,
|
||||||
|
"page": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 403.16406,
|
||||||
|
"y": 241.282
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 18.487892,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 5,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "8734c14e72b7750de7637627ed5d572c",
|
||||||
|
"type": "name",
|
||||||
|
"value": "Smith, S.H.",
|
||||||
|
"reason": "Redacted because Section contains Vertebrate",
|
||||||
|
"redacted": true,
|
||||||
|
"section": "Table in: ",
|
||||||
|
"color": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 412.38867,
|
||||||
|
"y": 241.282
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 39.300346,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 5,
|
||||||
|
"manual": false,
|
||||||
|
"status": null,
|
||||||
|
"hint": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2f4459be7301d8689a0f405399e55d69",
|
||||||
|
"type": "name",
|
||||||
|
"value": null,
|
||||||
|
"reason": "Manual Redaction",
|
||||||
|
"redacted": true,
|
||||||
|
"section": null,
|
||||||
|
"color": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"topLeft": {
|
||||||
|
"x": 375.61096,
|
||||||
|
"y": 241.282
|
||||||
|
},
|
||||||
|
"width": 7.648041,
|
||||||
|
"height": 43.72262,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionNumber": 0,
|
||||||
|
"manual": true,
|
||||||
|
"status": "APPROVED",
|
||||||
|
"hint": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dictionaryVersion": 9,
|
||||||
|
"rulesVersion": 2,
|
||||||
|
"filename": "Single Table.pdf"
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user