Giter VIP home page Giter VIP logo

woningfinder's Introduction

WoningFinder

WoningFinder was a project that I had during the COVID lockdown, while trying to find a house in the Netherlands. It automates the process of finding a rent house by searching and reacting automatically to houses matching your preferences (think of number of bedrooms, city and neighborhood). More information about the project can be found on woningfinder.nl (in Dutch).

Having found my house thanks to this tool, I have decided to make WoningFinder backend open-source. If you want it to support more websites feel free to submit a PR that adds a connector for a housing website. Please don't hesitate to submit a PR to this repository if you have any other suggestions or improvements. Keep in mind that this project was in its early stage, so the code was not yet optimized nor pretty. I am not actively maintening this project, but I am happy to help if you have any questions.

More information can be found in the docs.

Stack

Services

  • Sentry
  • Mapbox

Architecture

WoningFinder is split in multiple components:

  • woningfinder-api, is serving the different handlers, it serves as API for woningfinder.nl frontend so the user can register, login to a housing corporation and manage their housing preferences.
  • housing-matcher, is triggered by HousingFinder via a queue (redis list). It will match the new offers to the customer search option and react to it.
  • orchestrator, orchestrates the different jobs that needs to be often ran by WoningFinder.
    • CleanupUnconfirmedCustomer sends a reminder to unconfirmed email user and deletes the customers that did not confirm their email within 72 hours. Runs everyday at 08:00, 16:00.
    • HousingFinder is used to query all the offers of the housing corporation. It connects them all and query them at the right time and sends its data to a redis queue (triggering HousingMatcher).
    • WeeklyUpdate generates and send the customer weekly updates. Runs every Friday at 18:00.
    • CorporationCredentialsMissingReminder sends missing corporation credentials reminder to matching customers. Runs everyday at 08:00, 16:00.
  • housing-finder replicates the HousingFinder job for a given corporation.
  • db-migrator initializes the database with default values (housing corporations, cities, housing types, selection methods...) and run the databases migrations. It is run as a job before every deploy.
  • city-location-updater updates the city location in the database. It is run as a job before every deploy.
  • impersonate gets a JWT token for an user in order to impersonate it.
  • customer-delete deletes customers given their email.

Issue names

  • feature and bug: Implement [Issue Name] (closes #issue)

woningfinder's People

Contributors

dependabot[bot] avatar julienrbrt avatar

Stargazers

 avatar

Watchers

 avatar  avatar

woningfinder's Issues

Legal notes

Funda Soep

Ongeveer de helft van de jurisprudentie over databankrecht is “Nederlandse Vereniging van Makelaars versus iemand die Funda wil scrapen”, en dat is niet zo gek, want de huizenmarkt is erg lucratief. De Telegraaf was de eerste met El Cheapo, dat de zoekresultaten van Funda schraapte en toonde alsof het haar eigen zoekmachine was. Dat mocht niet, oordeelde de Hoge Raad in 2002, want Funda was een beschermde databank. Funda had flink geïnvesteerd in die site. Onder andere had ze iedere NVM-makelaar van een terminal voor het uploaden van advertenties voorzien - zo’n 19.000 gulden per stuk.

Zoekallehuizen had het dan handiger bekeken: die namen Funda niet over, maar gingen gewoon naar de sites van de individuele makelaars, waar immers al die advertenties ook staan. Kost iets meer werk, maar daar heb je spiders voor.
Dit mocht: de makelaars waren immers niet bezig met een databank met huizenadvertenties, maar met het verkopen van huizen. De advertenties op hun site waren dus niet beschermd onder het databankenrecht. En Zoekallehuizen toonde niet de hele advertentie, maar alleen een kort stukje tekst, een verkleinde foto en een hyperlink naar de originele advertentie op de site van de makelaar. Dat valt onder het citaatrecht; Zoekallehuizen kondigt zo aan wat er te zien is achter de hyperlink.

http://sync.nl/andermans-site-scrapen-wanneer-mag-dat/3

Replace reverse geocoding API

WoningFinder is now using Nominatim for querying the city district of a house.
It seems like at a higher rate the API calls will be limited and WoningFinder does not comply with the acceptable usages policy.

  • Find alternative (possibly Here Maps API)
  • Add fallback to find city district from address if coordinates not available (or simply use address to find city district)

Make checking time of offers corporation specific

Replace auto guess cron (and remove env) by adding checking time default to WoningFinder and to houses corporations. Checks only twice a day at those times. Allow as well to check only one housing corporation

Improve logging

Right now it is hard to see which logs belongs to which connector for housing-finder. Improve it's logging.

At the same time verify the logging fo any other service.

Improve testing

The testing must be complete and the code coverage must be high. It is extremely important to ensure everything is tested as the core of WoningFinder is based on using external APIs.

Note: Yet unit tests calls external party, they should use mock, the real test should be end-to-end tests

  • add tests that ensure that all connector fills-up all the data of the Housing (end to end test)

Implement resiliency pattern

  • retry policy
  • Avoid querying the database at each request, check if a cache (with redis or on memory) can be used
  • rate limiter
  • random user agent, change of it etc, etc..
  • add timeout

Check more on go resiliency pattern

Add possibility to update housing corporation

  • When fetching houses, check if the city exists in the database, if not add it to the corporation (because the corporation now supports that city) -> in order to avoid doing a check at each request, store the list of city in an array and check it against the database.
  • Add tools to update housing corporation based on their Info
  • When reacting to an offer the users should be sorted by creation date (earlier first) and plan (pro first)

Improve clientProvider

The ClientProvider interface permits to get a corporation.Client from a housing corporation entity.
Yet it is hardcoded and gotten by name which is not nice. Possibly find a solution to that (maybe using reflection?)

Implement handlers (and stripe)

Backend

  • Look at https://github.com/go-chi/chi and net/http
  • Stripe webhook for payment to confirm a user payed and save it in the database (queue it in redis then validate it with worker). More information here
Endpoint Name Method Description OK
/signup POST Handles the registration flow
/cities GET Gets all supported cities
/housing-preferences PUT Updates the housing preferences of a given user 🟥
/corporation-credentials GET / POST Manages the different housing credentials for the supported corporation of the user.

Use cases

  • Payment should be done for validating completion of the registration. WoningFinder should not look for a house if the user has not paid.
  • Possibly needs to add more field in the database about notions (containing the user plan, the payment date, and if he found a house using his housing preferences).

Implement connector WoningNet

WoningNet often contains the 3 way of reactions (Random, First come first served and registration period).

Maybe it would be nice to split the multi fetch of first come first served with the rest

Remind user automatically to pay his account

Right now a user that didn't paid automatically get deleted after 48h. Add a reminder to the user to finish its order 8h after the user is created.

Do watch out that the email is sent only once.

Automatic account deletion

Once someone has found a house the zoekopdracht is automatically deleted. The user will have to pay again if he wants to looks longer. This means maybe create as well a daily cron that checks users with zoekopdracht that should be deleted (and send notification about it #3).

Improve checks between Basis vs Pro plan

Right now someone can take the basis plan and react to all houses. Add a maximum incomes for the basis plan (maybe update offering?).

This requires API and website change

Implement email notification

Implement email notifications:

  • Welcome email (explaining again weekly email)
  • Notifies to which house WoningFinder has applied and where (with link)
  • Notifies if a housing corporation credentials is not valid anymore - Postponed to #11
  • Notify if zoekopdracht deleted because a house has been found - Postponed to #15

Improve housing / appartement preferences

Right now if a user looks for a house and an appartement and wants a balcony and a garden, both the house and the appartement should have a balcony and a garden to be selected.

We want smart preferences such as a house with a garden and an appartement with a balcony would be selected instead of nothing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.