Integrate Python address parser using use-address library#56
Open
Jbony1988 wants to merge 2 commits intodatamade:masterfrom
Open
Integrate Python address parser using use-address library#56Jbony1988 wants to merge 2 commits intodatamade:masterfrom
Jbony1988 wants to merge 2 commits intodatamade:masterfrom
Conversation
Add usaddress library to project dependencies - Implement AddressParse API view for address parsing - Create parse() method to handle address parsing logic - Update frontend to send requests to new API endpoint - Display parsed address components and handle errors in UI - Add error handling for unparseable addresses - Update tests to cover new address parsing functionality"
derekeder
requested changes
Aug 5, 2024
Member
derekeder
left a comment
There was a problem hiding this comment.
@Jbony1988 nice work here! A few things to address, but overall this is good and well documented.
For your pull request description, would you mind formatting and cleaning up the text a bit? There's still some boilerplate text in there that can be removed.
| {% block extra_js %} | ||
| <script src="{% static 'js/index.js' %}"></script> | ||
| {% endblock %} | ||
| <script> |
Member
There was a problem hiding this comment.
the javascript code should be placed in js/index.js and not added inline to the template. can you move this code over?
|
|
||
| if (data.detail && data.detail.startsWith('Error parsing address:')) { | ||
| // Display parsing error | ||
| const errorMessage = data.detail.split('ORIGINAL STRING:')[0].trim(); |
Member
There was a problem hiding this comment.
nice work here displaying a useful error response
Author
|
I have cleaned up the description of the PR and I moved the javascript to the js/index.js file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add usaddress library to project dependencies
This PR involves recreating an address parsing form similar to DataMade's Parserator web service. Parserator is a tool that takes input strings representing addresses (e.g., "123 main st chicago il") and splits them into their component parts, such as street number, street name, city, and state. Here's a breakdown of what this entails:
How to test this PR
After checking out this branch, follow these steps:
Setup:
Ensure Docker and Docker Compose are installed on your machine
Build the application containers:
run command in project docker-compose build
Start the application:
run command in project docker-compose up
User Interface Testing:
Open http://localhost:8000 in your web browser
Test with valid input:
Enter "123 main st chicago il" in the input field
Click the submit button
Expected output:
AddressNumber: 123
StreetName: main
StreetNamePostType: st
PlaceName: chicago
StateName: il
Test with invalid input:
Enter "123 main st chicago il 123 main st" in the input field
Click the submit button
Expected output: An error message should be displayed indicating invalid input
Unit Testing:
Run the unit tests using:
docker-compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app
Expected output: All tests should pass, and no linting errors should be reported
Additional Notes:
If you make any changes, you may need to rebuild the containers
Ensure the console output doesn't show any unexpected errors during testing