-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UBID relation to state #4074
Conversation
seed/migrations/0197_ubidmodel.py
Outdated
@@ -0,0 +1,49 @@ | |||
# Generated by Django 3.2.19 on 2023-05-11 18:49 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration could be moved into 0196
|
||
operations = [ | ||
|
||
migrations.RunSQL( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into a few errors attempting to import, read, and execute an entire SQL file. I'd like to refactor this to leverage imports, but I didn't want to let it become a blocker.
# Conflicts: # locale/en_US/LC_MESSAGES/django.mo # locale/en_US/LC_MESSAGES/django.po # locale/fr_CA/LC_MESSAGES/django.mo # locale/fr_CA/LC_MESSAGES/django.po # seed/static/seed/locales/en_US.json # seed/static/seed/locales/fr_CA.json
39089d8
to
8d666c4
Compare
@perryr16 I fixed TONS of issues in this PR:
Remaining Issues & Questions
|
* rename taxlot ulid to ubid * precommit * rename ULID to UBID and remove duplicates * add UbidModel class and CRUD tests * update default mapping * remove ulid argument from called functions * use signal to gerneate ubidmodels * signals creating ubids * precommit * one giant sql migration * base test * refactor * import jaccard index from ubid utils * pre-commit * simplifty test * formatting * comparing ubids through jaccard ui * add new endpoint for ubid by property * base for a ubid upsert modal * upsert modal create and delete functional * override create to prevent multiple preferred * frontend crud functional * cleanup * alter state ubid post_save and pre_delete * validate ubid before comparing * refactor preferred toggle * pre-commit * refresh data post save for test * debugging logs * merge ubids on import and merge action * improve ubid update and help text * property merge functional * define org setting ubid_threshold * use org setting ubid_threshold to determine matching ubids * refactor compare ubids to take 2 ubids instead of 2 views * add ubid modal to inv detail and update org settings for ubid * allow comparison of 0-2 properties * remove tooltip * bug fix for setting preferred * read modal functional, edit modal pops up * list or upsert ubid via 2 modals functional * inv det ubid upsert modal refactor * reuse ubid admin partial for inventory list, detial, and own nav * pre-commit * remove ubused controller * allow property to have missing ubid * backfill ubid_thresholds to avoid non-null constraints * allow null ubid_threshold, treat as exact match * precommit * troubleshooting ol map views * validate ubid before creating * rename ubid modal to ubid decode modal * decode ubid on preferred creation or preferred update * precommit * rename ubid upsert to ubid admin * validate ubid before updating * precommit * comment cleanup * add in translations for ubid work * using bounding box over building point for map starter * decode following state update * option 1: map with controls * option 2: map without controls * change create ubid button location * styles * controller cleanup * precommit * remove unnecessary layer causing console error * map working with centroid and bb * remove inventory service call * remove records and use item_state * return if no preferred ubid * init function * precommit * update init condition * controller cleanup * comment for future dev * taxlot bug * decode on merge * reverse old states before identifying preferred ubid * compare taxlot ubid auto populate * refactor to enable multiple comparisons in single session * adjust width of compare ubid edit fields * adjust width of compare ubid edit fields * merge taxlot ubids * comments * move attribution to about page and use 2d map with better resolution * translations * translate bug fix * formatting * bug fix if imported property ubid is missing * key error fix * typo * Reorder migrations, include original sql scripts, update translations * Added UBID threshold constraint * Major UBID improvements, hugely simplified UBID comparison dialog * Minor fixes * Rehash * Final huge round of bug fixes * Update tests --------- Co-authored-by: Alex Swindler <Alex.Swindler@nrel.gov>
@perryr16 -- I might need some help in terms of documenting this feature. But to start, when you are in the Property Detail view and you click on the UBIDs link, there is a Create UBID button. It looks like you already have to know the UBID for the property, right? SEED isn't actually generating the UBIDs, is it? And then you can enter multiple UBIDs and then I guess SEED determines which is the "preferred" UBID? |
@RDmitchell Yes, that When you're on that UBID tab you can edit each one individually and select one as preferred (changing the preferred UBID automatically unsets a previously-preferred UBID and updates the |
Any background context you want to provide?
The PropertyState (and TaxLotState) both have a
ubid
field that aligns with a canonical column. Per some new guidelines States can have multiple ubids. To accommodate this a new modelUbidModel
has been created with a many-to-one relationship with PropertyState and TaxlotState. Note that the name of the new model could not beubid
to prevent a naming conflict with the existing field.A UbidModel will have the following fields:
PNNL has developed a number of sql functions that can be migrated into a postgres db. Reference. Some of these functions allow a user to calculate the overlap of 2 unique UBID's. This is refered to as the Jaccard Index and the functions returns a value from 0 to 1 representing the match quality.
![image (3)](https://private-user-images.githubusercontent.com/58446472/238698492-232bd424-9fef-4fec-a5af-827d768cbe57.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzMjEzNDAsIm5iZiI6MTcxODMyMTA0MCwicGF0aCI6Ii81ODQ0NjQ3Mi8yMzg2OTg0OTItMjMyYmQ0MjQtOWZlZi00ZmVjLWE1YWYtODI3ZDc2OGNiZTU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjEzVDIzMjQwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUxNTM5YTgxYTNiZDBiYTc0ZmU2ZWJjODQzZGU0NTU1ODM4OWViNDVlNzgyMGVmNmI3OWQyNWFmZWI5MDA3ZGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AE3eBO2w-_TiNQ5HvZ5LKnvAPP2ZxlRT40J99el5cUE)
Now that UBIDs can be compared via the jaccard index, the matching and merging processes must be updated to use a threshold value instead of an exact match.
What's this PR do?
UBID_CodeArea_Jaccard
. This function has a number of dependent functions required to run. These dependant functions are:UBID_Decode
,UBID_Parse
,UBID_CodeArea
,UBID_ValidateLatitude
,UBID_ValidateLongitude
,pluscode_isfull
,pluscode_isvalid
,pluscode_isshort
,pluscode_decode
,pluscode_codearea
How should this be manually tested?
Run tests, test for functionality.
Possible testing procedure:
What are the relevant tickets?
#3957
#4051
#4069
#4041
#4064
Screenshots (if appropriate)
Should this page include a graphic illustrating what a jaccard match looks like (as seen in PR background)?