This file contains hidden or 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 intrahospital_api import merge_patient | |
from opal import models as opal_models | |
from django.db import transaction | |
from django.db.models import Count | |
import reversion | |
def update_singleton(subrecord_cls, old_parent, new_parent): | |
if new_parent.__class__ == opal_models.Episode: |
This file contains hidden or 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 | |
""" | |
A script to look at timings for loads | |
""" | |
import time | |
from django.utils import timezone | |
import datetime | |
from django.conf import settings | |
import pytds |
This file contains hidden or 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
DELETE FROM django_migrations WHERE app='lab'; | |
DELETE FROM auth_permission WHERE content_type_id in (SELECT id FROM django_content_type WHERE app_label='lab'); | |
DELETE FROM django_admin_log WHERE content_type_id in (SELECT id FROM django_content_type WHERE app_label = 'lab'); | |
DELETE FROM reversion_version WHERE content_type_id in ( | |
SELECT id FROM django_content_type WHERE app_label = 'lab' | |
); | |
DELETE FROM django_content_type WHERE app_label='lab'; | |
DROP TABLE lab_labtest CASCADE; | |
DROP TABLE lab_labtest_resistant_antibiotics CASCADE; |
This file contains hidden or 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 plugins.covid import calculator | |
from opal.models import Patient | |
from elcid.models import Demographics | |
from intrahospital_api import loader | |
from opal.core import subrecords | |
from django.db import transaction | |
from django.core.management import call_command | |
from plugins.dischargesummary import loader as dicharge_summary_loader |
This file contains hidden or 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 Patient | |
from elcid.models import Demographics | |
from intrahospital_api import loader | |
from opal.core import subrecords | |
from django.db import transaction | |
@transaction.atomic | |
def update_patients_with_leading_zero_with_no_counter_part(): | |
# patients with leading 0s but no duplicate, remove the 0, re-sync all upstream |
This file contains hidden or 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 import transaction | |
from opal.core import subrecords | |
from intrahospital_api import loader | |
from elcid.models import Demographics | |
from opal.models import Patient | |
from plugins.labtests.models import LabTest | |
subrecordsToIgnore = set([ | |
'InitialPatientLoad', |
This file contains hidden or 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 django.db.models import Count | |
from opal.core import subrecords | |
from opal.models import Patient | |
from elcid.models import Demographics | |
import logging | |
logger = logging.getLogger('intrahospital_api') |
This file contains hidden or 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.db import transaction | |
from collections import defaultdict | |
from django.utils import timezone | |
from elcid.utils import timing | |
from elcid import models | |
from django.conf import settings | |
from django.db.models import DateTimeField, DateField | |
from opal.core.fields import ForeignKeyOrFreeText | |
import csv |
This file contains hidden or 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
""" | |
Management command that sends a sanity check about the transfer histories | |
""" | |
import datetime | |
from django.conf import settings | |
from django.db.models import Max | |
from django.core.management import BaseCommand | |
from django.utils import timezone | |
from intrahospital_api.apis.prod_api import ProdApi as ProdAPI | |
from plugins.admissions.models import TransferHistory |
This file contains hidden or 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 collections import defaultdict | |
from elcid.models import Demographics | |
from django.db import transaction | |
from django.db.models import DateTimeField, Count, BooleanField, DateField | |
from django.utils import timezone | |
from plugins.admissions.models import TransferHistory | |
from django.conf import settings | |
from django.contrib.auth.models import User | |
from plugins.ipc.episode_categories import IPCEpisode |
NewerOlder