This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When matching facilities, look for exact matches prior to entering the dedupe process. Exact matches (for name, address, and country) can be automatically matched, and don't need to enter the dedupe process.
- Loading branch information
Showing
6 changed files
with
293 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/django/api/migrations/0075_add_fli_clean_name_and_address.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Generated by Django 2.2.24 on 2021-12-27 19:40 | ||
|
||
from django.db import migrations, models | ||
from api.matching import clean | ||
|
||
|
||
def populate_cleaned_fields(apps, schema_editor): | ||
FacilityListItem = apps.get_model('api', 'FacilityListItem') | ||
for list_item in FacilityListItem.objects.all(): | ||
list_item.clean_name = clean(list_item.name) | ||
list_item.clean_address = clean(list_item.address) | ||
list_item.save() | ||
|
||
|
||
def do_nothing_on_reverse(apps, schema_editor): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0074_embedconfig_prefer_contributor_name'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='facilitylistitem', | ||
name='clean_address', | ||
field=models.CharField(default='', help_text='The cleaned address of the facility.', max_length=200), | ||
), | ||
migrations.AddField( | ||
model_name='facilitylistitem', | ||
name='clean_name', | ||
field=models.CharField(default='', help_text='The cleaned name of the facility.', max_length=200), | ||
), | ||
migrations.AddIndex( | ||
model_name='facilitylistitem', | ||
index=models.Index(fields=['country_code', 'clean_name', 'clean_address'], name='api_fli_match_fields_idx'), | ||
), | ||
migrations.RunPython(populate_cleaned_fields, do_nothing_on_reverse) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.