Skip to content

Commit

Permalink
Merge pull request #1 from EJOOSTEROP/001-new-features
Browse files Browse the repository at this point in the history
  • Loading branch information
EJOOSTEROP authored Jun 2, 2024
2 parents f6148f3 + b58eace commit af46b73
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sched*.json
*.ics
play_folder

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
Empty file modified .vscode/launch.json
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
<!-- insertion marker -->
## [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
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@
<a href="https://github.com/EJOOSTEROP/crewcal">
<img src="https://github.com/EJOOSTEROP/crewcal/blob/main/etc/intro_image.jpg?raw=true" alt="intro_image" width="75%" height="75%">
</a>
<br>
</div>

<div>

<br>
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 <a href="https://github.com/EJOOSTEROP/crewcal/blob/main/etc/schedule_sample.png?raw=true">pdf schedules</a>. It may work on other systems' schedules. Feel free to <a href="#roadmap">suggest</a> other systems.

</div>

Expand Down Expand Up @@ -176,7 +177,7 @@ The resulting .ics file can be read by most calendar software.
<!-- ROADMAP -->
## 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 <a href="https://github.com/EJOOSTEROP/crewcal/issues">issue</a>.


<p align="right">(<a href="#readme-top">back to top</a>)</p>
Expand Down
Empty file modified etc/.gitignore
100644 → 100755
Empty file.
Binary file added etc/schedule_sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified poetry.lock
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "MIT"
Expand Down
9 changes: 3 additions & 6 deletions src/crewcal/cli.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand All @@ -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

Expand Down
Empty file modified src/crewcal/llm_extract.py
100644 → 100755
Empty file.
10 changes: 6 additions & 4 deletions src/crewcal/llm_prompts.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
2 changes: 2 additions & 0 deletions src/crewcal/schedule.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -104,6 +105,7 @@ def to_icalendar(self):
)
for flight in self.events
]

calendar.events.update(events)

return calendar
Expand Down
2 changes: 1 addition & 1 deletion src/crewcal/wip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
Empty file modified tests/test_002.py
100644 → 100755
Empty file.

0 comments on commit af46b73

Please sign in to comment.