From 9d2d3604e113fb16cb8ebd7eda541b2ab8f989d1 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Wed, 6 Dec 2023 14:29:45 -0500 Subject: [PATCH 1/5] statuslabel changes --- api/reviewer_api/resources/document.py | 2 +- .../services/docReviewerService.tsx | 2 +- web/src/constants/enum.ts | 36 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/api/reviewer_api/resources/document.py b/api/reviewer_api/resources/document.py index e398d6bc8..cde76a9fd 100644 --- a/api/reviewer_api/resources/document.py +++ b/api/reviewer_api/resources/document.py @@ -103,7 +103,7 @@ def get(requestid): "requesttype": jsonobj["requestType"] } result = documentservice().getdocuments(requestid, requestinfo["bcgovcode"]) - return json.dumps({"requeststatusid": jsonobj["requeststatusid"], "documents": result, "requestnumber":jsonobj["axisRequestId"], "requestinfo":requestinfo}), 200 + return json.dumps({"requeststatuslabel": jsonobj["requeststatuslabel"], "documents": result, "requestnumber":jsonobj["axisRequestId"], "requestinfo":requestinfo}), 200 except KeyError as error: return {'status': False, 'message': CUSTOM_KEYERROR_MESSAGE + str(error)}, 400 except BusinessException as exception: diff --git a/web/src/apiManager/services/docReviewerService.tsx b/web/src/apiManager/services/docReviewerService.tsx index 9570161d5..33107e644 100644 --- a/web/src/apiManager/services/docReviewerService.tsx +++ b/web/src/apiManager/services/docReviewerService.tsx @@ -23,7 +23,7 @@ export const fetchDocuments = ( const __files = res.data.documents.filter((d: any) => !d.attributes.incompatible); store.dispatch(setDocumentList(__files) as any); store.dispatch(setRequestNumber(res.data.requestnumber) as any); - store.dispatch(setRequestStatus(res.data.requeststatusid) as any); + store.dispatch(setRequestStatus(res.data.requeststatuslabel) as any); store.dispatch(setRequestInfo(res.data.requestinfo) as any); callback(res.data.documents); } else { diff --git a/web/src/constants/enum.ts b/web/src/constants/enum.ts index 4d27fe768..4c31ff2d5 100644 --- a/web/src/constants/enum.ts +++ b/web/src/constants/enum.ts @@ -66,27 +66,27 @@ const pageFlagTypes:pageFlagType = { }; type RequestStatesType = { - [key: string]: number + [key: string]: string } const RequestStates:RequestStatesType = { - "Open": 1, - "Call For Records": 2, - "Closed": 3, - "Redirect": 4, - "Unopened": 5, - "Intake in Progress": 6, - "Records Review": 7, - "Fee Estimate": 8, - "Consult": 9, - "Ministry Sign Off": 10, - "On Hold": 11, - "Deduplication": 12, - "Harms Assessment": 13, - "Response": 14, - "Archived": 15, - "Peer Review": 16, - "Call For Records Overdue": 17 + "Open": "open", + "Call For Records": "callforrecords", + "Closed": "closed", + "Redirect": "redirect", + "Unopened": "unopened", + "Intake in Progress": "intakeinprogress", + "Records Review": "recordsreview", + "Fee Estimate": "feeestimate", + "Consult": "consult", + "Ministry Sign Off": "ministrysignoff", + "On Hold": "onhold", + "Deduplication": "deduplication", + "Harms Assessment": "harmsassessment", + "Response": "response", + "Archived": "archived", + "Peer Review": "peerreview", + "Call For Records Overdue": "callforrecordsoverdue" }; export { From 97f8228034765b34de9c3c2f35da9e700f203582 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Dec 2023 17:10:06 -0800 Subject: [PATCH 2/5] revert to old regex for side by side image and add regex start at to test memory performance --- .../MCS.FOI.MSGToPDF/MSGFileProcessor.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs b/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs index d0e0bb009..a05a4265d 100644 --- a/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs +++ b/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs @@ -142,6 +142,7 @@ public MSGFileProcessor(Stream sourceStream) } foreach (var inlineAttachment in inlineAttachments.OrderBy(m => m.GetType().GetProperty("RenderingPosition").GetValue(m, null))) { + var startAt = 0; if (rtfInline) { if (!inlineAttachment.GetType().FullName.ToLower().Contains("message")) @@ -172,7 +173,10 @@ public MSGFileProcessor(Stream sourceStream) else if (htmlInline) { var _inlineAttachment = (Storage.Attachment)inlineAttachment; - bodyreplaced = Regex.Replace(bodyreplaced, "src=\"cid:" + _inlineAttachment.ContentId, "style=\"max-width: 700px\" src=\"data:" + _inlineAttachment.MimeType + ";base64," + Convert.ToBase64String(_inlineAttachment.Data)); + Regex regex = new Regex(").)*cid:" + _inlineAttachment.ContentId + ".*?>"); + Match match = regex.Match(bodyreplaced, startAt); + bodyreplaced = regex.Replace(bodyreplaced, "", 1, startAt); + startAt = match.Index + match.Length; foreach (KeyValuePair> attachment in attachmentsObj) { if (attachment.Value.ContainsKey("cid") && attachment.Value["cid"] == _inlineAttachment.ContentId) From 2ae04cb173b5252bac6f895f1f3a4afaa1de0cfc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Dec 2023 19:28:39 -0800 Subject: [PATCH 3/5] fix logic for starting off regex from the previous match for inline attachments --- MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs b/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs index a05a4265d..1226ddfa3 100644 --- a/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs +++ b/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs @@ -140,9 +140,9 @@ public MSGFileProcessor(Stream sourceStream) inlineAttachments.Add(_attachment); } } + var startAt = 0; foreach (var inlineAttachment in inlineAttachments.OrderBy(m => m.GetType().GetProperty("RenderingPosition").GetValue(m, null))) { - var startAt = 0; if (rtfInline) { if (!inlineAttachment.GetType().FullName.ToLower().Contains("message")) @@ -173,7 +173,7 @@ public MSGFileProcessor(Stream sourceStream) else if (htmlInline) { var _inlineAttachment = (Storage.Attachment)inlineAttachment; - Regex regex = new Regex(").)*cid:" + _inlineAttachment.ContentId + ".*?>"); + Regex regex = new Regex(""); Match match = regex.Match(bodyreplaced, startAt); bodyreplaced = regex.Replace(bodyreplaced, "", 1, startAt); startAt = match.Index + match.Length; From 3b2c1f614ef2ba04de1531641d7b4c18f7b3c74f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Dec 2023 20:54:09 -0800 Subject: [PATCH 4/5] additional fix for logic for starting from last regex match --- .../MCS.FOI.MSGToPDF/MSGFileProcessor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs b/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs index 1226ddfa3..7788ca506 100644 --- a/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs +++ b/MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs @@ -175,8 +175,12 @@ public MSGFileProcessor(Stream sourceStream) var _inlineAttachment = (Storage.Attachment)inlineAttachment; Regex regex = new Regex(""); Match match = regex.Match(bodyreplaced, startAt); - bodyreplaced = regex.Replace(bodyreplaced, "", 1, startAt); - startAt = match.Index + match.Length; + if (match.Success) + { + string imgReplacementString = ""; + bodyreplaced = regex.Replace(bodyreplaced, imgReplacementString, 1, startAt); + startAt = match.Index + imgReplacementString.Length; + } foreach (KeyValuePair> attachment in attachmentsObj) { if (attachment.Value.ContainsKey("cid") && attachment.Value["cid"] == _inlineAttachment.ContentId) From d946232f33ef6a91fd8a3699ae1053816572b796 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Wed, 13 Dec 2023 11:18:46 -0500 Subject: [PATCH 5/5] fix related to dedupe --- .../DedupeServices/services/s3documentservice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/computingservices/DedupeServices/services/s3documentservice.py b/computingservices/DedupeServices/services/s3documentservice.py index d6545f851..957da66cb 100644 --- a/computingservices/DedupeServices/services/s3documentservice.py +++ b/computingservices/DedupeServices/services/s3documentservice.py @@ -77,8 +77,8 @@ def extract_annotations_from_pdf(pdf_document, output_bytestream): new_content = legend_text + ":The comment text of the annotation is added as part of the pdf." index += 1 author = annot.info.get('title', '') - if author: - new_author = "Original Document Comment" + # if author: + new_author = "Original Document Comment" annot.set_info(content=new_content,title=new_author) annot.update() annot_dict = {