renalware-core 2.0.78 → 2.0.79

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/renalware/application.js.erb +1 -0
  4. data/app/assets/javascripts/renalware/layout.js +3 -0
  5. data/app/assets/stylesheets/renalware/modules/_patients.scss +2 -1
  6. data/app/controllers/renalware/admin/feeds/files_controller.rb +7 -1
  7. data/app/controllers/renalware/patients/practices_controller.rb +1 -1
  8. data/app/controllers/renalware/patients/primary_care_physician_controller.rb +32 -13
  9. data/app/controllers/renalware/virology/dashboards_controller.rb +1 -4
  10. data/app/controllers/renalware/virology/profiles_controller.rb +10 -5
  11. data/app/documents/renalware/hd/session_document.rb +4 -0
  12. data/app/documents/renalware/patient_document.rb +15 -1
  13. data/app/documents/renalware/renal/profile_document.rb +22 -0
  14. data/app/documents/renalware/virology/profile_document.rb +1 -0
  15. data/app/models/renalware/clinics/remembered_clinic_visit_preferences.rb +1 -1
  16. data/app/models/renalware/feeds/files/practice_memberships/import_job.rb +2 -8
  17. data/app/models/renalware/feeds/files/primary_care_physicians/import_csv.rb +2 -2
  18. data/app/models/renalware/hd/session/closed.rb +2 -0
  19. data/app/models/renalware/patients/last_successful_practice_sync_date_query.rb +28 -0
  20. data/app/models/renalware/patients/practice.rb +0 -2
  21. data/app/models/renalware/patients/practice_search_query.rb +4 -2
  22. data/app/models/renalware/patients/sync_gps_via_file_download_job.rb +52 -0
  23. data/app/models/renalware/patients/sync_ods_job.rb +53 -0
  24. data/app/models/renalware/patients/sync_practices_via_api.rb +157 -0
  25. data/app/models/renalware/system/api_log.rb +29 -0
  26. data/app/presenters/renalware/admissions/consult_summary_part.rb +36 -0
  27. data/app/presenters/renalware/ukrdc/patient_presenter.rb +66 -6
  28. data/app/presenters/renalware/virology/dashboard_presenter.rb +32 -0
  29. data/app/validators/renalware/patients/respiratory_rate_validator.rb +17 -0
  30. data/app/views/renalware/admissions/consults/_summary_part.html.slim +17 -0
  31. data/app/views/renalware/admissions/consults/_table.html.slim +58 -19
  32. data/app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder +43 -3
  33. data/app/views/renalware/api/ukrdc/patients/_medications.xml.builder +23 -3
  34. data/app/views/renalware/api/ukrdc/patients/_social_histories.xml.builder +2 -2
  35. data/app/views/renalware/hd/protocols/_virology.html.slim +2 -0
  36. data/app/views/renalware/hd/sessions/_form.html.slim +4 -0
  37. data/app/views/renalware/pathology/historical_observation_results/index.html.slim +2 -2
  38. data/app/views/renalware/virology/dashboards/_latest_hep_b_antibody_statuses.html.slim +5 -0
  39. data/app/views/renalware/virology/dashboards/show.html.slim +6 -3
  40. data/app/views/renalware/virology/profiles/_summary.html.slim +2 -2
  41. data/app/views/renalware/virology/profiles/edit.html.slim +1 -0
  42. data/config/locales/renalware/hd/session.en.yml +4 -0
  43. data/config/locales/renalware/virology/virology.en.yml +1 -0
  44. data/db/functions/import_practice_memberships_csv_v03.sql +65 -0
  45. data/db/migrate/20190531172829_add_last_change_date_to_patient_practices.rb +26 -0
  46. data/db/migrate/20190602114659_create_system_api_logs.rb +15 -0
  47. data/db/migrate/20190603084428_add_pages_to_system_api_logs.rb +5 -0
  48. data/db/migrate/20190603135247_add_columns_to_patient_primary_care_physicians.rb +8 -0
  49. data/db/migrate/20190603143834_update_import_practice_memberships_csv.rb +13 -0
  50. data/db/migrate/20190603165812_drop_import_practices_csv_function.rb +13 -0
  51. data/db/seeds/default/feeds/import_file_types.rb +0 -8
  52. data/db/seeds/default/renal/prd_descriptions.csv +266 -266
  53. data/lib/document/enum.rb +4 -0
  54. data/lib/renalware/configuration.rb +1 -0
  55. data/lib/renalware/version.rb +1 -1
  56. data/lib/tasks/feeds/files.rake +0 -16
  57. data/lib/tasks/hd.rake +2 -0
  58. data/lib/tasks/ods.rake +10 -0
  59. data/spec/factories/feeds/file.rb +0 -4
  60. data/spec/factories/feeds/file_types.rb +2 -7
  61. data/spec/factories/hd/hd_session_document.rb +2 -0
  62. data/spec/factories/system/api_logs.rb +19 -0
  63. data/spec/support/pathology_spec_helper.rb +12 -8
  64. data/vendor/assets/javascripts/renalware/double_scroll.js +128 -0
  65. metadata +23 -9
  66. data/app/models/renalware/feeds/files/practices/convert_xml_to_csv.rb +0 -153
  67. data/app/models/renalware/feeds/files/practices/country_map.rb +0 -36
  68. data/app/models/renalware/feeds/files/practices/csv_file.rb +0 -25
  69. data/app/models/renalware/feeds/files/practices/csv_organisation.rb +0 -37
  70. data/app/models/renalware/feeds/files/practices/import_csv.rb +0 -32
  71. data/app/models/renalware/feeds/files/practices/import_job.rb +0 -61
  72. data/app/models/renalware/feeds/files/practices/xml_parser.rb +0 -102
@@ -1,23 +1,56 @@
1
+ - compact = local_assigns.fetch(:compact, false)
2
+ - allow_sorting = local_assigns[:query].present?
3
+
1
4
  .admissions-consults-table
2
5
  table
3
6
  thead
4
7
  tr
5
8
  th.col-width-medium.noprint
6
- th.col-width-large
7
- = sort_link(query, :patient, ["patient_family_name", "patient_given_name asc"], "Patient")
9
+ - unless compact
10
+ th.col-width-large
11
+ - if allow_sorting
12
+ = sort_link(query, :patient, ["patient_family_name", "patient_given_name asc"], "Patient")
13
+ - else
14
+ | Patient
8
15
  th.col-width-nhs-no.noprint NHS No.
9
16
  th.col-width-reference-no Hosp Nos.
10
- th.col-width-medium= sort_link(query, :hospital_ward_name, "Ward")
17
+ th.col-width-medium
18
+ - if allow_sorting
19
+ = sort_link(query, :hospital_ward_name, "Ward")
20
+ - else
21
+ | Ward
11
22
  th.col-width-tiny RRT
12
- th.col-width-date.noprint= sort_link(query, :started_on, "Started")
13
- th.col-width-date.noprint= sort_link(query, :ended_on, "Ended")
14
- th.col-width-small.show-for-large-up
15
- = sort_link([:renalware, query], :modality_desc, "Modality")
16
- th.col-width-tiny.show-for-large-up Sex
17
- th.col-width-date.show-for-large-up= sort_link(query, :patient_born_on, "DOB")
18
- th.col-width-tiny.show-for-large-up Age
19
- th.col-width-tiny.noprint= sort_link(query, :aki_risk, "AKI Risk")
20
-
23
+ th.col-width-date.noprint
24
+ - if allow_sorting
25
+ = sort_link(query, :started_on, "Started")
26
+ - else
27
+ | Started
28
+ th.col-width-date.noprint
29
+ - if allow_sorting
30
+ = sort_link(query, :ended_on, "Ended")
31
+ - else
32
+ | Ended
33
+ - unless compact
34
+ th.col-width-small.show-for-large-up
35
+ - if allow_sorting
36
+ = sort_link([:renalware, query], :modality_desc, "Modality")
37
+ - else
38
+ | Modality
39
+ - unless compact
40
+ th.col-width-tiny.show-for-large-up Sex
41
+ - unless compact
42
+ th.col-width-date.show-for-large-up
43
+ - if allow_sorting
44
+ = sort_link(query, :patient_born_on, "DOB")
45
+ - else
46
+ | DOB
47
+ - unless compact
48
+ th.col-width-tiny.show-for-large-up Age
49
+ th.col-width-tiny.noprint
50
+ - if allow_sorting
51
+ = sort_link(query, :aki_risk, "AKI Risk")
52
+ - else
53
+ | AKI Risk
21
54
  tbody
22
55
  - consults.each do |consult|
23
56
  - uid = "consult-#{consult.id}"
@@ -54,22 +87,28 @@
54
87
  = link_to("Toggle",
55
88
  "#consult-quick-preview-#{consult.id}",
56
89
  data: { behaviour: "toggler" })
57
- td= default_patient_link(consult.patient)
90
+ - unless compact
91
+ td= default_patient_link(consult.patient)
58
92
  td.noprint= consult.patient_nhs_number
59
93
  td= consult.patient_hospital_identifiers&.to_s_multiline
60
94
  td= consult.hospital_ward
61
95
  td= yes_no(consult.rrt?)
62
96
  td.noprint= l(consult.started_on)
63
97
  td.noprint= l(consult.ended_on)
64
- td.show-for-large-up.col-width-medium-with-ellipsis= consult.patient_current_modality
65
- td.show-for-large-up= consult.patient_sex
66
- td.show-for-large-up= l(consult.patient.born_on)
67
- td.show-for-large-up= consult.patient_age
98
+ - unless compact
99
+ td.show-for-large-up.col-width-medium-with-ellipsis= consult.patient_current_modality
100
+ - unless compact
101
+ td.show-for-large-up= consult.patient_sex
102
+ - unless compact
103
+ td.show-for-large-up= l(consult.patient.born_on)
104
+ - unless compact
105
+ td.show-for-large-up= consult.patient_age
68
106
  td.noprint= consult.aki_risk&.text
69
107
  /td.show-for-xlarge-up.consult-author.col-width-medium-with-ellipsis(title=consult.created_by)= consult.created_by
70
108
  /td.col-width-medium-with-ellipsis(title=consult.description)= consult.description
71
109
  = content_tag(:tr, id: "consult-quick-preview-#{consult.id}", style: "display: none")
72
- td(colspan=11)
110
+ - colspan = compact ? 8 : 11
111
+ td(colspan=colspan)
73
112
  .quick-preview
74
113
  dl.dl-horizontal
75
114
  dt Author
@@ -78,7 +117,7 @@
78
117
  dd= consult.patient_current_modality
79
118
  dt Description
80
119
  dd= simple_format consult.description
81
- td
120
+
82
121
  / When printing we just show the notes on the second row
83
122
  tr.print-only.child-row
84
123
  td(colspan=12)= simple_format consult.description
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # https://github.com/renalreg/ukrdc/blob/6d95e364dd8de857839fe6cdbd4e7fc3fb4c1d42/Schema/Diagnoses/Diagnosis.xsd
4
- # This is snomed-based, so might not be possible?
5
4
  xml = builder
6
5
  xml.Diagnoses do
7
- xml.Diagnosis
8
6
  if patient.dead? && patient.first_cause.present?
9
7
  # Only 1 CauseOfDeath element is allowed so we ignore patient.second_cause
10
8
  render(
@@ -13,5 +11,47 @@ xml.Diagnoses do
13
11
  cause: patient.first_cause
14
12
  )
15
13
  end
16
- xml.RenalDiagnosis
14
+
15
+ patient.yes_comorbidities.each do |comorb|
16
+ xml.Diagnosis do
17
+ xml.Diagnosis do
18
+ xml.CodingStandard "SNOMED"
19
+ xml.Code comorb.code
20
+ xml.Description comorb.name
21
+ end
22
+
23
+ # See email from GS to TC 23/5/18 regarding dates.
24
+ # UKRDC would like to receive a date so if no onset date stored in RW for the comorbidity,
25
+ # send the esrf date as the identification date
26
+ if comorb.date.present?
27
+ xml.OnsetTime comorb.date
28
+ elsif patient.esrf_on.present?
29
+ xml.IdentificationTime patient.esrf_on
30
+ end
31
+ end
32
+ end
33
+
34
+ if patient.smoking_history?
35
+ xml.Diagnosis do
36
+ xml.Diagnosis do
37
+ xml.CodingStandard "SNOMED"
38
+ xml.Code patient.snomed_smoking_history.code
39
+ xml.Description "Smoking history: #{patient.snomed_smoking_history.description}"
40
+ end
41
+ # We don't store a smoking date (it doesn't make much sense to) but UKRDC
42
+ # would like a date so send th ESRF date. See email from GS to TC 23/5/18.
43
+ xml.IdentificationTime(patient.esrf_on) if patient.esrf_on.present?
44
+ end
45
+ end
46
+
47
+ if patient.prd_description_code.present?
48
+ xml.RenalDiagnosis do
49
+ xml.Diagnosis do
50
+ xml.CodingStandard "EDTA2"
51
+ xml.Code patient.prd_description_code
52
+ xml.Description patient.prd_description_term
53
+ end
54
+ xml.IdentificationTime(patient.first_seen_on) if patient.first_seen_on.present?
55
+ end
56
+ end
17
57
  end
@@ -23,9 +23,29 @@ xml.Medications do
23
23
  # end
24
24
  end
25
25
  xml.Frequency prescription.frequency
26
- xml.Comments prescription.notes
27
- # xml.DoseUoM
28
- # xml.Indication
26
+ xml.Comments [prescription.dose_amount,
27
+ prescription.dose_unit&.text,
28
+ prescription.frequency].compact.join(" ")
29
+
30
+
31
+ # rubocop:disable Style/RescueModifier
32
+ # Only output DoseQuantity is it is an integer or decimal
33
+ dose_amount_is_a_number = Float(prescription.dose_amount) rescue nil
34
+ # rubocop:enable Style/RescueModifier
35
+ if dose_amount_is_a_number
36
+ xml.DoseQuantity prescription.dose_amount
37
+ end
38
+
39
+ if prescription.dose_unit.present?
40
+ xml.DoseUoM do
41
+ prescription.dose_unit
42
+ xml.CodingStandard "LOCAL"
43
+ xml.Code prescription.dose_unit&.text
44
+ xml.Description prescription.dose_unit
45
+ end
46
+ end
47
+
48
+ xml.ExternalId prescription.id
29
49
  end
30
50
  end
31
51
  end
@@ -4,11 +4,11 @@ xml = builder
4
4
 
5
5
  # Currently only used for smoking for which CodingStandard=RRSMOKE Code=YES/NO/EX
6
6
  xml.SocialHistories do
7
- if patient.smoking_history.present?
7
+ if patient.smoking_history?
8
8
  xml.SocialHistory do
9
9
  xml.SocialHabit do
10
10
  xml.CodingStandard "RRSMOKE"
11
- xml.Code patient.smoking_history
11
+ xml.Code patient.rr_smoking_history
12
12
  end
13
13
  end
14
14
  end
@@ -1,5 +1,7 @@
1
1
  - document = Renalware::Virology.cast_patient(protocol.patient).profile&.document || Renalware::NullObject.instance
2
2
  table(style="text-align: left;")
3
+ / Do not display hepatitis_b_core_anti_body in the HD protocol as that does not
4
+ / imply the patient is infectious
3
5
  - %i(hiv hepatitis_b hepatitis_c htlv).each do |attr|
4
6
  - if document.public_send(attr).status&.yes?
5
7
  tr
@@ -83,6 +83,8 @@ ruby:
83
83
  = render_input fcm, :blood_pressure
84
84
  = fcm.input :temperature_measured, as: :inline_radio_buttons, wrapper: :horizontal_medium
85
85
  = fcm.input :temperature, wrapper: :horizontal_tiny
86
+ = fcm.input :respiratory_rate_measured, as: :inline_radio_buttons, wrapper: :horizontal_medium
87
+ = fcm.input :respiratory_rate, wrapper: :horizontal_tiny
86
88
  = fcm.input :bm_stix, wrapper: :horizontal_tiny
87
89
 
88
90
  = render layout: "renalware/shared/fieldset",
@@ -94,6 +96,8 @@ ruby:
94
96
  = render_input fcm, :blood_pressure
95
97
  = fcm.input :temperature_measured, as: :inline_radio_buttons, wrapper: :horizontal_medium
96
98
  = fcm.input :temperature, wrapper: :horizontal_tiny
99
+ = fcm.input :respiratory_rate_measured, as: :inline_radio_buttons, wrapper: :horizontal_medium
100
+ = fcm.input :respiratory_rate, wrapper: :horizontal_tiny
97
101
  = fcm.input :bm_stix, wrapper: :horizontal_tiny
98
102
 
99
103
  = render layout: "renalware/shared/fieldset",
@@ -3,8 +3,8 @@
3
3
  - if table.rows.empty?
4
4
  p No results available for this patient.
5
5
  - else
6
- .embedded-scroll.pathology
7
- p.hint Hover over table then scroll horizontally to view more results.
6
+ p.hint Hover over table then scroll horizontally to view more results.
7
+ .double-scroll.embedded-scroll.pathology
8
8
  = render "table", table: table
9
9
 
10
10
  = paginate(table)
@@ -0,0 +1,5 @@
1
+ article.hep_b_antibody_path_results
2
+ h2 Latest Hep B Surface Antibody Titre
3
+ - if dashboard.latest_hep_b_antibody_statuses?
4
+ = render "renalware/pathology/historical_observation_results/table",
5
+ table: dashboard.latest_hep_b_antibody_statuses
@@ -1,6 +1,9 @@
1
1
  = content_for(:actions) do
2
- = render "actions", patient: patient
2
+ = render "actions", patient: dashboard.patient
3
3
 
4
4
  = within_patient_layout(title: "Virology") do
5
- = render "renalware/virology/profiles/summary", patient: patient
6
- = render "renalware/virology/vaccinations/list", vaccinations: vaccinations, patient: patient
5
+ = render "renalware/virology/profiles/summary", patient: dashboard.patient
6
+ = render "renalware/virology/vaccinations/list",
7
+ vaccinations: dashboard.vaccinations,
8
+ patient: dashboard.patient
9
+ = render "latest_hep_b_antibody_statuses", dashboard: dashboard
@@ -9,8 +9,8 @@ article
9
9
  ul.noprint
10
10
  li= link_to "Edit", edit_patient_virology_profile_path(patient), class: "button"
11
11
 
12
- dl.dl-horizontal.medium
13
- - %i(hiv hepatitis_b hepatitis_c htlv).each do |attr_name|
12
+ dl.dl-horizontal.xlarge
13
+ - %i(hiv hepatitis_b hepatitis_b_core_antibody hepatitis_c htlv).each do |attr_name|
14
14
  - status = document.public_send(attr_name).status
15
15
  - next if positive_results_only && !status&.yes?
16
16
  dt= attr_name(document, attr_name)
@@ -11,6 +11,7 @@
11
11
  .hint If YES, enter year of diagnosis
12
12
  = render_input fd, :hiv
13
13
  = render_input fd, :hepatitis_b
14
+ = render_input fd, :hepatitis_b_core_antibody
14
15
  = render_input fd, :hepatitis_c
15
16
  = render_input fd, :htlv
16
17
 
@@ -33,6 +33,8 @@ en:
33
33
  blood_pressure: Blood Pressure
34
34
  temperature_measured: Temperature taken
35
35
  temperature: Temperature
36
+ respiratory_rate_measured: Respiratory rate taken
37
+ respiratory_rate: Respiratory rate
36
38
  bm_stix: BM Stix
37
39
  renalware/hd/session_document/dialysis:
38
40
  arterial_pressure: Arterial Pressure
@@ -90,6 +92,8 @@ en:
90
92
  bm_stix:
91
93
  out_of_range: Please enter a value between 0.5 and 50.0
92
94
  invalid_number: Please enter a number with up to 1 decimal place, for example 20 or 20.1
95
+ respiratory_rate:
96
+ out_of_range: Please enter a value between 4 and 40
93
97
 
94
98
  enumerize:
95
99
  renalware/hd/session_document/observations:
@@ -13,6 +13,7 @@ en:
13
13
  renalware/virology/profile_document:
14
14
  hiv: HIV
15
15
  hepatitis_b: Hepatitis B
16
+ hepatitis_b_core_antibody: Hepatitis B Core Antibody
16
17
  hepatitis_c: Hepatitis C
17
18
  htlv: HTLV
18
19
  enumerize:
@@ -0,0 +1,65 @@
1
+ CREATE OR REPLACE FUNCTION renalware.import_practice_memberships_csv(file text) RETURNS void
2
+ AS $$
3
+ BEGIN
4
+
5
+ DROP TABLE IF EXISTS copied_memberships;
6
+ CREATE TEMP TABLE copied_memberships (
7
+ gp_code text NOT NULL,
8
+ practice_code text NOT NULL,
9
+ unused3 text,
10
+ joined_on text,
11
+ left_on text,
12
+ unused7 text
13
+ );
14
+
15
+ -- Import the CSV file into copied_memberships - note there is no CSV header in this file
16
+ EXECUTE format ('COPY copied_memberships FROM %L DELIMITER %L CSV ', file, ',');
17
+
18
+ DROP TABLE IF EXISTS tmp_memberships;
19
+ CREATE TEMP TABLE tmp_memberships AS
20
+ SELECT
21
+ C.gp_code,
22
+ C.practice_code,
23
+ case C.joined_on when '' then NULL else C.joined_on::date end,
24
+ case C.left_on when '' then NULL else C.left_on::date end,
25
+ patient_primary_care_physicians.id primary_care_physician_id,
26
+ patient_practices.id as practice_id
27
+ from copied_memberships C
28
+ INNER JOIN patient_practices on patient_practices.code = C.practice_code
29
+ INNER JOIN patient_primary_care_physicians on patient_primary_care_physicians.code = C.gp_code;
30
+
31
+ -- Insert any new memberships, ignoring any conflicts where the
32
+ -- practice_id + primary_care_physician_id already exists
33
+ INSERT INTO renalware.patient_practice_memberships
34
+ (practice_id, primary_care_physician_id, joined_on, left_on, active, created_at, updated_at)
35
+ SELECT
36
+ practice_id,
37
+ primary_care_physician_id,
38
+ joined_on,
39
+ left_on,
40
+ case when left_on is null then true else false end,
41
+ CURRENT_TIMESTAMP,
42
+ CURRENT_TIMESTAMP
43
+ FROM tmp_memberships
44
+ ON CONFLICT (practice_id, primary_care_physician_id) DO NOTHING;
45
+
46
+ -- However we need to ensure the joined_on left_on and active columns are up to date as these
47
+ -- were recently added
48
+ UPDATE renalware.patient_practice_memberships AS M
49
+ SET
50
+ joined_on = T.joined_on,
51
+ left_on = T.left_on,
52
+ active = case when T.left_on is null then true else false end
53
+ FROM tmp_memberships T
54
+ WHERE T.practice_id = M.practice_id AND T.primary_care_physician_id = M.primary_care_physician_id;
55
+
56
+ -- Mark as deleted any memberships not in the latest uploaded data set - ie those gps have retired or moved on
57
+ UPDATE patient_practice_memberships mem
58
+ SET deleted_at = CURRENT_TIMESTAMP
59
+ WHERE NOT EXISTS (select 1 FROM tmp_memberships tmem
60
+ WHERE tmem.practice_id = mem.practice_id AND tmem.primary_care_physician_id = mem.primary_care_physician_id);
61
+
62
+ DROP TABLE IF EXISTS copied_memberships;
63
+ DROP TABLE IF EXISTS tmp_memberships;
64
+ END;
65
+ $$ LANGUAGE plpgsql;
@@ -0,0 +1,26 @@
1
+ class AddLastChangeDateToPatientPractices < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :patient_practices, :last_change_date, :date
4
+
5
+ # Here we are moving away from using a deleted_at/acts_as_paranoid approach to hiding practices
6
+ # to just having an #active boolean flag - this more closely emulates the output of the NHS
7
+ # Organisation Data Service (ODS) API which returns Status = Active ot Status = Inactive.
8
+ # Because we are doing some data migration here also, we need to manually handle the rollback.
9
+ reversible do |direction|
10
+ direction.up do
11
+ add_column :patient_practices, :active, :boolean, default: true, index: true
12
+ connection.execute(
13
+ "update renalware.patient_practices set active = false where deleted_at is not null;"
14
+ )
15
+ remove_column :patient_practices, :deleted_at, :datetime
16
+ end
17
+ direction.down do
18
+ add_column :patient_practices, :deleted_at, :datetime, index: true
19
+ connection.execute(
20
+ "update renalware.patient_practices set deleted_at = '2000-01-01' where active = false;"
21
+ )
22
+ remove_column :patient_practices, :active, :boolean
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ class CreateSystemAPILogs < ActiveRecord::Migration[5.2]
2
+ def change
3
+ within_renalware_schema do
4
+ create_table :system_api_logs do |t|
5
+ t.string :identifier, null: false, index: true
6
+ t.string :status, null: false, index: true
7
+ t.integer :records_added, null: false, default: 0
8
+ t.integer :records_updated, null: false, default: 0
9
+ t.boolean :dry_run, null: false, default: false
10
+ t.text :error
11
+ t.timestamps null: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ class AddPagesToSystemAPILogs < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :system_api_logs, :pages, :integer, null: false, default: 0
4
+ end
5
+ end