renalware-core 2.0.0.pre.rc11 → 2.0.0.pre.rc13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/app/assets/javascripts/renalware/letters.js +10 -0
- data/app/assets/stylesheets/renalware/modules/_letters.scss +0 -2
- data/app/assets/stylesheets/renalware/modules/_pathology.scss +24 -3
- data/app/assets/stylesheets/renalware/modules/_patients.scss +1 -2
- data/app/assets/stylesheets/renalware/partials/_layout.scss +3 -15
- data/app/assets/stylesheets/renalware/patient_pages.scss +43 -0
- data/app/controllers/renalware/api/ukrdc/patients_controller.rb +1 -1
- data/app/controllers/renalware/api/v1/medications/prescriptions_controller.rb +38 -0
- data/app/controllers/renalware/drugs/drugs_controller.rb +2 -6
- data/app/controllers/renalware/letters/completed_letters_controller.rb +21 -3
- data/app/controllers/renalware/letters/lists_controller.rb +9 -1
- data/app/controllers/renalware/pathology/historical_observation_results_controller.rb +1 -1
- data/app/controllers/renalware/pathology/recent_observation_results_controller.rb +1 -1
- data/app/helpers/renalware/letters_helper.rb +7 -0
- data/app/models/concerns/renalware/patient_pathology_scopes.rb +1 -1
- data/app/models/concerns/renalware/patients_ransack_helper.rb +10 -8
- data/app/models/concerns/renalware/personable.rb +1 -1
- data/app/models/renalware/admissions/admission.rb +1 -1
- data/app/models/renalware/admissions/consult.rb +1 -1
- data/app/models/renalware/admissions/request.rb +1 -1
- data/app/models/renalware/clinical/body_composition.rb +1 -1
- data/app/models/renalware/drugs/classification.rb +2 -2
- data/app/models/renalware/drugs/drug.rb +1 -1
- data/app/models/renalware/feeds/files/import_job_factory.rb +0 -1
- data/app/models/renalware/feeds/files/practices/import_job.rb +1 -0
- data/app/models/renalware/feeds/message_processor.rb +5 -4
- data/app/models/renalware/hd/diary_slot.rb +3 -2
- data/app/models/renalware/letters/archive.rb +1 -1
- data/app/models/renalware/letters/complete_letter.rb +9 -5
- data/app/models/renalware/letters/contact.rb +1 -1
- data/app/models/renalware/letters/electronic_receipt.rb +1 -1
- data/app/models/renalware/letters/letter.rb +3 -0
- data/app/models/renalware/letters/letter/approved.rb +2 -0
- data/app/models/renalware/letters/letter/draft.rb +5 -1
- data/app/models/renalware/letters/letter/pending_review.rb +2 -0
- data/app/models/renalware/letters/pdf_letter_cache.rb +27 -13
- data/app/models/renalware/letters/signature.rb +2 -2
- data/app/models/renalware/low_clearance/mdm_patients_query.rb +1 -1
- data/app/models/renalware/messaging/internal/author.rb +1 -0
- data/app/models/renalware/messaging/message.rb +1 -1
- data/app/models/renalware/pathology/measurement_unit.rb +1 -1
- data/app/models/renalware/pathology/observation.rb +7 -2
- data/app/models/renalware/pathology/observation_description.rb +8 -2
- data/app/models/renalware/pathology/observation_request.rb +1 -4
- data/app/models/renalware/patients/alert.rb +1 -1
- data/app/models/renalware/patients/bookmark.rb +1 -0
- data/app/models/renalware/patients/worry.rb +4 -1
- data/app/models/renalware/pd/peritonitis_episode_type.rb +2 -1
- data/app/models/renalware/pd/regime_bag.rb +1 -1
- data/app/models/renalware/renal/aki_alert.rb +1 -1
- data/app/models/renalware/research/study.rb +5 -2
- data/app/models/renalware/research/study_participant.rb +5 -14
- data/app/models/renalware/transplants/donation.rb +1 -1
- data/app/models/renalware/transplants/mdm_patients_query.rb +4 -2
- data/app/models/renalware/transplants/recipient_followup.rb +2 -2
- data/app/models/renalware/transplants/registrations/wait_list_query.rb +8 -2
- data/app/models/renalware/ukrdc.rb +9 -0
- data/app/models/renalware/ukrdc/patients_query.rb +24 -0
- data/app/models/renalware/ukrdc/send_patient.rb +97 -0
- data/app/models/renalware/ukrdc/send_patients.rb +91 -0
- data/app/models/renalware/ukrdc/transmission_log.rb +30 -0
- data/app/models/renalware/virology/profile.rb +1 -0
- data/app/presenters/date_presenter.rb +2 -0
- data/app/presenters/date_time_presenter.rb +2 -0
- data/app/presenters/enumerize/value_presenter.rb +2 -0
- data/app/presenters/false_class_presenter.rb +2 -0
- data/app/presenters/presenter.rb +2 -0
- data/app/presenters/renalware/accesses/assessment_presenter.rb +2 -0
- data/app/presenters/renalware/accesses/patient_presenter.rb +2 -0
- data/app/presenters/renalware/accesses/plan_presenter.rb +2 -0
- data/app/presenters/renalware/accesses/procedure_presenter.rb +2 -0
- data/app/presenters/renalware/accesses/profile_presenter.rb +2 -0
- data/app/presenters/renalware/address_presenter.rb +2 -0
- data/app/presenters/renalware/address_presenter/block.rb +2 -0
- data/app/presenters/renalware/address_presenter/short.rb +2 -0
- data/app/presenters/renalware/address_presenter/single_line.rb +2 -0
- data/app/presenters/renalware/admin/users/summary_part.rb +2 -0
- data/app/presenters/renalware/admissions/admission_presenter.rb +2 -0
- data/app/presenters/renalware/admissions/consult_presenter.rb +2 -0
- data/app/presenters/renalware/admissions/summary_part.rb +2 -0
- data/app/presenters/renalware/clinical/body_composition_presenter.rb +2 -0
- data/app/presenters/renalware/clinical/dry_weight_presenter.rb +2 -0
- data/app/presenters/renalware/clinical/dry_weights_presenter.rb +2 -0
- data/app/presenters/renalware/clinical/header_presenter.rb +2 -0
- data/app/presenters/renalware/clinical/profile_presenter.rb +2 -0
- data/app/presenters/renalware/country_presenter.rb +2 -0
- data/app/presenters/renalware/dashboard/dashboard_presenter.rb +2 -0
- data/app/presenters/renalware/directory/person_auto_complete_presenter.rb +2 -0
- data/app/presenters/renalware/events/events_presenter.rb +2 -0
- data/app/presenters/renalware/events/summary_part.rb +2 -0
- data/app/presenters/renalware/hd/dashboard_presenter.rb +2 -0
- data/app/presenters/renalware/hd/diary_presenter.rb +2 -0
- data/app/presenters/renalware/hd/diary_slot_presenter.rb +2 -0
- data/app/presenters/renalware/hd/mdm_patient_presenter.rb +2 -0
- data/app/presenters/renalware/hd/mdm_presenter.rb +2 -0
- data/app/presenters/renalware/hd/null_slot.rb +2 -0
- data/app/presenters/renalware/hd/patient_presenter.rb +2 -0
- data/app/presenters/renalware/hd/profile_document_presenter.rb +2 -0
- data/app/presenters/renalware/hd/profile_presenter.rb +2 -0
- data/app/presenters/renalware/hd/protocol/session_presenter.rb +2 -0
- data/app/presenters/renalware/hd/protocol_presenter.rb +2 -0
- data/app/presenters/renalware/hd/session_access_presenter.rb +2 -0
- data/app/presenters/renalware/hd/session_presenter.rb +2 -0
- data/app/presenters/renalware/hd/station_presenter.rb +2 -0
- data/app/presenters/renalware/hd/unmet_preferences_presenter.rb +2 -0
- data/app/presenters/renalware/letters/contact_description_presenter.rb +2 -0
- data/app/presenters/renalware/letters/contact_presenter.rb +2 -0
- data/app/presenters/renalware/letters/contacts_presenter.rb +2 -0
- data/app/presenters/renalware/letters/electronic_receipt_presenter.rb +2 -0
- data/app/presenters/renalware/letters/letter_form_presenter.rb +2 -0
- data/app/presenters/renalware/letters/letter_presenter.rb +2 -0
- data/app/presenters/renalware/letters/letter_presenter_factory.rb +2 -0
- data/app/presenters/renalware/letters/part_class_filter.rb +2 -0
- data/app/presenters/renalware/letters/practice_email_meta_data.rb +2 -0
- data/app/presenters/renalware/letters/recipient_presenter.rb +2 -0
- data/app/presenters/renalware/letters/summary_part.rb +2 -0
- data/app/presenters/renalware/low_clearance/dashboard_presenter.rb +2 -0
- data/app/presenters/renalware/low_clearance/mdm_presenter.rb +2 -0
- data/app/presenters/renalware/mdm_patient_presenter.rb +2 -0
- data/app/presenters/renalware/mdm_patients_presenter.rb +2 -0
- data/app/presenters/renalware/mdm_presenter.rb +2 -4
- data/app/presenters/renalware/medications/prescription_presenter.rb +2 -0
- data/app/presenters/renalware/medications/provider_code_presenter.rb +2 -0
- data/app/presenters/renalware/medications/route_form_presenter.rb +2 -0
- data/app/presenters/renalware/medications/summary_part.rb +37 -6
- data/app/presenters/renalware/medications/treatable_presenter.rb +2 -0
- data/app/presenters/renalware/messaging/internal/message_presenter.rb +2 -0
- data/app/presenters/renalware/messaging/internal/receipt_presenter.rb +2 -0
- data/app/presenters/renalware/pathology/observation_presenter.rb +4 -2
- data/app/presenters/renalware/pathology/observation_set_presenter.rb +21 -8
- data/app/presenters/renalware/pathology/observations_diff.rb +2 -0
- data/app/presenters/renalware/pathology/observations_for_codes_presenter.rb +2 -0
- data/app/presenters/renalware/pathology/patient_presenter.rb +2 -0
- data/app/presenters/renalware/pathology/requests/global_rule_presenter.rb +2 -0
- data/app/presenters/renalware/pathology/requests/global_rule_set_presenter.rb +2 -0
- data/app/presenters/renalware/pathology/requests/patient_rule_presenter.rb +2 -0
- data/app/presenters/renalware/pathology/requests/request_presenter.rb +2 -0
- data/app/presenters/renalware/pathology/requests/sample_description.rb +2 -0
- data/app/presenters/renalware/pathology/results_presenter.rb +2 -0
- data/app/presenters/renalware/patient_presenter.rb +2 -0
- data/app/presenters/renalware/pd/dashboard_presenter.rb +2 -0
- data/app/presenters/renalware/pd/delivery_interval_presenter.rb +2 -0
- data/app/presenters/renalware/pd/mdm_presenter.rb +2 -0
- data/app/presenters/renalware/pd/peritonitis_episode_presenter.rb +2 -0
- data/app/presenters/renalware/pd/training_duration_presenter.rb +2 -0
- data/app/presenters/renalware/primary_care_physician_presenter.rb +2 -0
- data/app/presenters/renalware/problems/summary_part.rb +2 -0
- data/app/presenters/renalware/renal/clinical_summary_presenter.rb +2 -0
- data/app/presenters/renalware/reporting/audit_presenter.rb +2 -0
- data/app/presenters/renalware/summary_part.rb +2 -0
- data/app/presenters/renalware/system/users_presenter.rb +2 -0
- data/app/presenters/renalware/time_of_day_presenter.rb +2 -0
- data/app/presenters/renalware/transplants/consent_presenter.rb +2 -0
- data/app/presenters/renalware/transplants/donor_dashboard_presenter.rb +2 -0
- data/app/presenters/renalware/transplants/mdm_presenter.rb +2 -0
- data/app/presenters/renalware/transplants/patient_presenter.rb +2 -0
- data/app/presenters/renalware/transplants/recipient_dashboard_presenter.rb +2 -0
- data/app/presenters/renalware/transplants/wait_list_registration_presenter.rb +2 -0
- data/app/presenters/renalware/ukrdc/pathology_observation_presenter.rb +2 -0
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +58 -4
- data/app/presenters/string_presenter.rb +2 -0
- data/app/presenters/time_presenter.rb +2 -0
- data/app/presenters/true_class_presenter.rb +2 -0
- data/app/views/renalware/api/ukrdc/patients/_encounters.xml.builder +1 -3
- data/app/views/renalware/api/ukrdc/patients/_lab_orders.xml.builder +5 -6
- data/app/views/renalware/api/ukrdc/patients/_observations.xml.builder +5 -4
- data/app/views/renalware/api/ukrdc/patients/encounters/_hd_session.xml.builder +1 -1
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_lab_order.xml.builder +7 -1
- data/app/views/renalware/api/v1/medications/prescriptions/index.json.jbuilder +14 -0
- data/app/views/renalware/api/v1/patients/patients/show.json.jbuilder +17 -4
- data/app/views/renalware/clinics/clinic_visits/_clinic_visit.html.slim +1 -1
- data/app/views/renalware/events/events/toggled_cell/_biopsy.html.slim +1 -1
- data/app/views/renalware/events/events/toggled_cell/_investigation.html.slim +1 -1
- data/app/views/renalware/events/events/toggled_cell/_simple.html.slim +1 -1
- data/app/views/renalware/events/events/toggled_cell/_swab.html.slim +1 -1
- data/app/views/renalware/events/swabs/_list.html.slim +1 -1
- data/app/views/renalware/hd/mdm_patients/_patient.html.slim +6 -0
- data/app/views/renalware/hd/mdm_patients/_table.html.slim +6 -0
- data/app/views/renalware/layouts/_patient.html.slim +32 -30
- data/app/views/renalware/letters/completed_letters/create.js.erb +8 -0
- data/app/views/renalware/letters/completed_letters/new.html.slim +27 -0
- data/app/views/renalware/letters/lists/_letter.html.slim +18 -4
- data/app/views/renalware/letters/lists/_table.html.slim +19 -0
- data/app/views/renalware/letters/lists/show.html.slim +13 -24
- data/app/views/renalware/letters/lists/show.js.erb +11 -0
- data/app/views/renalware/medications/_summary_part.html.slim +17 -16
- data/app/views/renalware/pathology/current_observation_results/index.html.slim +9 -12
- data/app/views/renalware/patients/_layout.html.slim +27 -24
- data/app/views/renalware/patients/_side_menu.html.slim +1 -0
- data/app/views/renalware/patients/side_menu/_actions.html.slim +1 -1
- data/app/views/renalware/virology/vaccinations/_toggled_cell.html.slim +1 -1
- data/config/initializers/delayed_job.rb +3 -0
- data/config/initializers/wicked_pdf.rb +0 -1
- data/config/locales/en.yml +6 -0
- data/config/locales/renalware/hd/mdm_patients.yml +6 -0
- data/config/routes.rb +2 -4
- data/db/functions/import_practice_memberships_csv_v02.sql +50 -0
- data/db/migrate/20180221210458_add_state_index_on_modalities.rb +5 -0
- data/db/migrate/20180222090501_add_partial_index_to_bookmarks.rb +6 -0
- data/db/migrate/20180223100420_add_sent_to_ukrdc_at_to_patients.rb +5 -0
- data/db/migrate/20180226124724_add_patient_id_to_virology_profile.rb +9 -0
- data/db/migrate/20180226132410_create_ukrdc_transmission_logs.rb +15 -0
- data/db/migrate/20180301095040_update_fn_to_upsert_gp_practive_memberships.rb +9 -0
- data/db/migrate/20180305134959_add_display_group_to_observation_desriptions.rb +32 -0
- data/db/migrate/20180306071308_remove_rogue_aki_alerts_column.rb +5 -0
- data/db/migrate/20180306080518_add_state_tracking_cols_to_letters.rb +19 -0
- data/lib/renalware/engine.rb +1 -0
- data/lib/renalware/version.rb +1 -1
- data/lib/tasks/ukrdc.rake +16 -0
- data/lib/test_support/ajax_helpers.rb +2 -2
- data/spec/factories/accesses/patients.rb +2 -0
- data/spec/factories/accesses/plans.rb +2 -0
- data/spec/factories/accesses/plans_types.rb +2 -0
- data/spec/factories/accesses/procedures.rb +2 -0
- data/spec/factories/accesses/profiles.rb +2 -0
- data/spec/factories/accesses/sites.rb +2 -0
- data/spec/factories/accesses/types.rb +2 -0
- data/spec/factories/admissions/admissions.rb +2 -0
- data/spec/factories/admissions/consult_sites.rb +2 -0
- data/spec/factories/admissions/consults.rb +2 -0
- data/spec/factories/admissions/request_reasons.rb +2 -0
- data/spec/factories/admissions/requests.rb +1 -0
- data/spec/factories/clinical/allergies.rb +2 -0
- data/spec/factories/clinical/body_compositions.rb +2 -0
- data/spec/factories/clinical/dry_weights.rb +2 -0
- data/spec/factories/clinical/patients.rb +2 -0
- data/spec/factories/clinics/appointments.rb +2 -0
- data/spec/factories/clinics/clinic_visits.rb +2 -0
- data/spec/factories/clinics/clinics.rb +2 -0
- data/spec/factories/deaths/cause.rb +2 -0
- data/spec/factories/deaths/modality_descriptions.rb +2 -0
- data/spec/factories/directory/people.rb +2 -0
- data/spec/factories/drugs/drug.rb +2 -0
- data/spec/factories/drugs/drug_types.rb +7 -0
- data/spec/factories/events/events.rb +2 -0
- data/spec/factories/events/events_types.rb +2 -0
- data/spec/factories/feeds/file.rb +2 -0
- data/spec/factories/feeds/file_types.rb +2 -0
- data/spec/factories/hd/cannulation_types.rb +2 -0
- data/spec/factories/hd/dialysates.rb +2 -0
- data/spec/factories/hd/dialysers.rb +2 -0
- data/spec/factories/hd/diaries.rb +2 -0
- data/spec/factories/hd/diurnal_period_codes.rb +2 -0
- data/spec/factories/hd/hd_session_document.rb +2 -0
- data/spec/factories/hd/modality_descriptions.rb +2 -0
- data/spec/factories/hd/patient_statistics.rb +2 -0
- data/spec/factories/hd/patients.rb +2 -0
- data/spec/factories/hd/preference_sets.rb +2 -0
- data/spec/factories/hd/profiles.rb +2 -0
- data/spec/factories/hd/schedule_definitions.rb +2 -0
- data/spec/factories/hd/sessions.rb +2 -0
- data/spec/factories/hd/slots.rb +2 -0
- data/spec/factories/hd/station_locations.rb +2 -0
- data/spec/factories/hd/stations.rb +2 -0
- data/spec/factories/hospitals/centres.rb +2 -0
- data/spec/factories/hospitals/units.rb +2 -0
- data/spec/factories/hospitals/wards.rb +2 -0
- data/spec/factories/letters/archives.rb +2 -0
- data/spec/factories/letters/contact_descriptions.rb +2 -0
- data/spec/factories/letters/contacts.rb +2 -0
- data/spec/factories/letters/descriptions.rb +2 -0
- data/spec/factories/letters/electronic_receipts.rb +2 -0
- data/spec/factories/letters/letterheads.rb +2 -0
- data/spec/factories/letters/letters.rb +2 -0
- data/spec/factories/letters/patients.rb +2 -0
- data/spec/factories/letters/primary_care_physicians.rb +2 -0
- data/spec/factories/letters/recipients.rb +2 -0
- data/spec/factories/low_clearance/modality_descriptions.rb +2 -0
- data/spec/factories/low_clearance/patients.rb +2 -0
- data/spec/factories/low_clearance/profiles.rb +2 -0
- data/spec/factories/medications/medication_route.rb +2 -0
- data/spec/factories/medications/prescription.rb +2 -0
- data/spec/factories/medications/prescription_terminations.rb +2 -0
- data/spec/factories/medications/prescription_version.rb +2 -0
- data/spec/factories/messaging/internal/authors.rb +2 -0
- data/spec/factories/messaging/internal/messages.rb +2 -0
- data/spec/factories/messaging/internal/receipts.rb +2 -0
- data/spec/factories/messaging/internal/recipients.rb +2 -0
- data/spec/factories/messaging/patients.rb +2 -0
- data/spec/factories/modalities/modalities.rb +2 -0
- data/spec/factories/modalities/modality_descriptions.rb +2 -0
- data/spec/factories/modalities/modality_reasons.rb +2 -0
- data/spec/factories/pathology/consultant.rb +2 -0
- data/spec/factories/pathology/lab.rb +2 -0
- data/spec/factories/pathology/measurement_units.rb +2 -0
- data/spec/factories/pathology/observation_descriptions.rb +6 -0
- data/spec/factories/pathology/observation_requests.rb +3 -1
- data/spec/factories/pathology/observations.rb +2 -0
- data/spec/factories/pathology/patients.rb +2 -0
- data/spec/factories/pathology/request_descriptions.rb +2 -0
- data/spec/factories/pathology/requests/drug_category.rb +2 -0
- data/spec/factories/pathology/requests/global_rule.rb +2 -0
- data/spec/factories/pathology/requests/global_rule_set.rb +2 -0
- data/spec/factories/pathology/requests/patient_rule.rb +2 -0
- data/spec/factories/pathology/requests/request.rb +2 -0
- data/spec/factories/patients/alerts.rb +2 -0
- data/spec/factories/patients/bookmarks.rb +2 -0
- data/spec/factories/patients/ethnicities.rb +2 -0
- data/spec/factories/patients/languages.rb +2 -0
- data/spec/factories/patients/patients.rb +2 -0
- data/spec/factories/patients/practice_memberships.rb +2 -0
- data/spec/factories/patients/practices.rb +2 -0
- data/spec/factories/patients/primary_care_physicians.rb +2 -0
- data/spec/factories/patients/religions.rb +2 -0
- data/spec/factories/patients/users.rb +2 -0
- data/spec/factories/pd/assessments.rb +2 -0
- data/spec/factories/pd/bag_types.rb +2 -0
- data/spec/factories/pd/episode_types.rb +2 -0
- data/spec/factories/pd/exit_site_infections.rb +2 -0
- data/spec/factories/pd/fluid_descriptions.rb +2 -0
- data/spec/factories/pd/infection_organisms.rb +2 -0
- data/spec/factories/pd/modality_descriptions.rb +2 -0
- data/spec/factories/pd/organism_codes.rb +2 -0
- data/spec/factories/pd/patients.rb +2 -0
- data/spec/factories/pd/pd_regimes.rb +2 -0
- data/spec/factories/pd/peritonitis_episode_type_descriptions.rb +2 -0
- data/spec/factories/pd/peritonitis_episodes.rb +2 -0
- data/spec/factories/pd/pet_adequacies.rb +2 -0
- data/spec/factories/pd/regime_bags.rb +2 -0
- data/spec/factories/pd/systems.rb +2 -0
- data/spec/factories/pd/training_sessions.rb +2 -0
- data/spec/factories/pd/training_sites.rb +2 -0
- data/spec/factories/pd/training_types.rb +2 -0
- data/spec/factories/problems/problems.rb +2 -0
- data/spec/factories/renal/aki_alert_actions.rb +2 -0
- data/spec/factories/renal/aki_alerts.rb +2 -0
- data/spec/factories/renal/patients.rb +2 -0
- data/spec/factories/renal/prd_description.rb +2 -0
- data/spec/factories/renal/profiles.rb +2 -0
- data/spec/factories/reporting/audits.rb +2 -0
- data/spec/factories/research/studies.rb +2 -0
- data/spec/factories/research/study_participants.rb +2 -0
- data/spec/factories/shared/accountable.rb +2 -0
- data/spec/factories/snippets/snippets.rb +2 -0
- data/spec/factories/snippets/users.rb +2 -0
- data/spec/factories/system/addresses.rb +6 -0
- data/spec/factories/system/countries.rb +2 -0
- data/spec/factories/system/roles.rb +2 -0
- data/spec/factories/system/templates.rb +2 -0
- data/spec/factories/system/users.rb +2 -0
- data/spec/factories/transplants/donations.rb +2 -0
- data/spec/factories/transplants/donor_stage.rb +2 -0
- data/spec/factories/transplants/donor_stage_position.rb +2 -0
- data/spec/factories/transplants/donor_stage_status.rb +2 -0
- data/spec/factories/transplants/live_donor_modality_description.rb +2 -0
- data/spec/factories/transplants/modality_descriptions.rb +2 -0
- data/spec/factories/transplants/patients.rb +2 -0
- data/spec/factories/transplants/recipient_followups.rb +2 -0
- data/spec/factories/transplants/recipient_operations.rb +2 -0
- data/spec/factories/transplants/registration_status_descriptions.rb +2 -0
- data/spec/factories/transplants/registration_statuses.rb +2 -0
- data/spec/factories/transplants/registrations.rb +2 -0
- data/spec/factories/virology/vaccinations.rb +2 -0
- data/spec/support/capybara.rb +2 -0
- data/spec/support/capybara_helper.rb +2 -0
- data/spec/support/database_functions_spec_helper.rb +2 -0
- data/spec/support/date_helpers.rb +2 -0
- data/spec/support/devise_spec_helper.rb +2 -0
- data/spec/support/drugs_spec_helper.rb +2 -0
- data/spec/support/factory_bot.rb +2 -0
- data/spec/support/json_helpers.rb +2 -0
- data/spec/support/letters_spec_helper.rb +9 -0
- data/spec/support/login_macros.rb +2 -0
- data/spec/support/matchers/document.rb +2 -0
- data/spec/support/matchers/validate_timeliness_of.rb +2 -0
- data/spec/support/pathology_spec_helper.rb +2 -0
- data/spec/support/patients_spec_helper.rb +2 -0
- data/spec/support/poltergeist.rb +2 -0
- data/spec/support/pundit_matcher.rb +2 -0
- data/spec/support/roles_spec_helper.rb +2 -0
- data/spec/support/select2_spec_helper.rb +2 -0
- data/spec/support/select_date_spec_helper.rb +2 -0
- data/spec/support/shared_contexts/a_global_rule_set.rb +2 -0
- data/spec/support/shared_examples/accountable_examples.rb +2 -0
- data/spec/support/shared_examples/paranoia_examples.rb +2 -1
- data/spec/support/shared_examples/supersedable_examples.rb +2 -0
- data/spec/support/translations.rb +2 -0
- data/spec/support/travel.rb +2 -0
- data/spec/support/webmock.rb +2 -0
- metadata +39 -6
- data/app/presenters/renalware/pathology/historical_observation_results/html_table_view.rb +0 -64
- data/app/presenters/renalware/pathology/historical_observation_results/presenter.rb +0 -86
- data/app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb +0 -39
- data/app/presenters/renalware/pathology/recent_observation_results/presenter.rb +0 -107
@@ -4,8 +4,8 @@ module Renalware
|
|
4
4
|
module Drugs
|
5
5
|
class Classification < ApplicationRecord
|
6
6
|
self.table_name = "drug_types_drugs" # a relic from migrating from habtm
|
7
|
-
belongs_to :drug
|
8
|
-
belongs_to :drug_type, class_name: "Type"
|
7
|
+
belongs_to :drug, touch: true
|
8
|
+
belongs_to :drug_type, class_name: "Type", inverse_of: :classifications
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -6,7 +6,7 @@ module Renalware
|
|
6
6
|
acts_as_paranoid
|
7
7
|
|
8
8
|
has_many :classifications, dependent: :destroy
|
9
|
-
has_many :drug_types, through: :classifications
|
9
|
+
has_many :drug_types, through: :classifications, after_remove: proc { |drug| drug.touch }
|
10
10
|
|
11
11
|
scope :ordered, -> { order(:name) }
|
12
12
|
|
@@ -43,6 +43,7 @@ module Renalware
|
|
43
43
|
ZipArchive.new(zipfile).unzip do |files|
|
44
44
|
xml_pathname = find_file_in(files, FILE_TO_EXTRACT_FROM_ARCHIVE)
|
45
45
|
csv_path = Practices::ConvertXmlToCsv.call(xml_pathname)
|
46
|
+
FileUtils.copy(csv_path, Rails.root.join("generated_organisations.csv"))
|
46
47
|
Practices::ImportCSV.new(csv_path).call
|
47
48
|
end
|
48
49
|
log "Practice count after update: #{practice_count}"
|
@@ -9,10 +9,11 @@ module Renalware
|
|
9
9
|
include Wisper::Publisher
|
10
10
|
|
11
11
|
def call(raw_message)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
ActiveRecord::Base.transaction do
|
13
|
+
message_payload = parse_message(raw_message)
|
14
|
+
persist_message(message_payload)
|
15
|
+
broadcast(:message_processed, message_payload)
|
16
|
+
end
|
16
17
|
rescue StandardError => exception
|
17
18
|
notify_exception(exception)
|
18
19
|
raise exception
|
@@ -2,6 +2,7 @@ require_dependency "renalware/hd"
|
|
2
2
|
|
3
3
|
module Renalware
|
4
4
|
module HD
|
5
|
+
# TODO: Document
|
5
6
|
class DiarySlot < ApplicationRecord
|
6
7
|
# Changing to_ary from private to public here is a hack required to remove a SimpleDelgator
|
7
8
|
# warning in eg Renalware::HD::WeeklyDiary::WeeklySlotDecorator:
|
@@ -26,8 +27,8 @@ module Renalware
|
|
26
27
|
attr_accessor :change_type
|
27
28
|
|
28
29
|
include Accountable
|
29
|
-
belongs_to :diary, class_name: "Renalware::HD::Diary"
|
30
|
-
belongs_to :patient
|
30
|
+
belongs_to :diary, class_name: "Renalware::HD::Diary", touch: true
|
31
|
+
belongs_to :patient, touch: true
|
31
32
|
belongs_to :station, class_name: "Renalware::HD::Station"
|
32
33
|
belongs_to :diurnal_period_code
|
33
34
|
|
@@ -1,18 +1,22 @@
|
|
1
1
|
require_dependency "renalware/letters"
|
2
|
+
require "attr_extras"
|
2
3
|
|
3
4
|
module Renalware
|
4
5
|
module Letters
|
5
6
|
class CompleteLetter
|
7
|
+
include Broadcasting
|
8
|
+
pattr_initialize :letter
|
9
|
+
|
6
10
|
class << self
|
7
11
|
alias_method :build, :new
|
8
12
|
end
|
9
13
|
|
10
|
-
def initialize(letter)
|
11
|
-
@letter = letter
|
12
|
-
end
|
13
|
-
|
14
14
|
def call(by:)
|
15
|
-
|
15
|
+
Letter.transaction do
|
16
|
+
@letter = letter.complete(by: by)
|
17
|
+
letter.save!
|
18
|
+
broadcast(:letter_completed, letter)
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -3,7 +3,7 @@ require_dependency "renalware/letters"
|
|
3
3
|
module Renalware
|
4
4
|
module Letters
|
5
5
|
class Contact < ApplicationRecord
|
6
|
-
belongs_to :patient
|
6
|
+
belongs_to :patient, touch: true
|
7
7
|
belongs_to :person, class_name: "Directory::Person"
|
8
8
|
belongs_to :description, class_name: "ContactDescription"
|
9
9
|
|
@@ -7,7 +7,7 @@ require_dependency "renalware/letters"
|
|
7
7
|
module Renalware
|
8
8
|
module Letters
|
9
9
|
class ElectronicReceipt < ApplicationRecord
|
10
|
-
belongs_to :letter
|
10
|
+
belongs_to :letter, touch: true
|
11
11
|
belongs_to :recipient, class_name: "Renalware::User"
|
12
12
|
validates :letter, presence: true
|
13
13
|
validates :recipient_id, presence: true
|
@@ -12,6 +12,9 @@ module Renalware
|
|
12
12
|
|
13
13
|
belongs_to :event, polymorphic: true
|
14
14
|
belongs_to :author, class_name: "User"
|
15
|
+
belongs_to :submitted_for_approval_by, class_name: "User"
|
16
|
+
belongs_to :approved_by, class_name: "User"
|
17
|
+
belongs_to :completed_by, class_name: "User"
|
15
18
|
belongs_to :patient, touch: true
|
16
19
|
belongs_to :letterhead
|
17
20
|
has_one :main_recipient,
|
@@ -13,7 +13,11 @@ module Renalware
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def submit(by:)
|
16
|
-
becomes!(PendingReview).tap
|
16
|
+
becomes!(PendingReview).tap do |letter|
|
17
|
+
letter.by = by
|
18
|
+
letter.submitted_for_approval_by = by
|
19
|
+
letter.submitted_for_approval_at = Time.current
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
@@ -2,13 +2,18 @@
|
|
2
2
|
# 2.5 seconds and a fair chunk of memory to convert html to pdf, so we want to cache generated PDFs
|
3
3
|
# for a period of time.
|
4
4
|
#
|
5
|
+
# Note that the cache in question here is not intended to be a canonical archive of PDFs for
|
6
|
+
# future reference; it is up to the host application to move the PDFs into EPR folders etc
|
7
|
+
# for archiving. This cache could be cleared at any time.
|
8
|
+
#
|
5
9
|
# Note that even when checking to see if the PDF exists in the cache, we *always* regenerate at
|
6
10
|
# least the HTML letter content (i.e. the letter content wrapped in a layout) as we want to make
|
7
|
-
# sure we picking up any view and layout changes (
|
11
|
+
# sure we are picking up any view and layout changes (fragment caching could possibly be levered
|
8
12
|
# here as it knows the MD5 of the views and layouts used, and thus might help us to avoid having
|
9
13
|
# to re-render the letter HTML each time - but I have started by taking the less `magical` route
|
10
14
|
# of rendering the entire HTML letter to get its MD5 hash, which is then used in trying to find a
|
11
|
-
# PDF file cache hit for that filename.
|
15
|
+
# PDF file cache hit for that filename).
|
16
|
+
#
|
12
17
|
# Note that PDF Letters are stored in the rails cache, which is currently Filestore. If we move
|
13
18
|
# to a multi-server environment we would need to switch to Memcached or Redis, and the PDF files
|
14
19
|
# would be poked into that - using quite a lot of memory I am sure (ag 25k per PDF), so would be
|
@@ -29,19 +34,28 @@ require_dependency "renalware/letters"
|
|
29
34
|
module Renalware
|
30
35
|
module Letters
|
31
36
|
class PdfLetterCache
|
32
|
-
|
33
|
-
|
34
|
-
yield
|
37
|
+
class << self
|
38
|
+
def fetch(letter)
|
39
|
+
store.fetch(cache_key_for(letter)) { yield }
|
40
|
+
end
|
41
|
+
|
42
|
+
# Note the letter must be a LetterPresenter which has a #to_html method
|
43
|
+
# The to_html method should (and does on the LetterPrsenter class) render the complete
|
44
|
+
# html including surrounding layout with inline css and images. This way if the
|
45
|
+
# layout changes or the image is changed for example, the cache for the pdf is no longer
|
46
|
+
# valid and a new key and cache entry will be created.
|
47
|
+
def cache_key_for(letter)
|
48
|
+
timestamp = letter&.updated_at&.strftime("%Y%m%d%H%M%S")
|
49
|
+
"letter-pdf-#{letter.id}-#{timestamp}-#{Digest::MD5.hexdigest(letter.to_html)}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def cache_path
|
53
|
+
Rails.root.join("tmp", "pdf_letter_cache")
|
35
54
|
end
|
36
|
-
end
|
37
55
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# or the image is changed for example, the cache for the pdf is no longer valid and a new
|
42
|
-
# key and cache entry will be created.
|
43
|
-
def self.cache_key_for(letter)
|
44
|
-
"letter:pdf:#{letter.id}:#{Digest::MD5.hexdigest(letter.to_html)}"
|
56
|
+
def store
|
57
|
+
@store ||= ActiveSupport::Cache::FileStore.new(cache_path)
|
58
|
+
end
|
45
59
|
end
|
46
60
|
end
|
47
61
|
end
|
@@ -3,8 +3,8 @@ require_dependency "renalware/letters"
|
|
3
3
|
module Renalware
|
4
4
|
module Letters
|
5
5
|
class Signature < ApplicationRecord
|
6
|
-
belongs_to :user
|
7
|
-
belongs_to :letter
|
6
|
+
belongs_to :user, touch: true
|
7
|
+
belongs_to :letter, touch: true
|
8
8
|
|
9
9
|
validates :user, presence: true
|
10
10
|
validates :letter, presence: true
|
@@ -4,7 +4,7 @@ module Renalware
|
|
4
4
|
module LowClearance
|
5
5
|
class MDMPatientsQuery
|
6
6
|
include ModalityScopes
|
7
|
-
DEFAULT_SEARCH_PREDICATE = "
|
7
|
+
DEFAULT_SEARCH_PREDICATE = "hgb_date DESC".freeze
|
8
8
|
attr_reader :query, :relation, :named_filter
|
9
9
|
|
10
10
|
def initialize(relation: Patient.all, query: nil, named_filter: nil)
|
@@ -3,8 +3,13 @@ require_dependency "renalware/pathology"
|
|
3
3
|
module Renalware
|
4
4
|
module Pathology
|
5
5
|
class Observation < ApplicationRecord
|
6
|
-
belongs_to :request,
|
7
|
-
|
6
|
+
belongs_to :request,
|
7
|
+
class_name: "ObservationRequest",
|
8
|
+
touch: true,
|
9
|
+
inverse_of: :observations
|
10
|
+
belongs_to :description,
|
11
|
+
class_name: "ObservationDescription",
|
12
|
+
inverse_of: :observations
|
8
13
|
|
9
14
|
validates :description, presence: true
|
10
15
|
validates :result, presence: true, unless: ->(obs) { obs.cancelled? }
|
@@ -3,9 +3,15 @@ require_dependency "renalware/pathology"
|
|
3
3
|
module Renalware
|
4
4
|
module Pathology
|
5
5
|
class ObservationDescription < ApplicationRecord
|
6
|
+
has_many :observations,
|
7
|
+
class_name: "Pathology::Observation",
|
8
|
+
inverse_of: :description
|
6
9
|
belongs_to :measurement_unit
|
7
|
-
|
8
|
-
|
10
|
+
|
11
|
+
scope :in_display_order, lambda {
|
12
|
+
where("display_group is not null and display_order is not null")
|
13
|
+
.order([:display_group, :display_order])
|
14
|
+
}
|
9
15
|
|
10
16
|
def self.for(codes)
|
11
17
|
ObservationDescriptionsByCodeQuery.new(codes: codes).call
|
@@ -7,7 +7,7 @@ module Renalware
|
|
7
7
|
foreign_key: :request_id,
|
8
8
|
inverse_of: :request,
|
9
9
|
dependent: :destroy
|
10
|
-
belongs_to :description, class_name: "RequestDescription"
|
10
|
+
belongs_to :description, class_name: "RequestDescription", inverse_of: :requests
|
11
11
|
belongs_to :patient, class_name: "Patient", touch: true
|
12
12
|
|
13
13
|
accepts_nested_attributes_for :observations
|
@@ -17,9 +17,6 @@ module Renalware
|
|
17
17
|
validates :requested_at, presence: true
|
18
18
|
|
19
19
|
scope :ordered, -> { order(requested_at: :desc) }
|
20
|
-
scope :having_observations_with_a_loinc_code, lambda {
|
21
|
-
joins(observations: :description).where("loinc_code is not null") # TODO: use a merge
|
22
|
-
}
|
23
20
|
|
24
21
|
def requested_on
|
25
22
|
requested_at.to_date
|
@@ -6,6 +6,7 @@ module Renalware
|
|
6
6
|
acts_as_paranoid
|
7
7
|
|
8
8
|
belongs_to :user, class_name: "Renalware::Patients::User", foreign_key: :user_id
|
9
|
+
# No touch required on patient
|
9
10
|
belongs_to :patient, class_name: "Renalware::Patient", foreign_key: :patient_id
|
10
11
|
|
11
12
|
validates :patient, presence: true
|
@@ -6,7 +6,10 @@ module Renalware
|
|
6
6
|
include Accountable
|
7
7
|
has_paper_trail class_name: "Renalware::Patients::Version"
|
8
8
|
|
9
|
-
belongs_to :patient,
|
9
|
+
belongs_to :patient,
|
10
|
+
class_name: "Renalware::Patient",
|
11
|
+
foreign_key: :patient_id,
|
12
|
+
touch: true
|
10
13
|
|
11
14
|
validates :patient, presence: true, uniqueness: true
|
12
15
|
end
|
@@ -6,7 +6,8 @@ module Renalware
|
|
6
6
|
belongs_to :peritonitis_episode_type_description,
|
7
7
|
class_name: "PD::PeritonitisEpisodeTypeDescription"
|
8
8
|
belongs_to :peritonitis_episode,
|
9
|
-
class_name: "PD::PeritonitisEpisode"
|
9
|
+
class_name: "PD::PeritonitisEpisode",
|
10
|
+
touch: true
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -5,7 +5,7 @@ module Renalware
|
|
5
5
|
class AKIAlert < ApplicationRecord
|
6
6
|
include Accountable
|
7
7
|
scope :ordered, ->{ order(created_at: :desc) }
|
8
|
-
belongs_to :patient, class_name: "Renal::Patient"
|
8
|
+
belongs_to :patient, class_name: "Renal::Patient", touch: true
|
9
9
|
belongs_to :action, class_name: "Renal::AKIAlertAction"
|
10
10
|
belongs_to :hospital_ward, class_name: "Hospitals::Ward"
|
11
11
|
validates :patient, presence: true
|
@@ -11,9 +11,12 @@ module Renalware
|
|
11
11
|
validates :started_on, timeliness: { type: :date, allow_blank: true }
|
12
12
|
validates :terminated_on, timeliness: { type: :date, allow_blank: true, after: :started_on }
|
13
13
|
|
14
|
-
scope :ordered, -> { order(
|
14
|
+
scope :ordered, -> { order(code: :asc) }
|
15
15
|
|
16
|
-
has_many :participants,
|
16
|
+
has_many :participants,
|
17
|
+
class_name: "StudyParticipant",
|
18
|
+
dependent: :destroy,
|
19
|
+
inverse_of: :study
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -7,8 +7,11 @@ module Renalware
|
|
7
7
|
acts_as_paranoid
|
8
8
|
validates :participant_id, presence: true, uniqueness: { scope: :study }
|
9
9
|
validates :study, presence: true
|
10
|
-
belongs_to :study
|
11
|
-
belongs_to :patient,
|
10
|
+
belongs_to :study, touch: true
|
11
|
+
belongs_to :patient,
|
12
|
+
class_name: "Renalware::Patient",
|
13
|
+
foreign_key: :participant_id,
|
14
|
+
touch: true
|
12
15
|
|
13
16
|
def to_s
|
14
17
|
patient&.to_s
|
@@ -16,15 +19,3 @@ module Renalware
|
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
19
|
-
# include Accountable
|
20
|
-
# acts_as_paranoid
|
21
|
-
|
22
|
-
# validates :code, presence: true
|
23
|
-
# validates :description, presence: true
|
24
|
-
# validates :started_on, timeliness: { type: :date, allow_blank: true }
|
25
|
-
# validates :terminated_on, timeliness: { type: :date, allow_blank: true, after: :started_on }
|
26
|
-
|
27
|
-
# scope :ordered, -> { order(created_at: :asc) }
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
# end
|