You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What if users want to search donors in nearby area based upon their pincode?.
We built the same type of API in node js and here it is the link of the website. PlasmaDonor
Solution how to map pincode to distance between donor and requestor.
Sadly we wrote the above apis and frontend both in js. thus I can't help much with the code but here is what we did.
At the time of registration take a valid pincode from the donor. here is the api to validate the pincode . This api also gives the latitude and longitude coordinates of the place asked and nearby places.
The next step is to store this latitude and longitude for each user. and then at the time of someones request for donors through a pincode, again call the same api to get lat long of the current requestors pincode. now we have lat long of requestor and remember we had lat long of donors in our database. For the purpose to not traverse the whole database we only search those pincodes in database which are having first 3 digit same as the requestors pincode and to most extent it works fine.
suppose you have some list of donors now from your database which are near to current pincode. then run this function to get the exact distance between the donors and the requestor.
functiongetDistanceFromLatLonInKm(lat1,lon1,lat2,lon2){lat1=parseFloat(lat1);lon1=parseFloat(lon1);lat2=parseFloat(lat2);lon2=parseFloat(lon2);console.log(lat1,lon1,lat2,lon2);varR=6371;// Radius of the earth in kmvardLat=deg2rad(lat2-lat1);// deg2rad belowvardLon=deg2rad(lon2-lon1);vara=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);varc=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));vard=R*c;// Distance in kmreturnd;}
Now you have distance of a requestor with respect to all donors apply some more filters regarding blood group age and gender matching and shoo the results. for more details here is our backend in nodejs link. I really wanted to contribute but lack of php skills.
For more info on how we did it.
Our nodejs backend repo link.
We wanted users to get involved in our website and populate the database but since this is much popular website and having a greater user database. I want that you continue this project . Thank you And help India fight Covid 19.
JPRMohnish
changed the title
Feature: [title]Pincode based search for exact distance between donors and requestor.
Feature: [Pincode based search for exact distance between donors and requestor.]
May 3, 2021
JPRMohnish
changed the title
Feature: [Pincode based search for exact distance between donors and requestor.]
Feature: Pincode based search for exact distance between donors and requestor.
May 3, 2021
What if users want to search donors in nearby area based upon their pincode?.
We built the same type of API in node js and here it is the link of the website. PlasmaDonor
Solution how to map pincode to distance between donor and requestor.
Sadly we wrote the above apis and frontend both in js. thus I can't help much with the code but here is what we did.
At the time of registration take a valid pincode from the donor. here is the api to validate the pincode . This api also gives the latitude and longitude coordinates of the place asked and nearby places.
The next step is to store this latitude and longitude for each user. and then at the time of someones request for donors through a pincode, again call the same api to get lat long of the current requestors pincode. now we have lat long of requestor and remember we had lat long of donors in our database. For the purpose to not traverse the whole database we only search those pincodes in database which are having first 3 digit same as the requestors pincode and to most extent it works fine.
suppose you have some list of donors now from your database which are near to current pincode. then run this function to get the exact distance between the donors and the requestor.
Now you have distance of a requestor with respect to all donors apply some more filters regarding blood group age and gender matching and shoo the results. for more details here is our backend in nodejs link. I really wanted to contribute but lack of php skills.
For more info on how we did it.
Our nodejs backend repo link.
https://github.com/JPRMohnish/PlasmaBackend/
We wanted users to get involved in our website and populate the database but since this is much popular website and having a greater user database. I want that you continue this project . Thank you And help India fight Covid 19.
For more info ping me on linkedin.
The text was updated successfully, but these errors were encountered: