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
@task | |
def grep_for_classes(): | |
""" | |
cheap and dirty fabric grep for all sass files that have classes that aren't used and prints them out, | |
disclaimers: | |
only does classes not other ides | |
only prints out unused classes doesn't delete them | |
I haven't found anywhere it breaks but I'm not going to guarentee it | |
""" | |
command = "grep -r -P --no-filename --only-matching --include *.scss '[\s\n]\.[a-zA-Z][0-9a-zA-Z\-]*' *" |
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
import csv | |
from datetime import datetime | |
fields = [] | |
primary_key = "" | |
csv_file_1 = "some_file_name.csv" | |
csv_file_2 = "some_file_name.csv" | |
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
import reversion | |
import json | |
import datetime | |
from django.db import models | |
from opal import models as opal_models | |
from elcid import models as elcid_models | |
COMMIT = True | |
opat_team = opal_models.Team.objects.get(name="opat") |
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
import csv | |
import pprint | |
from opal import models as opal_models | |
LOOKUPS = [{'': '', | |
'CHANGE TO': 'Care of the Elderly', | |
'episode_id': '5386', | |
'opat_referral_team': 'Acute Geriatrics'}, | |
{'': '', | |
'CHANGE TO': 'General and Acute Medicine', |
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
from collections import defaultdict | |
from opal.models import Symptom, Synonym, Tagging, Team | |
from opal.core.lookuplists import LookupList | |
from opal.core.subrecords import subrecords | |
from elcid.models import PresentingComplaint | |
from walkin.models import Symptom as WalkinSymptom | |
from django.contrib.contenttypes.models import ContentType | |
from django.db import transaction | |
from opal.utils import _itersubclasses |
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
from opal.models import Tagging, Team | |
from django.db import transaction | |
COMMIT = False | |
def spread_by_time(episodes): | |
result = defaultdict(int) | |
for i in episodes: |
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
import datetime | |
from opal.core import patient_lists | |
from opal.models import Episode | |
def get_episodes(): | |
subtags = [ | |
getattr(i, "subtag", None) or getattr(i, "tag", None) for i in patient_lists.TaggedPatientList.list() | |
] | |
fix_release = datetime.datetime(2016, 11, 11) |
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
from opal.models import Tagging, Episode | |
from django.db.models import Count | |
dupes = Tagging.objects.values('value', 'episode', 'user').annotate(Count('id')).order_by().filter(id__count__gt=1) | |
# handle non mine | |
for dupe in dupes: | |
episode = Episode.objects.get(id=dupe["episode"]) | |
print "episode {}".format(episode) | |
tags = episode.tagging_set.filter(value=dupe["value"], user=dupe["user"]) |
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
serialise_lab_tests -> 0.53s | |
refresh_gloss -> 38.4s | |
bulk_create_from_gloss -> 32s | |
gloss_query -> 6s | |
example load times below of a patient list below | |
observations take 0.0009s | |
results take less than 1s depending on the amount of observations |
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
2017-06-28 08:06:39,0 | |
2017-06-28 13:16:39,0 | |
2017-06-28 05:51:39,113 | |
2017-06-28 12:41:39,874 | |
2017-06-28 13:41:39,1077 | |
2017-06-28 08:41:39,172 | |
2017-06-28 12:26:39,0 | |
2017-06-27 20:56:39,0 | |
2017-06-27 15:21:39,393 | |
2017-06-28 10:31:39,562 |