Skip to content

Commit

Permalink
Merge pull request #5119 from bennettoxford/remove-old-practice-data-…
Browse files Browse the repository at this point in the history
…source

Remove old prescribing metadata source
  • Loading branch information
inglesp authored Jan 27, 2025
2 parents 93f4a44 + 87f4e93 commit cd7dff0
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 243 deletions.

This file was deleted.

48 changes: 2 additions & 46 deletions openprescribing/frontend/management/commands/import_practices.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,21 @@


class Command(BaseCommand):
args = ""
help = "Imports practice data either from epraccur.csv, or from HSCIC "
help += "address files, depending on options. "
help = "Imports practice data from epraccur.csv"

def add_arguments(self, parser):
parser.add_argument("--hscic_address")
parser.add_argument("--epraccur")

def handle(self, *args, **options):
self.IS_VERBOSE = False
if options["verbosity"] > 1:
self.IS_VERBOSE = True

if options["epraccur"]:
self.import_practices_from_epraccur(options["epraccur"])
else:
practice_files = []
if options["hscic_address"]:
practice_files = [options["hscic_address"]]
else:
practice_files = glob.glob("./data/raw_data/T*ADDR*")
for f in practice_files:
self.import_practices_from_hscic(f)
self.import_practices_from_epraccur(options["epraccur"])

def parse_date(self, d):
return "-".join([d[:4], d[4:6], d[6:]])

def _strip_dict(self, row):
"""
Strip whitespace from keys and values in dictionary.
"""
for k in row:
if row[k]:
row[k] = row[k].strip()
row[k.strip()] = row.pop(k)
return row

def import_practices_from_epraccur(self, filename):
entries = csv.reader(open(filename))
count = 0
Expand Down Expand Up @@ -99,25 +77,3 @@ def import_practices_from_epraccur(self, filename):

if self.IS_VERBOSE:
print("%s Practice objects created from epraccur" % count)

def import_practices_from_hscic(self, filename):
if self.IS_VERBOSE:
print("Importing practices from %s" % filename)
count = 0
practices = csv.reader(open(filename))
for row in practices:
row = [i.strip() for i in row]
p, created = Practice.objects.get_or_create(code=row[1])
if created:
p.name = row[2]
p.address1 = row[3]
p.address2 = row[4]
p.address3 = row[5]
p.address4 = row[6]
p.postcode = row[7]
p.save()
if created:
count += 1

if self.IS_VERBOSE:
print("%s Practice objects created from HSCIC" % count)

This file was deleted.

9 changes: 0 additions & 9 deletions openprescribing/pipeline/metadata/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,6 @@
"data_dir": "prescribing_v2",
"core_data": true
},
"prescribing_metadata": {
"title": "GP Practice Prescribing metadata",
"description": "Metadata for joining with prescribing data",
"publisher": "Health & Social Care Information Centre",
"publication_schedule": "end of each month",
"publication_lag": "80 - 100 days",
"index_url": "http://content.digital.nhs.uk/article/2021/Website-Search?q=presentation+level+data&go=Go&area=both",
"core_data": true
},
"qof": {
"title": "The Quality and Outcomes Framework (QOF) is the annual reward and incentive programme for GPs",
"description": "The incentives are based on prevalence of certain conditions, and the data is presented at various output levels, including practice and CCG. It runs across a financial year (i.e. April - March)",
Expand Down
31 changes: 0 additions & 31 deletions openprescribing/pipeline/metadata/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@
"source_id": "pcn_details",
"command": "org_codes --pcn"
},
"fetch_prescribing_metadata_chemicals": {
"type": "auto_fetch",
"source_id": "prescribing_metadata",
"command": "fetch_prescribing_metadata chemicals"
},
"fetch_prescribing_metadata_addresses": {
"type": "auto_fetch",
"source_id": "prescribing_metadata",
"command": "fetch_prescribing_metadata addresses"
},
"fetch_nhs_postcode_file": {
"type": "auto_fetch",
"source_id": "nhs_postcode_file",
Expand Down Expand Up @@ -141,24 +131,6 @@
"import_practice_details"
]
},
"import_hscic_chemicals": {
"type": "import",
"source_id": "prescribing_metadata",
"command": "import_hscic_chemicals --chem_file T*CHEM*.CSV",
"dependencies": [
"fetch_prescribing_metadata_chemicals"
]
},
"import_hscic_practices": {
"type": "import",
"source_id": "prescribing_metadata",
"command": "import_practices --hscic_address T*ADDR*.CSV",
"dependencies": [
"fetch_prescribing_metadata_addresses",
"import_ccg_details",
"import_practice_details"
]
},
"convert_hscic_prescribing": {
"type": "convert",
"source_id": "prescribing",
Expand All @@ -172,7 +144,6 @@
"source_id": "dispensing_practices",
"command": "import_practice_dispensing_status --filename dispensing_practices*.csv",
"dependencies": [
"import_hscic_practices",
"import_practice_details"
]
},
Expand All @@ -182,7 +153,6 @@
"command": "import_list_sizes --filename gp-reg-pat-prac-quin-age.csv",
"dependencies": [
"fetch_patient_list_size",
"import_hscic_practices",
"import_practice_details",
"import_patient_list_weightings"
]
Expand All @@ -201,7 +171,6 @@
"dependencies": [
"convert_hscic_prescribing",
"import_patient_list_size",
"import_hscic_practices",
"import_ccg_details",
"import_practice_details"
]
Expand Down

0 comments on commit cd7dff0

Please sign in to comment.