ibslover's Issues
Caching Recent Search Queries Locally
In most cases, the bathroom information for a specific area won't drastically change within a single day. Under this premise, if a user conducts a search and the result is within the vicinity, say about 100 meters, we can save this result into the database. If another query is made by any user within this proximity shortly afterward, we can swiftly provide the results from the recent search instead of querying again.
This strategy will serve to boost search speed and reduce the frequency of Google Maps API calls. Considering that this app has a core user base—likely individuals with IBS, who are the main users—it's highly probable that these frequent users will perform queries within specific areas. Thus, relying on our database for rapid searches can alleviate the need for constant Google Maps API calls. I'm even contemplating whether we could leverage a fast-caching system like Redis instead of traditional databases such as MongoDB for speedier retrieval.
For the sake of data accuracy, the stored queries would be refreshed daily.
Improve Rate Limit
Currently rate limit is done using redis server as a counter and count requests from every IP, there are better ways to do this, for example:
Cloudflare solutions: https://www.cloudflare.com/application-services/solutions/#protect-websites-applications-solutions
and/or
express rate limit middle ware: https://www.npmjs.com/package/express-rate-limit
Security problem
The backend service lacks measures to prevent flood attacks. If the backend service API is reverse-engineered, it can be flooded with a large number of requests in a short period of time, leading to economic losses due to excessive calls to the Google Maps API.
Currently considered mitigation strategies:
- Google Maps API Key Usage Limitation: Apply a usage limit to the Google Maps API key. Each call increases the usage count, and when the usage reaches the daily limit, no further access is allowed.
- IP Usage Limitation: Restrict the number of requests from the same IP address within a short period of time.
Limitations
- Theoretically, attackers can still conduct flood attacks by changing IP addresses. However, due to the usage limit imposed on the Google Maps API key, economic losses can be mitigated. Nevertheless, subsequent users may be unable to access our service.
Improving Location Accuracy for Toilet Entries
Description
Current Implementation: As it stands, when a user submits a new toilet location, the system checks the database for any existing toilets within a defined range, (let's say 20 meters). If a toilet is present within this proximity, it's assumed to be the same one, and the existing entry's vote count is incremented by one. If there is no matching entry, a new toilet with a vote count of one is added to the database.
Issue: This method presents a challenge when the user's GPS location isn't precise within 20 meters, leading to potential errors. One idea I'm considering is to insert the user's data into the toilet entry when a toilet is detected within the 20-meter range in the database. Subsequently, when displaying this data, the system would calculate the average of all the coordinates for that specific entry, resulting in a more accurate toilet location.
Seeking Better Solutions: I am exploring if there are any better methods to enhance the accuracy of this feature.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.