From 0a494ad81f11f1e26eecb0d770115e8487ae1fb5 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 2 Apr 2024 14:21:40 +0100 Subject: [PATCH] Removed exeption causing error in downloaded data --- README.md | 29 +++++++++++++++-------------- pyvenv.cfg | 4 ++-- src/formatter.py | 9 +++++---- src/git/clone/data | 1 - 4 files changed, 22 insertions(+), 21 deletions(-) delete mode 160000 src/git/clone/data diff --git a/README.md b/README.md index ca0b68c..a72942c 100644 --- a/README.md +++ b/README.md @@ -14,24 +14,25 @@ Diagrams are received in DOCX format, however can be easily be converted to ODT, The aim of diagram-parser is to simplify the addition of PIS codes that are not yet in the OwlBoard data source. The planned implementation is as follows: - - diagram-parser is subscribed to an email inbox (IMAP/POP3) - - Formatted train-crew schedule cards are sent to the inbox and loaded by diagram-parser - - List of existing PIS codes is loaded and a list of non-existent codes is compiled (0000-9999) - - If a code is found both in the diagram and on the list of non-existent codes, a Gitea issue is opened providing details of the code. - - Once the program has run and extracted only the relavent details, the email is deleted and the file is closed and not stored. - - The evantual aim is to avoid any manual searching of the files. +- diagram-parser is subscribed to an email inbox (IMAP/POP3) +- Formatted train-crew schedule cards are sent to the inbox and loaded by diagram-parser +- List of existing PIS codes is loaded and a list of non-existent codes is compiled (0000-9999) +- If a code is found both in the diagram and on the list of non-existent codes, a Gitea issue is opened providing details of the code. +- Once the program has run and extracted only the relavent details, the email is deleted and the file is closed and not stored. +- The evantual aim is to avoid any manual searching of the files. The current process of adding new codes involves being made aware of them face to face, or finding them myself and manually finding and adding them to the data source. ## Points to Remember - - Emails received should be verified. - - A pre-authorised key in the subject field, any emails not matching the key should be discarded. - - Attachment formats may vary slightly. - - The format of the attachment should be checked and any errors handled gracefully. - - Avoid duplicate issues - - Issues opened should contain the missing PIS code in their title, this application should check for any open issues containing the missing code to avoid duplicated issues. +- Emails received should be verified. + - A pre-authorised key in the subject field, any emails not matching the key should be discarded. +- Attachment formats may vary slightly. + - The format of the attachment should be checked and any errors handled gracefully. +- Avoid duplicate issues + - Issues opened should contain the missing PIS code in their title, this application should check for any open issues containing the missing code to avoid duplicated issues. ## Main external dependencies (Expected) - - imaplib - - email + +- imaplib +- email \ No newline at end of file diff --git a/pyvenv.cfg b/pyvenv.cfg index c51e59c..cb99d2e 100644 --- a/pyvenv.cfg +++ b/pyvenv.cfg @@ -1,5 +1,5 @@ home = /usr/bin include-system-site-packages = false -version = 3.11.7 +version = 3.11.8 executable = /usr/bin/python3.11 -command = /usr/bin/python -m venv /home/fred.boniface/git/owlboard/diagram-parser +command = /usr/bin/python -m venv /home/fred.boniface/Desktop/diagrams-to-parse/diagram-parser diff --git a/src/formatter.py b/src/formatter.py index c88bce7..84ade0b 100644 --- a/src/formatter.py +++ b/src/formatter.py @@ -20,8 +20,9 @@ def humanYaml(pis_list): manual_review += f' - code: "{pis["pis"]}"\n' for service in pis["services"]: crs = [] - for stop in service['stops']: - crs.append(owlboard_connector.convert_tiploc_to_crs(stop)) - manual_review += f' stops: [{",".join(crs)}]\n' + if service and service['stops']: + for stop in service['stops']: + crs.append(owlboard_connector.convert_tiploc_to_crs(stop)) + manual_review += f' stops: [{",".join(crs)}]\n' - return additional_pis + manual_review \ No newline at end of file + return additional_pis + manual_review diff --git a/src/git/clone/data b/src/git/clone/data deleted file mode 160000 index 194f20e..0000000 --- a/src/git/clone/data +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 194f20ea6fe89c423af752f2869d67c44ee194f5