{"id":20234944,"url":"https://github.com/datamade/code-challenge","last_synced_at":"2025-04-09T22:15:53.199Z","repository":{"id":45567912,"uuid":"292686907","full_name":"datamade/code-challenge","owner":"datamade","description":"A code challenge to recreate the address parsing form in DataMade's Parserator app.","archived":false,"fork":false,"pushed_at":"2024-08-06T12:10:30.000Z","size":673,"stargazers_count":17,"open_issues_count":22,"forks_count":199,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T22:15:47.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datamade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-03T21:48:40.000Z","updated_at":"2024-12-12T01:36:32.000Z","dependencies_parsed_at":"2025-02-09T21:10:41.751Z","dependency_job_id":"74b1df6b-ecfc-4cb1-a190-0564418bd82f","html_url":"https://github.com/datamade/code-challenge","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/datamade%2Fcode-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamade%2Fcode-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamade%2Fcode-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamade%2Fcode-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datamade","download_url":"https://codeload.github.com/datamade/code-challenge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119288,"owners_count":21050755,"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":[],"created_at":"2024-11-14T08:13:53.440Z","updated_at":"2025-04-09T22:15:53.179Z","avatar_url":"https://github.com/datamade.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataMade Code Challenge: Parserator\n\nWelcome to the DataMade code challenge! 👋\n\nYour task is to recreate the **address parsing form** in DataMade's\n[Parserator](https://parserator.datamade.us) web service. Parserator can take\ninput strings that represent addresses (like `123 main st chicago il`)\nand split them up into their component parts:\n\n![Example of Parserator parsing the string \"123 main st chicago il\"](images/usaddress.gif)\n\nIn this repo, we've provided the basic scaffolding of the templates, views, and\nroutes that comprise the app. You'll need to flesh out certain code blocks in\nthe frontend and backend code in order to send API requests, process them on\nthe server, and display the results to the user.\n\nYou can use vanilla JavaScript or jQuery to complete the JavaScript portions of\nthis assessment.\n\nTo get started, fork this repo and follow the instructions below.\n\n## Installation\n\nDevelopment requires a local installation of [Docker](https://docs.docker.com/install/)\nand [Docker Compose](https://docs.docker.com/compose/install/). These are the\nonly two system-level dependencies you should need.\n\nOnce you have Docker and Docker Compose installed, build the application containers:\n\n```\ndocker-compose build\n```\n\nNext, run the app:\n\n```\ndocker-compose up\n```\n\nThe app will log to the console, and you should be able to visit it at http://localhost:8000.\n\n## Completing the challenge\n\nOnce you have the app up and running on your computer, you'll need to flesh out\ncertain code blocks to complete the parsing interface.\n\n**Note:** You can use the following address strings for testing during implementation:\n\n- ✅ Valid: `123 main st chicago il`\n- ❌ Invalid: `123 main st chicago il 123 main st`\n\n### Step 1: Implement the `parse` method\n\nIn `parserator_web/views.py`, use [`usaddress`](https://github.com/datamade/usaddress)\nto implement the `AddressParse.parse()` method. It should return two pieces of\ndata:\n\n- `address_components`: The parsed address\n- `address_type`: The type of address provided\n\n### Step 2: Complete the API endpoint\n\nIn `parserator_web/views.py`, complete the `AddressParse.get()` method to return\nthree pieces of data:\n\n- `input_string`: The string that the user sent\n- `address_components`: A dictionary of parsed components that comprise the address,\n   in the format `{address_part: tag}` (returned by `AddressParse.parse()`)\n- `address_type`: A string representing type of the parsed address (returned by `AddressParse.parse()`)\n\nDon't forget to handle strings that cannot be parsed and return errors!\n\n### Step 3: Wire up the form to send requests to the API\n\nIn `parserator_web/templates/parserator_web/index.html`, fill out the `\u003cscript\u003e`\ntag in the `extra_js` block, adding JavaScript code that will use the form\nto send form data to the API endpoint fleshed out in Step 2.\n\n### Step 4: Display results from the API\n\nIn `parserator_web/templates/parserator_web/index.html`, extend the `\u003cscript\u003e`\ntag in the `extra_js` block to display results from the API endpoint in the\nhidden element `\u003cdiv id=\"address-results\"\u003e`.\n\nMake sure that if the API raises an error, it displays this error to the user.\n\n### Step 5: Add unit tests\n\nThe `tests/` directory contains two stubbed tests. Complete each test by making\na request to the API endpoint and verifying that it passes or fails, and\nreturns the expected output.\n\nYou can run the tests using Docker:\n\n```bash\ndocker-compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app\n```\n\nNote that, in addition to running the unit tests, the testing script will lint\nyour JavaScript and Python code. Don't forget to fix any linting errors these\ncommands surface!\n\nNot familiar with `pytest`? Consult [our testing guidelines](https://github.com/datamade/testing-guidelines)\nfor quick start instructions, plus tips and tricks for testing Django\napplications.\n\n### Step 6: Submit your work\n\nTo submit your work, create a feature branch for your code, commit your changes,\npush your commits up to your fork, and open up a pull request against `master`.\nFinally, drop a link to your pull request in your application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamade%2Fcode-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatamade%2Fcode-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamade%2Fcode-challenge/lists"}