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 django.utils import timezone | |
from django.db import transaction | |
from intrahospital_api.apis.prod_api import ProdApi as ProdAPI | |
from elcid.models import Demographics | |
from plugins.admissions import loader | |
import csv, os | |
from plugins.admissions.models import TransferHistory | |
from elcid.episode_categories import InfectionService | |
from intrahospital_api.loader import create_rfh_patient_from_hospital_number |
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 datetime | |
from opal.core import subrecords | |
from django.db.models import Count, Max | |
from opal.models import Patient | |
def subrecords_to_extract(subrecords): | |
result = [] | |
for subrecord in subrecords: |
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 pyquery import PyQuery as pq | |
import json | |
import io | |
FILE_NAME = "IPC_GT_5_Years.htm" | |
def process(): | |
with io.open("IPC_GT_5_Years.htm", mode="r", encoding="utf-8", errors='ignore') as f: | |
contents = f.read() |
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 odonto.episode_categories import FP17OEpisode, FP17Episode | |
SEND_ALL_AFTER_DATE = datetime.date(2020, 4, 1) | |
def get_rejections(): | |
rejected_fp17s = FP17Episode.get_rejected_episodes() | |
rejected_fp17s = [ | |
i for i in rejected_fp17s if i.category.get_sign_off_date() > SEND_ALL_AFTER_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
import datetime | |
from plugins.labtests.models import LabTest | |
from opal.models import Patient | |
from elcid.utils import timing | |
from intrahospital_api.apis.prod_api import ProdApi as ProdAPI | |
from django.utils import timezone | |
from plugins.appointments.models import Appointment | |
from plugins.tb import episode_categories, constants | |
from plugins.tb.models import PatientConsultation |
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 | |
import time | |
from django.utils import timezone | |
from opal.models import Episode | |
from odonto import episode_categories | |
from odonto.odonto_submissions.models import Submission | |
def delete_and_resend(): | |
episodes = Episode.objects.filter( |
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
# The problem is that... | |
# 1. We cannot search models such as Lab tests or appointments | |
# 2. We cannot remove models such as Episode that are in opal models | |
# | |
# This solution mostly solves 1, however I think we should implement a discoverable remove method | |
# and then the solution includes the other. | |
# | |
# This method moves the query logic onto a search rule class, patient summary generation etc would be | |
# elsewhere by the query backend. | |
# |
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
class Fp17ClinicalDataSetSerializer(TreatmentSerializer): | |
model = models.Fp17ClinicalDataSet | |
TREATMENT_MAPPINGS = OrderedDict( | |
[ | |
("examination", t.EXAMINATION), | |
("scale_and_polish", t.SCALE_AND_POLISH), | |
("fluoride_varnish", t.FLUORIDE_VARNISH), | |
("fissure_sealants", t.FISSURE_SEALANTS), | |
("radiographs_taken", t.RADIOGRAPHS), |
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
class RBHLMetaTestFields(object): | |
method = CharField() | |
exposures = CharField() | |
antigen_type = CharField() | |
# what the blood book is using as a hospital number | |
reference_number = CharField() |
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 time | |
from django.test.client import RequestFactory | |
from rest_framework.test import force_authenticate | |
from django.contrib.auth.models import User | |
from rest_framework.reverse import reverse | |
from opal.models import Patient | |
from elcid.api import InfectionServiceTestSummaryApi, LabTestResultsView | |
from plugins.covid.api import CovidServiceTestSummaryAPI | |