Skip to content

Commit

Permalink
update import mp engagement to not use external_id
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Feb 19, 2024
1 parent b5f2292 commit ae93110
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hub/management/commands/import_mp_engagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas as pd
from tqdm import tqdm

from hub.models import DataSet, DataType, Person, PersonData
from hub.models import DataSet, DataType, PersonData


class Command(BaseCommand):
Expand All @@ -19,8 +19,9 @@ def handle(self, quiet=False, *args, **options):

def get_person_from_id(self, id):
try:
return Person.objects.get(external_id=id)
except Person.DoesNotExist:
data = PersonData.objects.get(data_type__name="parlid", data=id)
return data.person
except PersonData.DoesNotExist:
return None

def get_df(self):
Expand Down

0 comments on commit ae93110

Please sign in to comment.