This commit is contained in:
lmaldacker 2021-02-08 16:22:26 +01:00
parent 6d9ed080ce
commit 37125f14fd
8 changed files with 29 additions and 1 deletions

View File

@ -51,6 +51,8 @@ public class RedactionController implements RedactionResource {
@Override @Override
public AnalyzeResult analyze(@RequestBody AnalyzeRequest analyzeRequest) { public AnalyzeResult analyze(@RequestBody AnalyzeRequest analyzeRequest) {
log.info("Starting redaction analysis...");
try (PDDocument pdDocument = PDDocument.load(new ByteArrayInputStream(analyzeRequest.getDocument()))) { try (PDDocument pdDocument = PDDocument.load(new ByteArrayInputStream(analyzeRequest.getDocument()))) {
pdDocument.setAllSecurityToBeRemoved(true); pdDocument.setAllSecurityToBeRemoved(true);

View File

@ -39,7 +39,7 @@ public class AnnotationService {
public void annotate(PDDocument document, RedactionLog redactionLog, SectionGrid sectionGrid) throws IOException { public void annotate(PDDocument document, RedactionLog redactionLog, SectionGrid sectionGrid) throws IOException {
log.info("Annotating document.");
Map<Integer, List<RedactionLogEntry>> redactionLogPerPage = convertRedactionLog(redactionLog); Map<Integer, List<RedactionLogEntry>> redactionLogPerPage = convertRedactionLog(redactionLog);
for (int page = 1; page <= document.getNumberOfPages(); page++) { for (int page = 1; page <= document.getNumberOfPages(); page++) {
@ -56,6 +56,7 @@ public class AnnotationService {
addAnnotations(logEntries, pdPage, page); addAnnotations(logEntries, pdPage, page);
} }
} }
log.info("Finished document annotation.");
} }

View File

@ -50,6 +50,8 @@ public class EntityRedactionService {
public void processDocument(Document classifiedDoc, String ruleSetId, ManualRedactions manualRedactions) { public void processDocument(Document classifiedDoc, String ruleSetId, ManualRedactions manualRedactions) {
log.info("Processing document.");
dictionaryService.updateDictionary(ruleSetId); dictionaryService.updateDictionary(ruleSetId);
KieContainer container = droolsExecutionService.updateRules(ruleSetId); KieContainer container = droolsExecutionService.updateRules(ruleSetId);
long rulesVersion = droolsExecutionService.getRulesVersion(ruleSetId); long rulesVersion = droolsExecutionService.getRulesVersion(ruleSetId);
@ -93,6 +95,9 @@ public class EntityRedactionService {
classifiedDoc.setDictionaryVersion(dictionary.getVersion()); classifiedDoc.setDictionaryVersion(dictionary.getVersion());
classifiedDoc.setRulesVersion(rulesVersion); classifiedDoc.setRulesVersion(rulesVersion);
log.info("Finished document processing.");
} }

View File

@ -47,6 +47,8 @@ public class RedactionLogCreatorService {
public void createRedactionLog(Document classifiedDoc, int numberOfPages, ManualRedactions manualRedactions, public void createRedactionLog(Document classifiedDoc, int numberOfPages, ManualRedactions manualRedactions,
String ruleSetId) { String ruleSetId) {
log.info("Creating redaction log.");
Set<Integer> manualRedactionPages = getManualRedactionPages(manualRedactions); Set<Integer> manualRedactionPages = getManualRedactionPages(manualRedactions);
for (int page = 1; page <= numberOfPages; page++) { for (int page = 1; page <= numberOfPages; page++) {
@ -65,6 +67,8 @@ public class RedactionLogCreatorService {
addImageEntries(classifiedDoc, page, ruleSetId); addImageEntries(classifiedDoc, page, ruleSetId);
} }
} }
log.info("Finished redaction log creation.");
} }

View File

@ -39,6 +39,8 @@ public class PdfSegmentationService {
public Document parseDocument(PDDocument pdDocument) throws IOException { public Document parseDocument(PDDocument pdDocument) throws IOException {
log.info("Parsing document.");
Document document = new Document(); Document document = new Document();
List<Page> pages = new ArrayList<>(); List<Page> pages = new ArrayList<>();
@ -91,6 +93,8 @@ public class PdfSegmentationService {
sectionsBuilderService.buildSections(document); sectionsBuilderService.buildSections(document);
log.info("Finished document parsing.");
return document; return document;
} }

View File

@ -24,6 +24,8 @@ public class SectionsBuilderService {
public void buildSections(Document document) { public void buildSections(Document document) {
log.info("Building sections.");
List<AbstractTextContainer> chunkWords = new ArrayList<>(); List<AbstractTextContainer> chunkWords = new ArrayList<>();
List<Paragraph> chunkBlockList = new ArrayList<>(); List<Paragraph> chunkBlockList = new ArrayList<>();
List<Header> headers = new ArrayList<>(); List<Header> headers = new ArrayList<>();
@ -87,6 +89,9 @@ public class SectionsBuilderService {
document.setParagraphs(chunkBlockList); document.setParagraphs(chunkBlockList);
document.setHeaders(headers); document.setHeaders(headers);
document.setFooters(footers); document.setFooters(footers);
log.info("Finished section building.");
} }

View File

@ -20,6 +20,8 @@ public class RulingCleaningService {
public CleanRulings getCleanRulings(List<Ruling> rulings, float minCharWidth, float maxCharHeight) { public CleanRulings getCleanRulings(List<Ruling> rulings, float minCharWidth, float maxCharHeight) {
log.info("Getting clean rulings.");
if (!rulings.isEmpty()) { if (!rulings.isEmpty()) {
snapPoints(rulings, minCharWidth, maxCharHeight); snapPoints(rulings, minCharWidth, maxCharHeight);
} }

View File

@ -28,6 +28,8 @@ public class TableExtractionService {
public void extractTables(CleanRulings cleanRulings, Page page) { public void extractTables(CleanRulings cleanRulings, Page page) {
log.info("Extracting tables.");
List<Cell> cells = findCells(cleanRulings.getHorizontal(), cleanRulings.getVertical()); List<Cell> cells = findCells(cleanRulings.getHorizontal(), cleanRulings.getVertical());
List<TextBlock> toBeRemoved = new ArrayList<>(); List<TextBlock> toBeRemoved = new ArrayList<>();
@ -78,6 +80,9 @@ public class TableExtractionService {
} }
page.getTextBlocks().removeAll(toBeRemoved); page.getTextBlocks().removeAll(toBeRemoved);
log.info("Finished table extraction.");
} }