meirim-org / meirim

Meirim is an open-source smart city application that facilitates transparency in urban planning.
MIT License
56 stars 24 forks source link

Implement Search Plan on the new Mavat #573

Closed GalGend closed 1 year ago

GalGend commented 2 years ago

A few months ago we started to get plan urls for the new Mavat API. For each plan, we have either have URL, or new_mavat_url. The new mavat URL is the only URL we need as the old mavat is off. Yet, as we get the URL from the Blue Lines API, there are all the old plans, that had been fetched before we migrated to the new mavat, that miss the new mavat URL.

This task therefore is to add the new_mavat_url to all plans, so they can be re-fetched and rescrapped at some point. The new mavat URL is of this structure: https://mavat.iplan.gov.il/SV4/1/5000732931/310 while this is the format : https://mavat.iplan.gov.il/SV4/1/{MP_ID}/310

The agam_id is the id at the new mavat, so in order to get the new mavat link we need to get it. The way to get the mp Id is to use the Search functionality at the new mavat website: https://mavat.iplan.gov.il/SV1 image.

To that searchbox, you may enter the plan ID (PL_NUMBER as stored for all plans in the DB), and then, if only one plan matches that ID, you're redirected to the plan page, where the agam_id can be extracted from the URL.

image

The script should run for all plans that don't have the MP_ID, and fill both fields

image

We used to have that function for the old mavat, so you may use the existing function, called search.

image