Skip to content
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

Add BGT bronhouder names #380

Merged
merged 6 commits into from
Nov 6, 2024
Merged

Add BGT bronhouder names #380

merged 6 commits into from
Nov 6, 2024

Conversation

martinvonk
Copy link
Collaborator

No description provided.

@martinvonk martinvonk linked an issue Oct 23, 2024 that may be closed by this pull request
@martinvonk martinvonk linked an issue Oct 23, 2024 that may be closed by this pull request
@martinvonk martinvonk self-assigned this Oct 23, 2024
@martinvonk martinvonk added enhancement New feature or request good first issue Good for newcomers labels Oct 23, 2024
@bdestombe
Copy link
Collaborator

What about adding a test that checks whether the dictionary matches the current one found on het kadaster?

The following code compares the top row of the table presented on https://www.kadaster.nl/-/bgt-bronhoudercodes with the current implemented version

import requests
from lxml import html

# The URL of the page
url = 'https://www.kadaster.nl/-/bgt-bronhoudercodes'

# Send a GET request to fetch the raw HTML content
response = requests.get(url)

# Parse the HTML content
tree = html.fromstring(response.content)

# Use the XPath to find the desired text
xpath = '//*[@id="collapse1"]/div/ul/li[1]/text()'
text = tree.xpath(xpath)[0]

assert text == "Versie 2024: 1-1-2024", "Bronhoudercodes are not up to date. Update `get_bronhouder_names()`."

@martinvonk
Copy link
Collaborator Author

What about adding a test that checks whether the dictionary matches the current one found on het kadaster?

Good point. I can add a check for that. Is there a formal protocol to do this in nlmod? For the knmi data platform the issue is the same I think with an open api key that can expire.

Another option would be to download and read the excel / ods file, but I'd advise against that since it looks unstructured.

@martinvonk
Copy link
Collaborator Author

In my previous comment, I was a bit confused if you wanted a check in the get_bronhouder_names or a test. But I now added a test to assert if the date from the last url/file on the kadaster website is from 2024.

@martinvonk martinvonk removed the good first issue Good for newcomers label Nov 4, 2024
@bdestombe
Copy link
Collaborator

Perfect! Thank you for the consideration.

The reason to opt for only checking the year opposed to whether it is the most current version is because, an update once a year is sufficient?

@martinvonk
Copy link
Collaborator Author

The reason to opt for only checking the year opposed to whether it is the most current version is because, an update once a year is sufficient?

Yes, generally there is no big update. But you're right; in 2022 the file was updated twice. So I can also check the date as well.

@martinvonk martinvonk changed the title Add bronhouder names Add BGT bronhouder names Nov 6, 2024
@martinvonk martinvonk merged commit a771e0e into dev Nov 6, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add names from BGT bronhouders
3 participants