-
Notifications
You must be signed in to change notification settings - Fork 2
Initial full-stack test version #1
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| # Zesty.ai engineering test (full-stack) | ||
|
|
||
| ## Background | ||
|
|
||
| Full-stack engineers at Zesty.ai develop our web applications end-to-end, working with modern front-end frameworks, APIs | ||
| (ours and third parties'), and many kinds of data and imagery. | ||
|
|
||
| This test is an opportunity for you to demonstrate your comfort with developing both an API and a UI, similar to a | ||
| day-to-day project you might encounter working on our team. | ||
|
|
||
| ## Assignment | ||
|
|
||
| Your goal is to create a full-stack web application that allows developers to search for and retrieve information about | ||
| real estate properties. Using your language(s) and framework(s) of choice, you will need to create a front-end and | ||
| back-end for your application and connect to the provided PostgreSQL database. | ||
|
|
||
| Your application should include some required features, and may also include optional features. Implementing required | ||
| features is expected to take around 4 hours. If you feel like implementing optional features, you may spend more than 4 | ||
| hours. Pick whichever optional features you think you can do best. | ||
|
|
||
| Note that some features are more difficult than others, and you will be evaluated on more than just the number of | ||
| features completed. Quality is preferred over quantity. Design, organize, and comment your code as you would a typical | ||
| production project. Be prepared to discuss decisions you made. | ||
|
|
||
| ### Required features | ||
|
|
||
| * **List all properties:** Display, in a tabular format, all properties and their geographic location (longitude and | ||
| latitude). | ||
|
|
||
| * **Property detail page:** Show detailed information about a given property, including its image, geographic location, | ||
| and statistics (if applicable). | ||
|
|
||
| * **Containerization:** Include Docker image(s) of your application when submitting your final code. | ||
|
|
||
| ### Optional features | ||
|
|
||
| * **Search by coordinates:** Prompt the user for a longitude, latitude, and search radius (default 10000 meters) and | ||
| display, in a tabular format, the results of the search, including the properties' geographic location (longitude and | ||
| latitude). | ||
|
|
||
| * **Map view:** Using the | ||
| [Google Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/overview), display a map | ||
| centered around either the user's current location, or an address they enter. Display a marker on the map for each | ||
| property. Clicking on a marker should reveal an | ||
| [Info Window](https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple) with key | ||
| property information. | ||
|
|
||
| * **Save for later:** Allow users to save properties from the List, Search, Detail, and/or Map pages and visit their | ||
| list of saved properties. | ||
|
|
||
| * **Image overlays:** Add polygonal overlays to property images to represent either the parcel, building, or both | ||
| (`parcel_geo` and `buildings_geo` fields in the database). | ||
|
|
||
| * **Statistics:** Calculate geographic data about all properties within a given distance from a reference property. | ||
| Take *propertyId* and *distance* (in meters) as inputs. The API should return the following: | ||
| * parcel area (meters squared) | ||
| * buildings areas (array, meters squared) | ||
| * buildings distances to center (array, meters). Distance to center is the distance from the building to the | ||
| `geocode_geo` field in the property table. | ||
| * zone density (percentage). Create a "zone" geography, which is a buffer of *distance* meters around the | ||
| `geocode_geo` point. Then, calculate the percentage of that zone geography which has buildings in it. | ||
|
|
||
| ## Setup | ||
| ### Development environment requirements | ||
|
|
||
| You will need to install [Docker](https://www.docker.com/products/docker-desktop) and | ||
| [`docker-compose`](https://docs.docker.com/compose/install/) to run the example database. | ||
|
|
||
| ### Database startup | ||
| From the repo root folder, run `docker-compose up -d` to start the PostgreSQL database needed for this example. The | ||
| database server will be exposed on port **5555**. If this port is not available on your computer, feel free to change | ||
| the port in the `docker-compose.yml` file. | ||
|
|
||
| In the test database, there is a single table called `properties` (with 5 sample rows), where each row represents a | ||
| property or address. There are three geography<sup>*</sup> fields and one field with an image URL pointing to an image on [Google Cloud Storage](https://cloud.google.com/storage/). | ||
|
|
||
| <sup>*</sup> *If you are not familiar with [PostgreSQL](https://www.postgresql.org/) or [PostGIS](https://postgis.net/), you may need to read up beforehand.* | ||
|
|
||
| ### API reference | ||
|
|
||
| The API you will be implementing for this project must follow the following API specification. | ||
|
|
||
| Note that some endpoints and parameters only apply to optional features. | ||
|
|
||
| #### GET /display/:*id*?(overlay=yes(&parcel=:*parcelColor*)(&building=:*buildingColor*)) | ||
|
|
||
| *Fetches and displays property tile by ID. Optionally overlays parcel and building geometries on tile.* | ||
|
|
||
| `example: GET localhost:1235/display/f853874999424ad2a5b6f37af6b56610?overlay=yes&building=green&parcel=orange` | ||
|
|
||
| ###### Request Parameters | ||
|
|
||
| - "id" | | ||
| description: Property ID | | ||
| type: string | | ||
| required: true | | ||
| validation: length greater than 0 | ||
|
|
||
| - "overlay" | | ||
| description: Overlays parcel and building geometries on tile | | ||
| type: string | | ||
| required: false | | ||
| validation: enum("yes") | ||
|
|
||
| - "parcel" | | ||
| description: Indicated building overlay color | | ||
| type: string | | ||
| required: false | | ||
| validation: enum(~<color>~) ex. "red", "green", "orange" | ||
|
|
||
| - "building" | | ||
| description: Indicates building overlay color | | ||
| type: string | | ||
| required: false | | ||
| validation: enum(~<color>~) ex. "red", "green", "orange" | ||
|
|
||
| ###### Response | ||
|
|
||
| JPEG image | ||
|
|
||
| #### GET /properties | ||
|
|
||
| *Lists all properties.* | ||
|
|
||
| `example: GET localhost:1235/properties` | ||
|
|
||
| ###### Response | ||
|
|
||
| JSON array of property objects | ||
|
|
||
| #### POST /find | ||
|
|
||
| *Finds properties within X meters away from provided geojson point.* | ||
|
|
||
| `example: POST localhost:1235/find` | ||
|
|
||
| ###### Request Body | ||
|
|
||
| - geojson object with x-distance property | ||
|
|
||
| ``` | ||
| '' example: | ||
| '' | ||
| '' { | ||
| '' "type": "Feature", | ||
| '' "geometry": { | ||
| '' "type": "Point", | ||
| '' "coordinates": [-80.0782213, 26.8849731] | ||
| '' }, | ||
| '' "x-distance": 1755000 | ||
| '' } | ||
| ``` | ||
|
|
||
| ###### Response | ||
|
|
||
| JSON array of property IDs | ||
|
|
||
| #### GET /statistics/:*id*?distance=:*distance* | ||
|
|
||
| *Returns various statistics for parcels and buildings found X meters around the requested property* | ||
|
|
||
| `example: GET localhost:1235/statistics/f853874999424ad2a5b6f37af6b56610?distance=1755000` | ||
|
|
||
| ###### Request Parameters | ||
|
|
||
| - "id" | | ||
| description: Property ID | | ||
| type: string | | ||
| required: true | | ||
| validation: length greater than 0 | ||
|
|
||
| - "distance" | | ||
| description: Buffer distance | | ||
| type: integer | | ||
| required: true | | ||
| validation: greater than 0 | ||
|
|
||
| ###### Response | ||
|
|
||
| JSON array including | ||
|
|
||
| - "parcel_area_sqm" | | ||
| description: Total area of the property's parcel, in square meters | | ||
| type: float | ||
|
|
||
| - "building_area_sqm" | | ||
| description: Total area of buildings inside the property's parcel, in square meters | | ||
| type: float | ||
|
|
||
| - "building_distances_m" | | ||
| description: Array of [distance, from the centroid of the property, to the centroid of each building, in meters] | | ||
| type: List[float] | ||
|
|
||
| - "zone_density" | | ||
| description: Array of [density of each building's area as a ratio to parcel area, dimensionless] | | ||
| type: List[float] | ||
|
|
||
|
|
||
| ## Submission instructions | ||
|
|
||
| Send us your completed application's code by email, or create and give us access to a new private GitHub repository. | ||
|
|
||
| Include instructions on how to run your app, and a list of what features you implemented. Add any comments or things you | ||
| want the reviewer to consider when looking at your submission. You don't need to be too detailed, as there will likely | ||
| be a review done with you where you can explain what you've done. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As suggested by @amerski99, we might want to remove the Submission instructions section from this readme and include this content in the communication candidates are sent. |
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| version: '3' | ||
|
|
||
| services: | ||
| postgres: | ||
| image: mdillon/postgis:9.6 | ||
| restart: always | ||
| ports: | ||
| - "5555:5432" | ||
| environment: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: engineTest888 | ||
| POSTGRES_DB: zesty | ||
| volumes: | ||
| - ./init-db/:/docker-entrypoint-initdb.d/ | ||
| - pg-data:/var/lib/postgresql/data | ||
| volumes: | ||
| pg-data: |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| CREATE EXTENSION IF NOT EXISTS postgis; | ||
| CREATE EXTENSION IF NOT EXISTS postgis_topology; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS public.properties ( | ||
| id varchar(100) NOT NULL, | ||
| geocode_geo geography NULL, | ||
| parcel_geo geography NULL, | ||
| building_geo geography NULL, | ||
| image_bounds float8[] NULL, | ||
| image_url text NULL, | ||
| CONSTRAINT properties_pk PRIMARY KEY (id) | ||
| ); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| TRUNCATE TABLE properties; | ||
|
|
||
| INSERT INTO properties (id, geocode_geo, parcel_geo, building_geo, image_bounds, image_url) | ||
| VALUES ('f1650f2a99824f349643ad234abff6a2','0101000020E61000003A765089EB6F52C0F0259EFD92754440','0103000020E61000000100000005000000AF4B76DEE76F52C0459326408E75444061F49A1CED6F52C02E558CBA8A7544403C8D9280EF6F52C022948A1893754440B0201019EA6F52C0DF48C98696754440AF4B76DEE76F52C0459326408E754440','0103000020E6100000010000000700000004E78C28ED6F52C0250516C094754440B08C0DDDEC6F52C0A9177C9A937544409259BDC3ED6F52C0A35A4414937544409373620FED6F52C0A4C2D8429075444023827170E96F52C0EB3A54539275444076C24B70EA6F52C066C0594A9675444004E78C28ED6F52C0250516C094754440', | ||
| '{-73.74917015433311, 40.91823163691108, -73.74833196401596, 40.918865008051775}', | ||
| 'https://storage.googleapis.com/engineering-test/images/f1650f2a99824f349643ad234abff6a2.tif'); | ||
|
|
||
| INSERT INTO properties (id, geocode_geo, parcel_geo, building_geo, image_bounds, image_url) | ||
| VALUES ('f853874999424ad2a5b6f37af6b56610','0101000020E6100000D61DE626450554C0B664FACA28533A40','0103000020E61000000100000008000000F9A9C84F4A0554C012A832B632533A40BB7AB866420554C004331B7832533A40DEDD2B76420554C099115E8E28533A4087253899420554C0CACE29A71E533A408CA4E9FD490554C08336A05A20533A4063D1B1FC490554C02A117A7E26533A40FA2706184A0554C0FD723E9F2C533A40F9A9C84F4A0554C012A832B632533A40','0103000020E6100000010000000900000046408523480554C0D120054F21533A40319A95ED430554C04E42E90B21533A40C0266BD4430554C01C3F541A31533A405891D101490554C0E10CFE7E31533A4010CB660E490554C055849B8C2A533A402384471B470554C014950D6B2A533A400B42791F470554C00A83328D26533A4076C4211B480554C0AB7AF99D26533A4046408523480554C0D120054F21533A40', | ||
| '{-80.08276484906673, 26.324465748554815, -80.08192665874958, 26.325217013939653}', | ||
| 'https://storage.googleapis.com/engineering-test/images/f853874999424ad2a5b6f37af6b56610.tif'); | ||
|
|
||
| INSERT INTO properties (id, geocode_geo, parcel_geo, building_geo, image_bounds, image_url) | ||
| VALUES ('3290ec7dd190478aab124f6f2f32bdd7','0101000020E61000007056E993010554C0F956DA988DE23A40','0103000020E610000001000000120000003001F9B2FE0454C042AD49F299E23A406BD99F24FF0454C01174DA2676E23A4010F108ABFF0454C0C21F459577E23A4016527A23010554C04CD48E7B78E23A40D144AC52040554C08DC223577DE23A405C45BAA5050554C013B51DE17EE23A4012D7CE32080554C03D9236FF80E23A40561F6B45020554C074EA81EE9EE23A4064D13013020554C0EC8CE7919DE23A400C2011D2010554C0A30B99569CE23A408728B983010554C03403B4449BE23A4075232D2A010554C0033145639AE23A40671BBBC7000554C099FF19B899E23A40F7BCEB5E000554C0074B9A4799E23A40A5A471F2FF0454C06059AB1499E23A4045981785FF0454C05DC69C2099E23A404E21AE19FF0454C007E01F6B99E23A403001F9B2FE0454C042AD49F299E23A40','0103000020E6100000010000000B0000009AEC9FA7010554C059F8FA5A97E23A400A2C8029030554C0BD55D7A19AE23A40D93F4F03060554C007B5DFDA89E23A403F53AF5B040554C08081204086E23A40F8A6E9B3030554C0E99B340D8AE23A40942F6821010554C08D63247B84E23A4036751E15FF0454C06F675F7990E23A40FA28232E000554C0A93121E692E23A40172829B0000554C0C8B260E28FE23A40E198654F020554C0AFEE586C93E23A409AEC9FA7010554C059F8FA5A97E23A40', | ||
| '{-80.07864028215408, 26.88459934588957, -80.07780209183693, 26.885346941040712}', | ||
| 'https://storage.googleapis.com/engineering-test/images/3290ec7dd190478aab124f6f2f32bdd7.tif'); | ||
|
|
||
| INSERT INTO properties (id, geocode_geo, parcel_geo, building_geo, image_bounds, image_url) | ||
| VALUES ('5e25c841f0ca47ac8215b5fd0076259a','0101000020E61000005840FC5731E955C0BE1F6DD223F64440','0103000020E610000001000000090000001206174930E955C04D88728721F64440023E3E4C32E955C08720957B21F64440CDC1025532E955C0EDEEA59E23F64440C45E785D32E955C042CAB5C125F64440D5863D6632E955C0BBBC50E427F644402F363C6130E955C0091459F027F64440CBD2305930E955C08F0D9ACD25F6444000EB235130E955C0B10787AA23F644401206174930E955C04D88728721F64440','0103000020E610000001000000050000007383A10E2BE955C06971C63027F644402E90A0F831E955C0878A71FE26F644408D98D9E731E955C09CC58B8521F64440D28BDAFD2AE955C0AD307DAF21F644407383A10E2BE955C06971C63027F64440', | ||
| '{-87.64405556023121, 41.92265629567588, -87.64321736991405, 41.92327994592767}', | ||
| 'https://storage.googleapis.com/engineering-test/images/5e25c841f0ca47ac8215b5fd0076259a.tif'); | ||
|
|
||
| INSERT INTO properties (id, geocode_geo, parcel_geo, building_geo, image_bounds, image_url) | ||
| VALUES ('622088210a6f43fca2a1824e8610df03','0101000020E6100000A79608AFB80454C08CEABEAD05633A40','0103000020E61000000100000017000000D80A63C9B30454C05239D2CF0E633A403679580BB30454C092B4B7F3FC623A40E69FE5C9BA0454C0285F77C6F8623A400D83F7F6BA0454C0F72CC9B9F8623A4014541524BB0454C01CF317C4F8623A40BBF45850BB0454C0701E2FE5F8623A409F9FE07ABB0454C073E7651CF9623A40C967D3A2BB0454C02BAFA268F9623A400403BB3EBD0454C01B0F4D06FD623A40B39C6166BD0454C07E237D6FFD623A4065731689BD0454C0AFB254EDFD623A405D8107A6BD0454C08B37DA7CFE623A405DA385BCBD0454C08830A91AFF623A4088BC08CCBD0454C057A706C3FF623A400BEE32D4BD0454C0BBC3F77100633A4028CFD2D4BD0454C0FAE0592301633A404198E4CDBD0454C02494FBD201633A40A97E98B0BD0454C04155AB5C04633A40A3C307A8BD0454C0305926EE06633A4064386AAFBD0454C0371FB62211633A40D44AC0F5B60454C089383C6311633A4009A79B14B40454C056BAD20C0F633A40D80A63C9B30454C05239D2CF0E633A40','0103000020E610000001000000110000003F3A75E5B30454C02E02637D03633A40FD304278B40454C0B3CD8DE909633A40D34F38BBB50454C0438EAD6708633A40FCFCF7E0B50454C0D7A3703D0A633A40A86E2EFEB60454C0494BE5ED08633A400D349F73B70454C0FFCEF6E80D633A40FA7ABE66B90454C006F4C29D0B633A40ADDD76A1B90454C082AD122C0E633A40B857E6ADBA0454C0944C4EED0C633A40B28009DCBA0454C0C959D8D30E633A40DBF97E6ABC0454C0354415FE0C633A401D03B2D7BB0454C0AF78EA9106633A40AB5B3D27BD0454C09E4143FF04633A40ED647094BC0454C0FB5C6DC5FE623A40CBF6216FB90454C02288F37002633A404EEFE2FDB80454C00DFCA886FD623A403F3A75E5B30454C02E02637D03633A40', | ||
| '{-80.07419116795063, 26.386429931549575, -80.07335297763348, 26.387180794346914}', | ||
| 'https://storage.googleapis.com/engineering-test/images/622088210a6f43fca2a1824e8610df03.tif'); |
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.
Uh oh!
There was an error while loading. Please reload this page.