TOOL
Port delay analysis script
๐ ๏ธ Port delay analysis script
๐ก Use Case
- The script behind ๐ Statistics II - Project - What predicts vessel delay at Greywater. Described here, not pasted: about two hundred lines, most of them cleaning.
- Part one, cleaning (๐ Clean the port delay data for the project): reads fourteen months of the open data published by ๐ข Port Vellan Port Authority, forces three date formats into one, drops the rows that arrive before they depart, and writes a clean file. Planned for a week. Took until 4 November.
- Part two, the model: a plain regression of delay in hours on a handful of things known before a vessel arrives. One line fitted, then the residuals plotted, because Hale wants to see the residuals before he sees the line.
- Field names and their traps are in Port Authority open vessel-delay data.
โ๏ธ Pros & Cons
Pros
- One file, top to bottom. Run it and the tables in the report come out the same every time.
- Every cleaning rule has a comment saying how many rows it removes. The total is in the appendix, so nobody has to wonder.
- Rewriting it after 18 November took an evening, because the cleaning did not have to change.
Cons
- The first model had a variable in it that was standing in for something else. I did not see it. Hana Kobayashi did, over coffee, in about four minutes.
- The cleaning half is ugly and I have stopped apologising for it.
- It answers the question for these fourteen months at this port and I had to say so on the last slide.
๐ Alternatives
- A spreadsheet. Fine up to the second date format.
- Asking Bao Nguyen, which would have been his project and not mine.