Skip to content

Commit

Permalink
Matched CSV filenames to 2022 Q1 data triage
Browse files Browse the repository at this point in the history
*revised* 1012_sites_all.csv => *220116_sites_all.csv*
0911mc_siterecs_samhsa_ftloc.csv => *2021_siterecs_samhsa_ftloc.csv*
0911nc_siterecs_samhsa_otp.csv => *2021_siterecs_samhsa_otp.csv*
1012_siterecs_dbhids_tad.csv => *2021_siterecs_dbhids_tad.csv*
0911nc_ba_dbhids_tad.csv => *2021_ba_dbhids_tad.csv* [already just UTF-8]
0911nc_siterecs_hfp_fqhc.csv => *2021_siterecs_hfp_fqhc.csv*
*revised* 0911mc_siterecs_other_srcs.csv => *220116_siterecs_other_srcs.csv*
0911nc_sitecodes_samhsa_ftloc.csv => *2021_sitecodes_samhsa_ftloc.csv*
  • Loading branch information
jkdru authored Jan 16, 2022
1 parent 658a658 commit f220bbe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions database/bupehandler/management/commands/loadsitesdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Command(BaseCommand):

def handle(self, *args, **options):

for row in DictReader(open('./1012_sites_all.csv', encoding='utf-8-sig')):
for row in DictReader(open('./220116_sites_all.csv', encoding='utf-8-sig')):
sites = Sites_all()
sites.oid = 'S' + str(row['oid']).zfill(5)
# sites.id_dbhids_tad.sites_all_id = 'S' + str(row['oid']).zfill(5)
Expand Down Expand Up @@ -268,7 +268,7 @@ def handle(self, *args, **options):
sites.data_review = row['data_review']

## Siterecs_samhsa_ftloc with r2 & ftl
for r2 in DictReader(open('./0911mc_siterecs_samhsa_ftloc.csv', encoding='utf-8-sig')):
for r2 in DictReader(open('./2021_siterecs_samhsa_ftloc.csv', encoding='utf-8-sig')):
if r2['site_id'] == 'S' + str(row['oid']).zfill(5):
ftl = Siterecs_samhsa_ftloc()
ftl.oid = r2['oid']
Expand Down Expand Up @@ -770,7 +770,7 @@ def handle(self, *args, **options):
ftl.save()

## Siterecs_samhsa_otp with r3 & otp
for r3 in DictReader(open('./0911nc_siterecs_samhsa_otp.csv', encoding='utf-8-sig')):
for r3 in DictReader(open('./2021_siterecs_samhsa_otp.csv', encoding='utf-8-sig')):
if r3['site_id'] == 'S' + str(row['oid']).zfill(5):
otp = Siterecs_samhsa_otp()
otp.oid = r3['oid']
Expand Down Expand Up @@ -809,7 +809,7 @@ def handle(self, *args, **options):
otp.save()

## Siterecs_dbhids_tad with r4 & tad
for r4 in DictReader(open('./1012_siterecs_dbhids_tad.csv', encoding='utf-8-sig')):
for r4 in DictReader(open('./2021_siterecs_dbhids_tad.csv', encoding='utf-8-sig')):
if r4['site_id'] == 'S' + str(row['oid']).zfill(5):
tad = Siterecs_dbhids_tad()
tad.oid = r4['oid']
Expand Down Expand Up @@ -914,7 +914,7 @@ def handle(self, *args, **options):
tad.save()

## Ba_dbhids_tad with r5 & ba
for r5 in DictReader(open('./0911nc_ba_dbhids_tad.csv', encoding='utf-8-sig')):
for r5 in DictReader(open('./2021_ba_dbhids_tad.csv', encoding='utf-8-sig')):
if r5['site_id'] == 'S' + str(row['oid']).zfill(5):
ba = Ba_dbhids_tad()
ba.oid = r5['oid']
Expand Down Expand Up @@ -951,7 +951,7 @@ def handle(self, *args, **options):
ba.save()

## Siterecs_hfp_fqhc with r6 & hfp
for r6 in DictReader(open('./0911nc_siterecs_hfp_fqhc.csv', encoding='utf-8-sig')):
for r6 in DictReader(open('./2021_siterecs_hfp_fqhc.csv', encoding='utf-8-sig')):
if r6['site_id'] == 'S' + str(row['oid']).zfill(5):
hfp = Siterecs_hfp_fqhc()
hfp.oid = r6['oid']
Expand Down Expand Up @@ -998,7 +998,7 @@ def handle(self, *args, **options):
hfp.save()

## Siterecs_other_srcs with r7 & oth
for r7 in DictReader(open('./0911mc_siterecs_other_srcs.csv', encoding='utf-8-sig')):
for r7 in DictReader(open('./220116_siterecs_other_srcs.csv', encoding='utf-8-sig')):
if r7['site_id'] == 'S' + str(row['oid']).zfill(5):
oth = Siterecs_other_srcs()
oth.oid = r7['oid']
Expand Down Expand Up @@ -1216,7 +1216,7 @@ def handle(self, *args, **options):


#DIFFERENT ENTITY: Sitecodes_samhsa_ftloc with sc & codes
for sc in DictReader(open('./0911nc_sitecodes_samhsa_ftloc.csv', encoding='utf-8-sig')):
for sc in DictReader(open('./2021_sitecodes_samhsa_ftloc.csv', encoding='utf-8-sig')):
codes = Sitecodes_samhsa_ftloc()
codes.service_code = sc['service_code']
if sc['category_code'] != '':
Expand Down

0 comments on commit f220bbe

Please sign in to comment.