ebmdatalab / openprescribing

A Django app providing a REST API and dashboards for the HSCIC's GP prescribing data
https://openprescribing.net
MIT License
97 stars 26 forks source link

Start creating an alpha for "download XML to find patients for this measure in your EMIS/SystmOne" #2399

Open Bengoldacre opened 4 years ago

sebbacon commented 4 years ago

Sounds like the first step is to make a version of our measure definition inspector that presents every measure in a tabular format with last updated dates for each definition.

This can then be consumed by third parties wishing to synchronise with our definitions.

Let Dustyn know (via Seb/Brian) when we've done this.

brianmackenna commented 4 years ago

@inglesp has quickly run of two measures to inform thinking, one "easy" and "hard". We may just want to dump the dm+d results to people with the EHRs in the first instance but some thoughts on the following

Lidocaine Measure gives the following dm+d results

376491004 34178211000001102 11052611000001103 11052811000001104 10570111000001104 34178311000001105 11053411000001105 11052711000001107

Total Oral Morphine Equivalence gives 3776 dm+d results. Comments as above but further thoughts

inglesp commented 4 years ago

Here you go: measure_numerator_snomed_codes.zip

code ``` import csv from dmd.models import VMP, AMP, VMPP, AMPP from frontend.models import Measure for m in Measure.objects.all(): print(m.id) with open("/tmp/measure_numerator_snomed_codes/{}.csv".format(m.id), "w") as f: writer = csv.writer(f) for cls in [VMP, AMP, VMPP, AMPP]: for obj in cls.objects.filter(bnf_code__in=m.numerator_bnf_codes).order_by("id"): _ = writer.writerow([obj.id, cls.__name__.lower()]) ```
brianmackenna commented 4 years ago

Reviewing the measures we could implement the following structure

Measures where above will not apply

Other fields In EMIS (I'm sure SystmOne is similar) when you run a rule based search you have the option of returning other pertinent information. For example Antibiotic stewardship: three-day courses for uncomplicated UTIs you may return the patient unique identifier, their name, the drug that triggered the rule but also the gender of the patient, any other antibioptics they have had etc. I propose we do not add these fields at present until further discussion with people who implement directly in SystmOne, EMIS etc

inglesp commented 4 years ago

@brianmackenna, you're going to work out what measure metadata we want to send to the vendors, then I'll dump this and add to the zip file.

brianmackenna commented 4 years ago

Following review of the measure definition here are fields from the metadata that I think should be included and some comments:

id / analyse_url : Not specifically this field but we should think about how a url could be generated in the search report so people can go straight to relevant page on OpenPrescribing. SystmOne have automated via their toolbar to connect to practice dashboards. name description why_it_matters tags : This could be used to organise an OpenPrescribing folder of searches much the same way measures can be prirotised on dahboard for certain clinical areas/topics. (num_or_denom)_type : I think this will be useful but not 100% sure how yet. For example it could be used to automate cdompleting the rest of the logic in the search. When it is bnf_items the search is straightforward search of VMPs etc and should be default. If the type is bnf_quantity the more logic in the searches would require quantity to be added (see comment above about 7 day Rx)

Not in the wiki of measure definition but we also need to include date_reviewed

inglesp commented 4 years ago

Here you go:

measure_defs.zip

code ``` import json from collections import OrderedDict from frontend.models import Measure keys = ['id', 'name', 'description', 'why_it_matters', 'tags', 'numerator_type', 'denominator_type'] for m in Measure.objects.all(): record = OrderedDict((k, getattr(m, k)) for k in keys) with open("measure_definitions/{}.json".format(m.id)) as f: record["date_reviewed"] = json.load(f).get("date_reviewed") with open("/tmp/measure_defs/{}.json".format(m.id), "w") as f: json.dump(record, f, indent=2) ```
inglesp commented 4 years ago

Removing the top-three label because we're waiting for a response from vendors.