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 django.utils import timezone | |
from opal.models import Patient, Episode | |
from opal.core.serialization import _temporal_thing_to_string | |
from plugins.imaging.models import Imaging | |
from plugins.labtests.models import Observation | |
from plugins.covid.episode_categories import CovidEpisode | |
from plugins.covid.models import CovidFollowUpCall | |
from plugins.covid.lab import COVID_19_TESTS | |
import datetime |
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 django.db.models import Count | |
from opal.models import Episode, Patient | |
from odonto.episode_categories import * | |
def get_dates(episode): | |
dates = [ | |
# it does not seem to be the case that this causes conflicts | |
# episode.orthodonticassessment_set.all()[0].date_of_referral, | |
# episode.orthodonticassessment_set.all()[0].date_of_assessment, | |
# episode.orthodonticassessment_set.all()[0].date_of_appliance_fitted, | |
# episode.orthodontictreatment_set.all()[0].date_of_completion, |
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 Episode | |
from opal.core.subrecords import episode_subrecords | |
from django.db import transaction | |
@transaction.atomic | |
def clone_episode(old): | |
new = Episode( | |
patient=old.patient, | |
active=old.active, | |
start=old.start, |
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
FIELDS = [ | |
"treatment_category", | |
"urgent_treatment", | |
"regulation_11_replacement_appliance", | |
"prescription_only", | |
"denture_repairs", | |
"bridge_repairs", | |
"arrest_of_bleeding", | |
"removal_of_sutures", | |
] |
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 django.core.management.base import BaseCommand | |
from odonto.episode_categories import FP17Episode, FP17OEpisode | |
# FP17O calculations | |
def get_date(episode): | |
ass_date = episode.orthodonticassessment_set.get().date_of_assessment | |
if ass_date: | |
return ass_date | |
return episode.category.get_sign_off_date() |
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 django.core.management.base import BaseCommand | |
from odonto.episode_categories import FP17Episode, FP17OEpisode | |
# FP17O calculations | |
def get_date(episode): | |
ass_date = episode.orthodonticassessment.date_of_assessment | |
if ass_date: | |
return ass_date | |
return episode.category.get_sign_off_date() |
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
Sunday 29 September 19 | |
Blackhawks 1 | |
Thames Valley Kings 1 | |
13:20 | |
Woking College | |
Sunday 6 October 19 | |
Blackhawks 1 | |
Jaguars 1 | |
13:20 |
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
""" | |
Expects a file that looks like | |
Saturday 7 December 19 | |
Swansea Storm | |
Blackhawks 2 | |
14:00 | |
The LC Swansea, Oystermouth Road | |
Swansea, SA1 3ST |
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 xmltodict | |
import datetime | |
from odonto.odonto_submissions import models | |
def translate(response): | |
response_text = response.content.strip()[2:][:-1] | |
response_text = response_text.replace( | |
"\\n", "").replace("\\t", "").replace("\\r", "" | |
) |
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 django.shortcuts import render | |
# urls.py | |
pathway_urls = [] | |
for pathway in Pathway.list(): | |
pathway_urls += [ | |
url(pathway.get_template_url(), PathwayTemplateView], | |
] | |
# pathway |