This microservice exposes a REST API for querying rental price reference indexes based on Spanish census sections. It mirrors the logic and methodology used by the Sistema Estatal de Referencia de Precios de Alquiler de Vivienda (SERPAVI) to calculate reference rental prices. Since their API is not public, I´ve decided to create my own with the procedure explained in their methodology so it can be used freely by third parties
- Get the census section corresponding to a given address or geographic coordinates.
- Retrieve the initial and final reference rental price per square meter for a census section.
- Local SQLite database with P25, P75, and Smed SERPAVI data.
- Uses geocoding to resolve addresses and matches them to census shapefiles.
- Node.js + TypeScript
- Express
- SQLite
- Vitest (for testing)
- OpenAPI (for API documentation)
git clone https://github.com/lluisoh/mic-serpavimirror.git
cd mic-serpavimirror/codenpm installThe microservice requires local geospatial data and SERPAVI values:
- Use the script
scripts/fetch-geojson.tsto download and prepare GeoJSON files from INE shapefiles.
npm run devServer will start on http://localhost:3000 by default.
npm testGET /api/census-section/address?street=...&municipality=...GET /api/census-section/coords?lat=...&lng=...GET /api/price/initialGET /api/price/finalFull OpenAPI documentation is available in api/openapi.yml.
- SERPAVI: Reference rental price data used by the Ministerio de Vivienda y Agenda Urbana.
- INE Shapefiles: Used to determine the census section based on coordinates or address.
This project is licensed under the CC BY-NC 4.0 License.
You may use, modify, and share this project for non-commercial purposes, with attribution.