updated categories, added number parsing, and fixed minor regex bug to handle singular + plural cases #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jinwook- my friend!
I recently came across your awesome library while designing a Google Map calculator (repo) to help volunteers devise contribution plans to reach their goals based on their current contribution data. Huge fan of your work and thank your for all the hard work you've put into this! <3
I was able to use your
google-local-guides-api"library" to initially get my program up and running locally.Based on my experience of using it and from being a Local Guide volunteer myself, I noticed and made a few suggested changes that I'm sharing here for your approval/discussion in this Merge Request. :)
1. Removal of Published Lists:
The handling of
published listshas been removed as Google Maps no longer awards points or tracks contributions toward the category ofpublished lists.2. Addition of New Contribution Categories:
New contribution categories have been added to better reflect the current added categories that Google Local Guides can contribute to like
captionsThis ensures that users can retrieve the most up-to-date information regarding their contributions.3. Renaming of "Questions" to "Answers":
I updated where you termed a category as "questions" to "answers" instead. This is to accurately represent the data being collected, as This change improves clarity and aligns with how this category is where users answer multiple choice questions provided by Google.
4. Number Parsing Helper Function:
A new static method,
parseNumber, has been introduced to facilitate the parsing of numeric values from strings. This method removes commas and converts the cleaned string into an integer, ensuring that numeric data is handled correctly.[Without this added, I saw instances where the first digit of a number would be cut off if there were multiple digits and commas present.]
5. Handling Singular and Plural Forms:
The regex patterns have been updated to include a star
(*)after the lettersin each of the contribution types (e.g., "photos", "videos"). This adjustment allows the regex to match both singular and plural forms. [Without this added, if there was only a single contribution in any of those categories, the regex would be unable to retrieve anything since with singular 1 contribution, there is nosat the end, i.e "1 photo".]This changes were validated through console logging of the
responseBodyand testing the regex patterns on regex101.com. This step ensured that the regex patterns are functioning as intended and accurately capturing the required data.Lastly:
How about we add a note to the
readmeto clarify that the regex is limited to the English version of Google Maps? The regex code currently relies on English words for matching. This is important for users to understand the context and limitations of the data extraction process. :)Let me know if any questions or comments.