diff --git a/.gitignore b/.gitignore index 17a602e..d73d6c4 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ sched*.json *.ics +play_folder # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/.vscode/launch.json b/.vscode/launch.json old mode 100644 new mode 100755 diff --git a/.vscode/settings.json b/.vscode/settings.json index 14df5ec..56415f2 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,7 +11,7 @@ "editor.defaultFormatter": "ms-python.black-formatter", "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.organizeImports": true + "source.organizeImports": "explicit" }, }, "isort.args":["--profile", "black"], diff --git a/CHANGELOG.md b/CHANGELOG.md index ad28fae..7998479 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- Consider downgrading Python requirement (at least to 3.10, but I dont know how low it can gowhere) + +## [0.8.2] + +### Fixed +- Arrivals on next day are correctly reflected again. Stopped working with the same OpenAI model. + +### Changed +- Adding extract completed message using Halo (spinner) + ## [0.8.1] ### Fixed diff --git a/README.md b/README.md index 77dbb21..bb7cc0e 100755 --- a/README.md +++ b/README.md @@ -101,15 +101,16 @@ intro_image +
- +
Convert an airline crew schedule pdf into iCalendar format using a machine learning Large Language Model. An LLM (Large Language Model, specifically OpenAI's gpt-3.5-turbo) is used to extract the schedule information. iCalender files are recognized by most calendar systems (iOS, Android, Google, ++) and will create the flights on your phone/device calendar. The PDF schedule does not need to follow a very prescribed structured format. - Development performed mostly using AIMS eCrew pdf schedules. + Development performed mostly using AIMS eCrew pdf schedules. It may work on other systems' schedules. Feel free to suggest other systems.
@@ -176,7 +177,7 @@ The resulting .ics file can be read by most calendar software. ## Roadmap -- [ ] None (feel free to suggest) +- [ ] Add support schedules for systems in addition to AIMS. I would be happy to look at suggestions, especially if you can provide sample schedules. Create a new issue.

(back to top)

diff --git a/etc/.gitignore b/etc/.gitignore old mode 100644 new mode 100755 diff --git a/etc/schedule_sample.png b/etc/schedule_sample.png new file mode 100755 index 0000000..dc2d72b Binary files /dev/null and b/etc/schedule_sample.png differ diff --git a/poetry.lock b/poetry.lock old mode 100644 new mode 100755 diff --git a/pyproject.toml b/pyproject.toml index 64de6fb..cd5f95f 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ disallow_incomplete_defs = true [tool.poetry] name = "crewcal" -version = "0.8.1" +version = "0.8.2" description = "Convert an airline crew schedule pdf into iCalendar format." authors = ["Erik Oosterop "] license = "MIT" diff --git a/src/crewcal/cli.py b/src/crewcal/cli.py old mode 100644 new mode 100755 index 479f3ea..38bd7e9 --- a/src/crewcal/cli.py +++ b/src/crewcal/cli.py @@ -123,8 +123,8 @@ def extract(sourcefile: str, targetfile: str, to_json: bool, overwrite: bool) -> text="Extracting schedule, saving to iCalendar format.", spinner="dots" ) if not to_json else Halo( text="Extracting schedule, saving to crewcal json format.", spinner="dots" - ): - sched = ( + ) as spinner: + ( OpenAISchedule( schedule_path=str(source_path), to_icalendar_file=str(out_path) ) @@ -133,10 +133,7 @@ def extract(sourcefile: str, targetfile: str, to_json: bool, overwrite: bool) -> schedule_path=str(source_path), to_json_file=str(out_path) ) ) - - click.echo(f"Extracted schedule saved to {out_path}.") - - del sched + spinner.info(f"Extracted schedule saved to {out_path}.") return 0 diff --git a/src/crewcal/llm_extract.py b/src/crewcal/llm_extract.py old mode 100644 new mode 100755 diff --git a/src/crewcal/llm_prompts.py b/src/crewcal/llm_prompts.py old mode 100644 new mode 100755 index 369b566..e10b066 --- a/src/crewcal/llm_prompts.py +++ b/src/crewcal/llm_prompts.py @@ -18,9 +18,11 @@ - Destination airport code - Destination airport name - Destination timezone -- Arrival date -- Arrival time, the last occurrence of a time for each day +- Arrival date. A '+1' means the next day. +- Arrival time, the last occurrence of a time for each day. A '+1' means the next day. - List of crew members -- A list of all times found -- List of all airport codes +- A list of all times found. +- List of all airport codes. + +Always include all items in your output even if they are empty. """ diff --git a/src/crewcal/schedule.py b/src/crewcal/schedule.py old mode 100644 new mode 100755 index 11e695f..16dbeef --- a/src/crewcal/schedule.py +++ b/src/crewcal/schedule.py @@ -3,6 +3,7 @@ The schedule is a list of events, each of which contains the details of a set of flight. """ + import json import logging from pathlib import Path @@ -104,6 +105,7 @@ def to_icalendar(self): ) for flight in self.events ] + calendar.events.update(events) return calendar diff --git a/src/crewcal/wip.py b/src/crewcal/wip.py index 225a45b..73c4241 100755 --- a/src/crewcal/wip.py +++ b/src/crewcal/wip.py @@ -14,7 +14,7 @@ def main(): logging.warning(sched.to_icalendar().serialize()) - sched.to_icalendar_file("schedule3.ics") + sched.to_icalendar_file("dien.ics") logging.warning(sched.json_dumps()) diff --git a/tests/test_002.py b/tests/test_002.py old mode 100644 new mode 100755