<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ozmasg</title>
    <description>The latest articles on DEV Community by ozmasg (@ozmasg).</description>
    <link>https://dev.to/ozmasg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F844054%2F9c349054-5661-4728-9be7-8cdc7d2d8b40.png</url>
      <title>DEV Community: ozmasg</title>
      <link>https://dev.to/ozmasg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ozmasg"/>
    <language>en</language>
    <item>
      <title>Food Project: Data source</title>
      <dc:creator>ozmasg</dc:creator>
      <pubDate>Wed, 13 Apr 2022 16:30:37 +0000</pubDate>
      <link>https://dev.to/ozmasg/food-project-data-source-2mei</link>
      <guid>https://dev.to/ozmasg/food-project-data-source-2mei</guid>
      <description>&lt;h2&gt;
  
  
  Brief
&lt;/h2&gt;

&lt;p&gt;In this blog, we'll discuss the data we need, how we can get it, and how we might want to format it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What data do we need?
&lt;/h2&gt;

&lt;p&gt;As discussed in the last post, the data we need is &lt;strong&gt;the ratings received for each restaurant per minimum interval&lt;/strong&gt;. For the sake of brevity, we'll just assume for now that the minimum interval is a month.&lt;/p&gt;

&lt;p&gt;The biggest problem that comes to mind is that we need this data not only for the present, but also at each interval in the past. &lt;/p&gt;

&lt;p&gt;For example, we can easily get the current rating data at the time of writing, which is April 2022. But we also need the state of reviews at March 2022, February 2022, January 2022.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where could we get this data?
&lt;/h2&gt;

&lt;p&gt;I was hoping to use Google's own API as they have a generous monthly free package, but unfortunately it is quite limited for our purposes. It only offers current review data, and only a very limited view of a location's review history.&lt;/p&gt;

&lt;p&gt;This means we'll have to lean on an alternative data source. After looking through a few options on my own, I've landed on &lt;a href="https://dataforseo.com/"&gt;DataForSEO&lt;/a&gt;, which provides us with a way to get scraped data from Google's search engine results.&lt;/p&gt;

&lt;h3&gt;
  
  
  How will we get this data
&lt;/h3&gt;

&lt;p&gt;Our input options are limited to whatever Google has decided to make available on their SERPs (Search Engine Result Pages), because that's what DataForSEO operates on.&lt;/p&gt;

&lt;p&gt;We'll get the data with the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get a list of different neighbourhoods in Singapore, provided by &lt;a href="https://docs.dataforseo.com/v3/serp/google/locations/?bash"&gt;the Google Locations API on DataForSEO&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Request 'food nearby' search results at each of these locations using &lt;a href="https://docs.dataforseo.com/v3/serp/google/maps/task_post/?bash"&gt;DataForSEO's SERP API&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For each unique result, we will request available reviews using &lt;a href="https://docs.dataforseo.com/v3/business_data/google/reviews/task_post/?bash"&gt;DataForSEO's Business API&lt;/a&gt;, using the Google Place ID's returned in the previous step.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This will give us - based on Google's discretion - up to 5300 locations, some of which may be duplicates, or non-food locations, which we will have to filter out. &lt;/p&gt;

&lt;p&gt;After doing some initial testing, I've found that out of the 4985 locations returned by the SERP API, 4005 were duplicates, and 127 were non-food locations, leaving us with only 890 unique results.&lt;/p&gt;

&lt;p&gt;It may be worth toying with increasing the number of results per location, or trying to look into the coverage of the areas provided by step 1, but this seems sufficient for our initial proof-of-concept.&lt;/p&gt;

&lt;h2&gt;
  
  
  Obstacles
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What obstacles do we have?
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Price
&lt;/h4&gt;

&lt;p&gt;The first obstacle is pricing. The SERP API is very affordable, but the Business API is much more expensive, priced at $0.00075 per 10 reviews. &lt;/p&gt;

&lt;p&gt;The aforementioned 890 unique locations add up to a total of 660,750 reviews (rounded up to the nearest 10 for each location). That would cost us approximately ~USD 55 to request all the results for all of the 890 locations. While that's not prohibitively expensive, it's not something I'd like to spend before ensuring that all of this will pan out the way I'm imagining.&lt;/p&gt;

&lt;p&gt;I don't believe this to be a major obstacle - if the concept proves to be useful, $50 is not a large price to pay, even if it is not paid back. However, it may be prudent to rely instead on mock data, at least for the testing phase.&lt;/p&gt;

&lt;h4&gt;
  
  
  Limitations
&lt;/h4&gt;

&lt;p&gt;The second obstacle is a limitation of DataForSEO's API. Their Business API also only returns up to 4490 results per location, which is not enough to cover the full depth of reviews of some more popular locations. &lt;/p&gt;

&lt;p&gt;Although it would be ideal to cover each location's entire history, I believe it is not an essential part of our website, given that anything beyond 4490 results is probably reaching into the mid-2010s. &lt;/p&gt;

&lt;p&gt;This may be a time to refine our requirements to include a target timeframe - perhaps 'recent trends over the last two years' or something of the sort, which should be covered by 4490 reviews.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where are we at now?
&lt;/h2&gt;

&lt;p&gt;We've laid out the steps for how we can get the data from DataForSEO, as well as discussed the major obstacles in dealing with their API, as well as how we can 'deal' with them.&lt;/p&gt;

&lt;p&gt;I believe in the next step, we can finally start looking at how we will approach the design of our software.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Food Project: What do we need?</title>
      <dc:creator>ozmasg</dc:creator>
      <pubDate>Mon, 11 Apr 2022 06:28:04 +0000</pubDate>
      <link>https://dev.to/ozmasg/food-project-what-do-we-need-c38</link>
      <guid>https://dev.to/ozmasg/food-project-what-do-we-need-c38</guid>
      <description>&lt;h4&gt;
  
  
  Brief
&lt;/h4&gt;

&lt;p&gt;We'll go through the expected features, lay out some initial requirements, and then figure out what data we need to even begin thinking about implementing our requirements.&lt;/p&gt;

&lt;h4&gt;
  
  
  What is a requirement?
&lt;/h4&gt;

&lt;p&gt;A requirement is a target feature of the end product. These depend on where the requirements come from, but some examples are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Technical requirements (ie. to abide by internal standards)&lt;/li&gt;
&lt;li&gt;Functional requirements (usually for the end user)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  What will be our requirements?
&lt;/h4&gt;

&lt;p&gt;To keep things simple, we'll define our requirements based on what we know, which is the functionality we want to achieve:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;View a restaurant's average rating derived from recent reviews over a user-specified time period&lt;/li&gt;
&lt;li&gt;Observe trends in restaurant popularity based on the number of reviews it has received within user-specified time intervals&lt;/li&gt;
&lt;li&gt;Observe trends in restaurant quality based on the average rating it has received within user-specified time intervals&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  What data do we need to achieve these requirements?
&lt;/h4&gt;

&lt;p&gt;Let's start from what data we need to be able to achieve these requirements. Once we know what data we need, we can think about where to get it from, how to store it, how to retrieve it, and how we deliver it to our users.&lt;/p&gt;

&lt;p&gt;Thankfully, it seems the data we need is just &lt;strong&gt;the ratings received for each restaurant per minimum interval&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;If we assume the minimum interval is per-week, that data may look something like this (assumed for one restaurant):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;timestamp&lt;/th&gt;
&lt;th&gt;01-July-2022&lt;/th&gt;
&lt;th&gt;08-July-2022&lt;/th&gt;
&lt;th&gt;15-July-2022&lt;/th&gt;
&lt;th&gt;...&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1-star ratings&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2-star ratings&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;...&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5-star ratings&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And to achieve those requirements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Calculate average of data with rating history over last X months&lt;/li&gt;
&lt;li&gt;Calculate # of reviews per interval with all rating history&lt;/li&gt;
&lt;li&gt;Calculate average rating per interval with all rating history&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It should be noted that we only need &lt;em&gt;rating history&lt;/em&gt;, and have no need for anything else that's contained from the Google reviews.&lt;/p&gt;

&lt;h4&gt;
  
  
  What does the picture look like right now?
&lt;/h4&gt;

&lt;p&gt;It seems we'll need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A data source for Google reviews data
&lt;/li&gt;
&lt;li&gt;A database to store Google reviews data&lt;/li&gt;
&lt;li&gt;A service to pull data from the data source, parse it, and store it in the database&lt;/li&gt;
&lt;li&gt;Frontend which will display the data, which is retrieved from...&lt;/li&gt;
&lt;li&gt;Backend which hosts an API, providing calculated &amp;amp; formatted data which is read from&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Food Project: Starting from the concept</title>
      <dc:creator>ozmasg</dc:creator>
      <pubDate>Fri, 08 Apr 2022 08:20:27 +0000</pubDate>
      <link>https://dev.to/ozmasg/todayeatwhere-starting-from-the-concept-2e1d</link>
      <guid>https://dev.to/ozmasg/todayeatwhere-starting-from-the-concept-2e1d</guid>
      <description>&lt;p&gt;Disclaimer: This is really more of a personal blog. If things go well and I start to share these documents, perhaps I will come back to clean these up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is my first personal project and dev log!&lt;/p&gt;

&lt;p&gt;The goal here is to document my thought processes as I work through the project, not only as a way to reflect on decisions I made later down the line, but also to be able to use some of these documents as a guiding light if needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem Statement
&lt;/h2&gt;

&lt;p&gt;Ratings on Google Maps - as far as I'm aware - are not guided by any sort of recency. &lt;/p&gt;

&lt;p&gt;This means even if a restaurant has decreased drastically in quality recently, it may still appear to be highly rated based on its past ratings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Concept
&lt;/h2&gt;

&lt;p&gt;To provide the functionality of isolating the ratings of restaurants within a certain time period rather than over the course of its entire history.&lt;/p&gt;

&lt;p&gt;This will allow users to judge a restaurant based on its 'recent' rating, where the acceptable time period is determined by user discretion.&lt;/p&gt;

&lt;h4&gt;
  
  
  Targeted Core Features:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;View a restaurant's rating based on reviews over a specified time period&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Targeted Extra Features:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Observe trends in restaurant popularity based on the number of reviews it has received over a specified time period&lt;/li&gt;
&lt;li&gt;Observe trends in restaurant quality based on the increases or decreases of rating over a specified time period&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Limitations:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Scope of data will be limited to Singapore.&lt;/li&gt;
&lt;li&gt;Initial source of data will be limited to Google reviews, and will not include other review sources.&lt;/li&gt;
&lt;li&gt;Only observe up to the N most popular restaurants in specific locales around Singapore.

&lt;ol&gt;
&lt;li&gt;This is mostly due to how Google search and the SERP API works, preventing us from being able to just get data for all restaurants in Singapore.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Concerns:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Scope should be limited so that the initial product can be completed quickly.&lt;/li&gt;
&lt;li&gt;Expenditure should be minimized as far as possible, as there is no plan to profit off this project.&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
  </channel>
</rss>
