diff --git a/Project.toml b/Project.toml index b788ddd..b66dba5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PRISMA" uuid = "7b67a8d2-c4f5-4933-b91c-0fc427024db5" authors = ["Ceco Elijah Maples ", "PRISMA.jl Contributors"] -version = "0.0.3" +version = "0.0.4" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" @@ -10,6 +10,7 @@ Graphviz_jll = "3c863552-8265-54e4-a6dc-903eb78fde85" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Poppler_jll = "9c32591e-4766-534b-9725-b71a8799265b" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +TidierStrings = "248e6834-d0f8-40ef-8fbb-8e711d883e9c" Transformers = "21ca0261-441d-5938-ace7-c90938fde4d4" [compat] @@ -21,6 +22,7 @@ Graphviz_jll = "2.50" LinearAlgebra = "1" Poppler_jll = "24.6" Statistics = "1" +TidierStrings = "0.2" Transformers = "0.3" XLSX = "0.10" julia = "1" diff --git a/app/frontend/src/pages/checklist.tsx b/app/frontend/src/pages/checklist.tsx index 3aeb2c8..8e67c18 100644 --- a/app/frontend/src/pages/checklist.tsx +++ b/app/frontend/src/pages/checklist.tsx @@ -85,7 +85,7 @@ export default function Checklist() { if (!response.ok) { const errorData = await response.json(); - const errorMessage = `Error submitting file: ${errorData.error}`; + const errorMessage = `Error generating checklist: ${errorData.error}`; alert(errorMessage); throw new Error(errorMessage); } @@ -100,9 +100,13 @@ export default function Checklist() { setOpenedFile(newFile); handleFileRemove(); } catch (error) { - console.error("Error submitting file:", error); + console.error("Error generating checklist:", error); handleFileRemove(); - alert(`File could not be sent to the server: ${error.message}`); + if (error instanceof Error) { + alert(`Error generating checklist: ${error.message}`); + } else { + alert("Error generating checklist: An unknown error occurred."); + } } }; @@ -272,8 +276,12 @@ export default function Checklist() { a.remove(); } } catch (error) { - console.error("Error exporting files:", error); - alert(`Error exporting files: ${error.message}`); + console.error("Error exporting checklist(s):", error); + if (error instanceof Error) { + alert(`Error exporting checklist(s): ${error.message}`); + } else { + alert("Error exporting checklist(s): An unknown error occurred."); + } } }; diff --git a/app/frontend/src/pages/flow_diagram.tsx b/app/frontend/src/pages/flow_diagram.tsx index e751e76..300d94b 100644 --- a/app/frontend/src/pages/flow_diagram.tsx +++ b/app/frontend/src/pages/flow_diagram.tsx @@ -393,11 +393,14 @@ export default function FlowDiagram() { container.innerHTML = svgData; } else { console.error("Flow diagram container element not found"); - alert("Flow diagram container element not found."); } } catch (error) { - console.error("Error generating flow diagram:", error); - alert(`Error generating flow diagram: ${error.message}`); + console.error("Error fetching data:", error); + if (error instanceof Error) { + alert(`Error fetching flow diagram: ${error.message}`); + } else { + alert("Error fetching flow diagram: An unknown error occurred."); + } } } @@ -415,7 +418,7 @@ export default function FlowDiagram() { if (!response.ok) { const errorData = await response.json(); - const errorMessage = `Error fetching flow diagram: ${errorData.error}`; + const errorMessage = `Error downloading flow diagram: ${errorData.error}`; alert(errorMessage); throw new Error(errorMessage); } @@ -424,9 +427,7 @@ export default function FlowDiagram() { const flowDiagramBytes = data.flow_diagram; if (!flowDiagramBytes) { - const errorMessage = "No binary data received from the server."; - alert(errorMessage); - throw new Error(errorMessage); + throw new Error("No binary data received from the server."); } const mimeTypeMap: { [key: string]: string } = { @@ -448,7 +449,11 @@ export default function FlowDiagram() { URL.revokeObjectURL(url); } catch (error) { console.error("Error downloading flow diagram:", error); - alert(`Error downloading flow diagram: ${error.message}`); + if (error instanceof Error) { + alert(`Error downloading flow diagram: ${error.message}`); + } else { + alert("Error downloading flow diagram: An unknown error occurred."); + } } } diff --git a/src/PRISMA.jl b/src/PRISMA.jl index dbfb617..5135c11 100644 --- a/src/PRISMA.jl +++ b/src/PRISMA.jl @@ -25,6 +25,7 @@ using Graphviz_jll: neato using LinearAlgebra: norm, dot using Poppler_jll: pdfinfo, pdftotext using Statistics: mean +using TidierStrings using Transformers: encode, @hgf_str export checklist_df, checklist, Checklist diff --git a/src/flow_diagram.jl b/src/flow_diagram.jl index 0edc14e..8bd5adb 100644 --- a/src/flow_diagram.jl +++ b/src/flow_diagram.jl @@ -480,7 +480,7 @@ function flow_diagram( if !(from in excluded_boxes) && !(to in excluded_boxes) dot_lang *= """ $from -> $to [ - arrowhead=$(from in Set([7, 21]) ? "none" : arrow_head), + arrowhead=$(from in Set([7, 21]) && to != 22 ? "none" : arrow_head), arrowsize="$arrow_size", color="$arrow_color", penwidth="$arrow_width"