carlosrsabreu / devo-abastecer

Twitter bot that publishes weekly the fuel prices updates on Madeira island.
https://twitter.com/devoabastecer
MIT License
10 stars 2 forks source link

[FEATURE]: Extract latest fuel price from JORAM's PDF repository #10 #23

Closed HarryVasanth closed 1 year ago

HarryVasanth commented 1 year ago

💁‍♂️ Please feel free to improve and push changes to this PR.

Related issues

Closes #10

What does this PR do?

Clearly state the reason for this change. What problem is it solving or feature is it adding?

This PR completes @13dev's work on the fuel price extraction from JORAM's PDF Repository.

Solution Overview

Provide an overview of the solution implemented in this pull request. This should be a high level overview without getting into technical details. If applicable, include screenshots of UI or use GitHub compliant mermaid graphs to visually represent the solution.

Implementation Details

Explain the details of the implementation and the reasoning behind it. Where should the reviewer start?

Every line after # FIXME (DEBUG): can be commented out by whomever takes over the integration part. I vote for @Dntfreitas 😉

Outputs

Currently, it prints the following:

  1. Latest PDF filename present in the repository : IISerie-018-2023-01-25.pdf
  2. Fuel price from the latest PDF: {}
  3. Fuel price from the Debug PDF: {'Gasolina super sem chumbo IO 95': '1,889', 'Gasóleo rodoviário': '1,789', 'Gasóleo colorido e marcado': '1,425'}
HarryVasanth commented 1 year ago

@carlosrsabreu @joaoofreitas Updated the code and added some comments, so whomever will take over can skim through quickly. As we discussed, it iterates through the links.

Current output prints the following:

# Prices
{'Gasolina super sem chumbo IO 95': '1,608', 'Gasóleo rodoviário': '1,488', 'Gasóleo colorido e marcado': '1,151'}

# Filename for Debug
IISerie-020-2023-01-27Supl.pdf

# URL for Debug
https://joram.madeira.gov.pt/joram/2serie/Ano%20de%202023/IISerie-020-2023-01-27Supl.pdf
joaoofreitas commented 1 year ago

Perfect... I can't review it right now unfortunately.

@carlosrsabreu @Dntfreitas, please have the courtesy.

Great work @HarryVasanth, all your work is very valuable.

HarryVasanth commented 1 year ago

After making sure we're retrieving the gas prices for the following week, this PR is ready IMO!

Superb, @HarryVasanth!

We can try to run both parallelly (writing to separate .json files). Once we iron out all the logical issues, bugs, etc. then we can go ahead to use this as our main form of extraction and keep the DRETT scraper as the backup.

carlosrsabreu commented 1 year ago

After making sure we're retrieving the gas prices for the following week, this PR is ready IMO! Superb, @HarryVasanth!

We can try to run both parallelly (writing to separate .json files). Once we iron out all the logical issues, bugs, etc. then we can go ahead to use this as our main form of extraction and keep the DRETT scraper as the backup.

Yes, I agree with that. So, we can merge this one and then create a PR to handle what you mentioned, right? @Dntfreitas any thoughts about this?

carlosrsabreu commented 1 year ago

I think we can merge this one. Then, we can try to optimize all the pieces and make this bot work even better.