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
@@ -1,15 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_dependency "renalware"
|
2
4
|
|
3
5
|
module Renalware
|
4
6
|
module UKRDC
|
5
7
|
class PatientPresenter < SimpleDelegator
|
6
|
-
|
7
|
-
delegate :clinic_visits, to: :clinics_patient
|
8
|
+
attr_reader :changes_since, :changes_up_until
|
8
9
|
delegate :profile, to: :renal_patient, allow_nil: true
|
9
10
|
delegate :first_seen_on, to: :profile, allow_nil: true
|
10
11
|
alias_attribute :home_telephone, :telephone1
|
11
12
|
alias_attribute :mobile_telephone, :telephone2
|
12
13
|
|
14
|
+
def initialize(patient, changes_since: nil)
|
15
|
+
if changes_since.present? && changes_since.is_a?(String)
|
16
|
+
changes_since = Time.zone.parse(changes_since)
|
17
|
+
end
|
18
|
+
@changes_since = changes_since || patient.sent_to_ukrdc_at
|
19
|
+
if @changes_since.blank?
|
20
|
+
raise(
|
21
|
+
ArgumentError,
|
22
|
+
"No date for comparison: patient#sent_to_ukrdc_at and changes_since are nil"
|
23
|
+
)
|
24
|
+
end
|
25
|
+
@changes_up_until = Time.zone.now
|
26
|
+
super(patient)
|
27
|
+
end
|
28
|
+
|
13
29
|
def dead?
|
14
30
|
current_modality_death?
|
15
31
|
end
|
@@ -25,11 +41,21 @@ module Renalware
|
|
25
41
|
|
26
42
|
def letters
|
27
43
|
CollectionPresenter.new(
|
28
|
-
letters_patient
|
44
|
+
letters_patient
|
45
|
+
.letters
|
46
|
+
.approved
|
47
|
+
.where("updated_at > ?", changes_since),
|
29
48
|
Renalware::Letters::LetterPresenterFactory
|
30
49
|
)
|
31
50
|
end
|
32
51
|
|
52
|
+
def finished_hd_sessions
|
53
|
+
hd_patient
|
54
|
+
.finished_hd_sessions
|
55
|
+
.includes(:patient, :dialysate)
|
56
|
+
.where("hd_sessions.updated_at > ?", changes_since)
|
57
|
+
end
|
58
|
+
|
33
59
|
def current_registration_status_rr_code
|
34
60
|
@current_registration_status_rr_code ||= begin
|
35
61
|
status = transplant_patient.current_registration_status
|
@@ -45,11 +71,35 @@ module Renalware
|
|
45
71
|
email || home_telephone || mobile_telephone
|
46
72
|
end
|
47
73
|
|
74
|
+
def allergies
|
75
|
+
clinical_patient
|
76
|
+
.allergies
|
77
|
+
.where("recorded_at >= ?", changes_since)
|
78
|
+
end
|
79
|
+
|
80
|
+
def clinic_visits
|
81
|
+
clinics_patient
|
82
|
+
.clinic_visits
|
83
|
+
.where("date >= ?", changes_since)
|
84
|
+
.includes(:updated_by)
|
85
|
+
end
|
86
|
+
|
87
|
+
def prescriptions
|
88
|
+
__getobj__.prescriptions
|
89
|
+
.includes(:termination, :medication_route, :drug)
|
90
|
+
.where("updated_at > ?", changes_since)
|
91
|
+
end
|
92
|
+
|
48
93
|
def observation_requests
|
49
94
|
pathology_patient
|
50
95
|
.observation_requests
|
51
|
-
.
|
96
|
+
.eager_load(
|
97
|
+
:description,
|
98
|
+
observations: { description: :measurement_unit }
|
99
|
+
)
|
52
100
|
.where(patient_id: id)
|
101
|
+
.where("requested_at >= ?", changes_since)
|
102
|
+
.where("loinc_code is not null")
|
53
103
|
end
|
54
104
|
|
55
105
|
private
|
@@ -77,6 +127,10 @@ module Renalware
|
|
77
127
|
def transplant_patient
|
78
128
|
@transplant_patient ||= Renalware::Transplants::PatientPresenter.new(__getobj__)
|
79
129
|
end
|
130
|
+
|
131
|
+
def hd_patient
|
132
|
+
@hd_patient ||= Renalware::HD::PatientPresenter.new(self)
|
133
|
+
end
|
80
134
|
end
|
81
135
|
end
|
82
136
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
xml = builder
|
2
|
-
hd_patient = Renalware::HD::PatientPresenter.new(patient)
|
3
2
|
|
4
3
|
xml.Encounters do
|
5
|
-
|
4
|
+
patient.finished_hd_sessions.each do |session|
|
6
5
|
render "renalware/api/ukrdc/patients/encounters/hd_session",
|
7
6
|
builder: xml,
|
8
7
|
patient: patient,
|
9
|
-
hd_patient: hd_patient,
|
10
8
|
session: Renalware::HD::SessionPresenter.new(session)
|
11
9
|
end
|
12
10
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
xml = builder
|
2
2
|
|
3
3
|
# TODO: Implement start stop dates
|
4
|
-
|
5
|
-
|
4
|
+
xml.LabOrders(
|
5
|
+
start: patient.changes_since.to_date.iso8601,
|
6
|
+
stop: patient.changes_up_until.to_date.iso8601
|
7
|
+
) do
|
6
8
|
render partial: "renalware/api/ukrdc/patients/lab_orders/lab_order",
|
7
|
-
collection: patient.observation_requests
|
8
|
-
:description,
|
9
|
-
observations: { description: :measurement_unit }
|
10
|
-
),
|
9
|
+
collection: patient.observation_requests,
|
11
10
|
as: :request,
|
12
11
|
locals: { builder: builder, patient: patient }
|
13
12
|
end
|
@@ -4,10 +4,11 @@
|
|
4
4
|
# - bp
|
5
5
|
xml = builder
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
xml.Observations(
|
8
|
+
start: patient.changes_since.to_date.iso8601,
|
9
|
+
stop: patient.changes_up_until.to_date.iso8601
|
10
|
+
) do
|
11
|
+
patient.clinic_visits.each do |visit|
|
11
12
|
render "clinic_visit_observation",
|
12
13
|
visit: visit,
|
13
14
|
method: :systolic_bp,
|
@@ -24,7 +24,7 @@ xml.Treatment do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
xml.Attributes do
|
27
|
-
xml.HDP01
|
27
|
+
xml.HDP01 session.patient&.hd_profile&.schedule_definition&.days_per_week
|
28
28
|
xml.HDP02 session.duration
|
29
29
|
xml.HDP03 session.document.dialysis.flow_rate
|
30
30
|
xml.HDP04 session&.dialysate&.sodium_content
|
@@ -2,12 +2,18 @@
|
|
2
2
|
#
|
3
3
|
xml = builder
|
4
4
|
|
5
|
+
# Migrated OBRs have the prefix 'PCS-'. Some have been reported as duplicates by URDC.
|
6
|
+
# I don't believe PCS-XXX is the actual placerid in the HL7 message as this is not stored in RW1
|
7
|
+
# so we are safe here to suffix them with a random string to remove the possibility of duplication.
|
8
|
+
placer_id = request.requestor_order_number
|
9
|
+
placer_id += SecureRandom.hex(8) if placer_id.to_s.upcase.start_with?("PCS-")
|
10
|
+
|
5
11
|
xml.LabOrder do
|
6
12
|
# xml.ReceivingLocation do
|
7
13
|
# xml.Code ""
|
8
14
|
# xml.Description # request.pathology_lab.name
|
9
15
|
# end
|
10
|
-
xml.PlacerId
|
16
|
+
xml.PlacerId placer_id
|
11
17
|
# xml.FillerId "??ORC:3 Labs Order Id"
|
12
18
|
# xml.OrderedBy do
|
13
19
|
# xml.Code "unknown"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
json.
|
1
|
+
json.id patient.id
|
2
2
|
json.secure_id patient.secure_id
|
3
|
-
json.
|
3
|
+
json.nhs_number patient.nhs_number
|
4
4
|
json.local_patient_id patient.local_patient_id
|
5
5
|
json.local_patient_id_2 patient.local_patient_id_2
|
6
6
|
json.local_patient_id_3 patient.local_patient_id_3
|
@@ -12,6 +12,19 @@ json.family_name patient.family_name
|
|
12
12
|
json.born_on patient.born_on&.to_s
|
13
13
|
json.died_on patient.died_on&.to_s
|
14
14
|
json.sex patient.sex&.code
|
15
|
-
json.ethnicity patient.ethnicity&.
|
16
|
-
json.
|
15
|
+
json.ethnicity patient.ethnicity&.name
|
16
|
+
json.current_address do
|
17
|
+
json.street_1 patient.current_address&.street_1
|
18
|
+
json.street_2 patient.current_address&.street_2
|
19
|
+
json.street_3 patient.current_address&.street_3
|
20
|
+
json.town patient.current_address&.town
|
21
|
+
json.county patient.current_address&.county
|
22
|
+
json.region patient.current_address&.region
|
23
|
+
json.postcode patient.current_address&.postcode
|
24
|
+
json.country patient.current_address&.country&.name
|
25
|
+
json.telephone patient.current_address&.telephone
|
26
|
+
json.email patient.current_address&.email
|
27
|
+
end
|
28
|
+
json.prescriptions_url api_v1_patient_prescriptions_url(patient_id: patient)
|
17
29
|
json.hd_profile_url api_v1_patient_hd_current_profile_url(patient_id: patient)
|
30
|
+
# TODO: HD Profile link to have at least site and schedule
|