Skip to content

Instantly share code, notes, and snippets.

@GSmes
Last active July 1, 2019 18:55
Show Gist options
  • Save GSmes/e0f13efd0b4b2de36c459110b9b55d6b to your computer and use it in GitHub Desktop.
Save GSmes/e0f13efd0b4b2de36c459110b9b55d6b to your computer and use it in GitHub Desktop.

1. Find a RealtyTrac home

  • RT homes will have a home datum with source, realtytrac
  • The RT home datum must have an rt_property_id value AND a "success" in the datasources column (e.g., {"realtytrac": {"date": "2019-06-28T17:44:05.262Z", "status": "success"}})
  • Things to note:
    • Does the home also have a SiteX home datum? If so, simply delete the SiteX home datum (as well as any SiteX AVMs and Loans)
    • Does the home have a CMA? If so, make note of the system_generated, updated, amount, and diff values, as these will determine what happens to the CMA post-migration (see step 3).

2. Migrate the RealtyTrac home to SiteX

  • Open rails console
  • Plug the home ID into the following command and run:
    MigrateRealtyTracHomes.new.migrate_home(home_id)

3. Check the home post-migration

  • Assuming SiteX was able to find a match, the home should now have at least a SiteX home datum. If SiteX could find any, the home should also have a SiteX AVM and SiteX loans.
  • The home should also have a HomeAnswer with question: 'realtyTracMigration' and response: 'UNANSWERED'
  • If the home had a CMA before-hand:
    • If the CMA was from more than 1 year ago, it should've been deleted.
    • If the CMA was system-generated (an auto-CMA), it should've been deleted.
    • Otherwise, the CMA diff should be updated to be the CMA amount minus the SiteX AVM amount.

How to make a home into a RT home:

  • Either in Rails console or in Postico, duplicate a SiteX home datum and change the following values:
    • source
      • change from sitex to realtytrac
    • datasources
      • change from {"sitex": {"date": "2019-06-28T17:44:05.262Z", "status": "success"}} to {"realtytrac": {"date": "2019-06-28T17:44:05.262Z", "status": "success"}} (the date doesn't matter)
    • rt_property_id
      • using the RealtyTrac API (creds in 1Password), find the @PropertyParcelID_ext value by searching by address. Copy that value into the rt_property_id column.
  • Save that home datum
  • Open Loopback console
  • Plug the home ID into the following command and run:
    • Home.updateExternalData(home_id);
@n00ge
Copy link

n00ge commented Jul 1, 2019

A couple helpful lines for rails c

h = Home.find_by(_id: '58c336565ec89c00047f2edf')

# Find the agent CMAs
h.avms.agent_cmas_only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment