-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/point of interest structure upgrade #22
Feature/point of interest structure upgrade #22
Conversation
721f8db
to
a93833e
Compare
adapters/spreadsheet_adapter.py
Outdated
@@ -19,12 +19,16 @@ def transform(self, source: List[SpreadsheetRow]) -> List[PointOfInterest]: | |||
return [self.transform_row(row) for row in source] | |||
|
|||
def transform_row(self, row: SpreadsheetRow) -> PointOfInterest: | |||
rename = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use existing ALIASES
above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, exactly same purpose.
config/constants.py
Outdated
@@ -1,5 +1,8 @@ | |||
from typing import Set | |||
|
|||
|
|||
DEFAULT_CATEGORY = 'Any help' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has already been added by @idisblueflash so your PR should not have this change, please, merge/rebase the latest master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, bad double rebase…
country: str = '' | ||
city: str = '' | ||
address: str = '' | ||
categories: List[str] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that these convert correctly into CSV and don't break existing unit tests for spiders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests I did fix, but export to CSV might actually work a bit differently. Let me poke around it a bit more…
|
||
log = logging.getLogger(__name__) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this file here? Are you combining 2 PRs in one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually thought that it was merged. Is it okay to merge it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you can merge it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks!
@@ -79,8 +79,15 @@ def test_spreadsheet_data_conversion(): | |||
|
|||
result = usecase.convert_spreadsheet("some-id") | |||
csv = FILE_VALUES[0] | |||
expected_row = "The Ukrainian House,Poland,Warsaw,\"ul. Zamenhofa 1, 00-153\",52.24734033,20.9964833," \ | |||
"Accommodation,Fundacja “Nasz Wybór”,Crisis support center" | |||
expected_row = 'The Ukrainian House,Poland,Warsaw,' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using some auto-formatter that converts all quotes to single-quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, one style of quotes does make it a bit easier for me. Do we have a preference what quotes to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that one style is better, I don't have a preference but I was leaning towards double-quotes because is later we'll enable some auto-formatter like black
it's going to force double-quotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, I'll go with that from now on then.
As I was fixing It seems to have all the same info, and also coordinates for all the points. Would you like me to update the crawler to scrape that info? |
It would be nice if it's easy to do 👍 |
Sure, no problem! |
dc4324a
to
d9e2b61
Compare
Make sure to pull latest. |
028e2c8
to
19fc0f0
Compare
Hm… looks like Other than that I think I fixed all outstanding issues. Could you guys take a peek, please? |
On @wdunn001 any ideas? |
models/point_of_interest.py
Outdated
email: str = '' | ||
url: str = '' | ||
socialmedia: str = '' | ||
messenger: str = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you were working on it they've add two more fields to the schema 😂
messenger -> FB messenger
telegram -> telegram
whatsapp -> whatsapp
appears to be related to this python-poetry/poetry#728. Seems there is an outage in PyPi judging from their status page. Probably not related to poetry. https://stackoverflow.com/questions/72551057/poetry-gives-toomanyindirects-error-suddenly |
checked tests are working correctly now something in your latest PR is breaking tests. |
email: str = '' | ||
url: str = '' | ||
socialmedia: str = '' | ||
fb_messenger: str = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the fields should still be just messenger
, "FB messenger" was the meaning
|
||
|
||
# XXX: there must be some that encodes/decodes this kind of structure | ||
def parse_points(json_xml): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a dedicated unit test for this function so that we can see what kind of JSON you're parsing?
In theory, you could deserialize it into a pydantic model
I'm gonna merge it so that we can have the new schema on master, we can address any remaining issues in a separate PR |
Addresses #21.
This is really a work in progress, but I'd like to share it early anyway, since it might help catch some gotchas early on as well.