{"id":19318483,"url":"https://github.com/manycoding/address-parser","last_synced_at":"2025-02-24T05:10:22.083Z","repository":{"id":49408164,"uuid":"289753745","full_name":"manycoding/address-parser","owner":"manycoding","description":"A service to parse any address string into a neat json","archived":false,"fork":false,"pushed_at":"2020-10-08T15:14:17.000Z","size":171,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-06T04:28:49.938Z","etag":null,"topics":["address-parser","lambda","ml","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manycoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-23T19:32:05.000Z","updated_at":"2024-08-26T02:50:59.000Z","dependencies_parsed_at":"2022-09-10T11:31:57.608Z","dependency_job_id":null,"html_url":"https://github.com/manycoding/address-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manycoding%2Faddress-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manycoding%2Faddress-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manycoding%2Faddress-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manycoding%2Faddress-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manycoding","download_url":"https://codeload.github.com/manycoding/address-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240420982,"owners_count":19798502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address-parser","lambda","ml","rest-api"],"created_at":"2024-11-10T01:18:45.392Z","updated_at":"2025-02-24T05:10:22.050Z","avatar_url":"https://github.com/manycoding.png","language":"Python","readme":"# address-parser microservice\nA REST endpoint consuming an address string and returning a json with address fields:\n\n```\ncurl -X POST \"http://127.0.0.1:5000/parse\" -H  \"accept: application/json\" -H  \"Content-Type: application/json\" -d \"{  \\\"address\\\": \\\"5760 Teredo St., Sechelt, BC, Canada, VON 3A0\\\"}\"\n    {\n        \"city\": \"Sechelt\",\n        \"state\": \"BC\",\n        \"street_address\": \"5760, Teredo St.\",\n        \"postcode\": \"VON 3A0\",\n        \"country\": \"Canada\",\n    },\n```\n\n## Use Locally\n\n1. Install libpostal\n2. Instal deps with `pipenv install \u0026\u0026 pipenv shell`\n3. Run flask application `export FLASK_APP=api.py \u0026\u0026 flask run`\n4. Test at http://127.0.0.1:5000/swagger-ui/\n\n## Deploying on AWS Lambda\nLibpostal requires 2GB on disk and in memory for the model, so the AWS Lambda deployment consists of 2 steps:\n1. Getting libpostal files on shared EFS\n2. Configuring pypostal from Lambda\n\n### Getting libpostal files on shared EFS\n1. Create EFS, Amazon Linux 2 AMI with attached EFS:\n* Use an instance with 4GB memory.\n* Make sure VPC has NFS inbound rule and DNS resolution\n2. Install libpostal and copy data files (`datadir`) and library files (*.so and pkgconfig) from `/usr/local/lib` to EFS\n### Configuring library from Lambda and Lambda itself\n3. Build [pypostal from master](https://github.com/openvenues/pypostal) for Lambda\n\n```docker build -t pypostal . \u0026\u0026 docker create -ti --name dummy pypostal bash \u0026\u0026 docker cp dummy:/postal/postal ./ \u0026\u0026 docker rm dummy```\n\n4. Deploy Lambda with zappa in the same region:\n* don't forget to add Lambda's pypostal\n* Max out memory\n* point to libpostal files on EFS:\n\n```\nLD_LIBRARY_PATH /mnt/efs/libpostal_lib/lib\n\nLIBPOSTAL_DATA_DIR /mnt/efs/libpostal_model/libpostal\n\nPKG_CONFIG_PATH /mnt/efs/libpostal_lib/lib/pkgconfig\n```\n\n* Add EFS to Lambda:\n\nUse the same VPC\n\nconfigure subnets for public access\n\n```curl -X POST \"https://fe5k5zd4k4.execute-api.us-west-2.amazonaws.com/dev/parse\" -H  \"accept: application/json\" -H  \"Content-Type: application/json\" -d \"{  \\\"address\\\": \\\"5760 Teredo St., Sechelt, BC, Canada, VON 3A0\\\"}\"```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanycoding%2Faddress-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanycoding%2Faddress-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanycoding%2Faddress-parser/lists"}