[e988c2]: / tests / lib / emis_schema.py

Download this file

78 lines (59 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# This file is manually created, unlike tpp_schema.py
from sqlalchemy import types as t
from sqlalchemy.orm import DeclarativeBase, mapped_column
class Base(DeclarativeBase):
"Common base class to signal that models below belong to the same database"
class ImmunisationAllOrgsV2(Base):
__tablename__ = "immunisation_all_orgs_v2"
_pk = mapped_column(t.Integer, primary_key=True)
registration_id = mapped_column(t.VARCHAR(128))
snomed_concept_id = mapped_column(t.BigInteger)
effective_date = mapped_column(t.DateTime)
class PatientAllOrgsV2(Base):
__tablename__ = "patient_all_orgs_v2"
_pk = mapped_column(t.Integer, primary_key=True)
registration_id = mapped_column(t.VARCHAR(128))
nhs_no = mapped_column(t.VARCHAR)
gender = mapped_column(t.Integer)
date_of_birth = mapped_column(t.Date)
date_of_death = mapped_column(t.Date)
hashed_organisation = mapped_column(t.VARCHAR)
registered_date = mapped_column(t.Date)
registration_end_date = mapped_column(t.Date)
rural_urban = mapped_column(t.Integer)
imd_rank = mapped_column(t.BigInteger)
class ObservationAllOrgsV2(Base):
__tablename__ = "observation_all_orgs_v2"
_pk = mapped_column(t.Integer, primary_key=True)
registration_id = mapped_column(t.VARCHAR(128))
snomed_concept_id = mapped_column(t.Integer)
effective_date = mapped_column(t.DateTime)
value_pq_1 = mapped_column(t.DECIMAL(20, 2))
class MedicationAllOrgsV2(Base):
__tablename__ = "medication_all_orgs_v2"
_pk = mapped_column(t.Integer, primary_key=True)
registration_id = mapped_column(t.VARCHAR(128))
snomed_concept_id = mapped_column(t.BigInteger)
effective_date = mapped_column(t.DateTime)
class OnsView(Base):
__tablename__ = "ons_view"
_pk = mapped_column(t.Integer, primary_key=True)
pseudonhsnumber = mapped_column(t.VARCHAR)
reg_stat_dod = mapped_column(t.VARCHAR)
icd10u = mapped_column(t.VARCHAR)
icd10001 = mapped_column(t.VARCHAR)
icd10002 = mapped_column(t.VARCHAR)
icd10003 = mapped_column(t.VARCHAR)
icd10004 = mapped_column(t.VARCHAR)
icd10005 = mapped_column(t.VARCHAR)
icd10006 = mapped_column(t.VARCHAR)
icd10007 = mapped_column(t.VARCHAR)
icd10008 = mapped_column(t.VARCHAR)
icd10009 = mapped_column(t.VARCHAR)
icd10010 = mapped_column(t.VARCHAR)
icd10011 = mapped_column(t.VARCHAR)
icd10012 = mapped_column(t.VARCHAR)
icd10013 = mapped_column(t.VARCHAR)
icd10014 = mapped_column(t.VARCHAR)
icd10015 = mapped_column(t.VARCHAR)
upload_date = mapped_column(t.VARCHAR)