Docs


Updating the Database: Choosing the Right Identifier



When maintaining and updating your database of places, it’s crucial to select the right identifier to ensure data accuracy and reliability. There are two primary identifiers associated with places: business_id and place_id. Based on our experience, relying on the place_id offers greater reliability, as business_id appears to change over time in certain scenarios. Below, we’ll explore the differences between these identifiers and provide practical use cases.

Place ID vs. Business ID


  • place_id
    The place_id is a stable, unique identifier that is consistently associated with a specific place. It rarely changes and is ideal for maintaining long-term database integrity.
  • business_id
    The business_id may change over time due to updates, reorganizations, or other internal factors within the data source. While it is still a useful identifier, its potential for inconsistency makes it less reliable for long-term use.

Why Use place_id?

  • Stability: Unlike business_id, which can be subject to changes, place_id remains constant even if a business undergoes updates or revisions in the data source.
  • Ease of Updates: With a consistent identifier, updating your database becomes more straightforward. You can match new data to existing records with minimal risk of mismatches or duplication.
  • Future-Proofing: Using a stable identifier like place_id ensures that your database remains accurate even as external data sources evolve.

Use Cases for Database Updates

  1. Updating Business Information:
    Scenario: A business updates its phone number, address, or operating hours.
    Solution: Use the place_id to match and update the correct entry in your database, ensuring no records are overwritten or duplicated.
  2. Checking for Business Closure:
    Scenario: Some businesses may close or relocate, requiring their status to be updated.
    Solution: Query the place_id to confirm whether the place still exists or has changed its status, and update your records accordingly.
  3. Enriching Data with New Fields:
    Scenario: New fields, such as user reviews or photos, become available.
    Solution: Use the place_id to fetch the latest data for an existing entry and enrich your database without introducing errors.
  4. Regular Database Maintenance:
    Scenario: Periodic checks are performed to ensure all records are up to date.
    Solution: Use the place_id to fetch updated details for each entry and maintain consistency.
  5. Resolving Duplicate Entries:
    Scenario: Duplicate entries arise due to multiple business_id values for the same place.
    Solution: Use the place_id to identify and merge duplicate records.

Recommendations

Always prioritize place_id when building or updating your database. It ensures consistency and reduces the likelihood of errors caused by changing identifiers. If using business_id, consider implementing periodic checks to handle potential changes or discrepancies. Implement robust error handling to address cases where identifiers may be missing or inconsistent in the source data.

By relying on place_id and following these best practices, you can build a robust and reliable database that remains accurate over time.