Add logs
This commit is contained in:
parent
6d9ed080ce
commit
37125f14fd
@ -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);
|
||||||
|
|
||||||
|
|||||||
@ -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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user