├── .devcontainer └── devcontainer.json ├── .dockerignore ├── .es_version ├── .github ├── actions │ ├── docker-cache │ │ └── action.yml │ ├── gems-cache │ │ └── action.yml │ └── setup-databases │ │ └── action.yml └── workflows │ ├── ci.yml │ ├── next.yml │ └── test.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── .rubocop_todo.yml ├── .ruby-version ├── Dockerfile ├── Dockerfile-dev ├── Dockerfile.selenium ├── Gemfile ├── Gemfile.lock ├── INSTALL.md ├── README.md ├── Rakefile ├── app ├── assets │ ├── fonts │ │ ├── OpenSans │ │ │ ├── OpenSans-Bold.ttf │ │ │ └── OpenSans-Regular.ttf │ │ └── Roboto │ │ │ ├── LICENSE.txt │ │ │ ├── RobotoMono-Bold.ttf │ │ │ └── RobotoMono-Regular.ttf │ ├── images │ │ ├── .keep │ │ ├── arr-select-down-inv.png │ │ ├── arr-select-down.png │ │ ├── arr-select-right-inv.png │ │ ├── arr-select-up-inv.png │ │ ├── arr-select-up.png │ │ ├── arrow-down.png │ │ ├── arrow-left-white.png │ │ ├── arrow-left.png │ │ ├── arrow-top-header.png │ │ ├── assay-results.png │ │ ├── card-unkown.png │ │ ├── cdp_platform.png │ │ ├── cdx-logo-bw.png │ │ ├── cdx-logo-med.png │ │ ├── cdx-logo.png │ │ ├── checkmark.svg │ │ ├── genexpert.png │ │ ├── ic-cross.png │ │ ├── ic-email-black.png │ │ ├── ic-health-organization.png │ │ ├── ic-institution.png │ │ ├── ic-login.png │ │ ├── ic-manufacturer.png │ │ ├── ic-negative.png │ │ ├── ic-on-off.png │ │ ├── ic-pencil.png │ │ ├── ic-positive.png │ │ ├── ic-search-blue.png │ │ ├── ic-search.png │ │ ├── icons-140x140-black.png │ │ ├── icons-20x20-black.png │ │ ├── icons-20x20-blue.png │ │ ├── icons-20x20-white.png │ │ ├── icons │ │ │ ├── alert.svg │ │ │ ├── algorithm.svg │ │ │ ├── arrow-down.svg │ │ │ ├── arrow-left.svg │ │ │ ├── arrow-right.svg │ │ │ ├── arrow-up.svg │ │ │ ├── as-pdf.svg │ │ │ ├── ascending.svg │ │ │ ├── barchart.svg │ │ │ ├── batch.svg │ │ │ ├── bell.svg │ │ │ ├── break.svg │ │ │ ├── building.svg │ │ │ ├── cartridge.svg │ │ │ ├── check.svg │ │ │ ├── check_circle.svg │ │ │ ├── checkbox-outline.svg │ │ │ ├── checkbox-selected.svg │ │ │ ├── circle-minus-outline.svg │ │ │ ├── circle-minus.svg │ │ │ ├── circle-plus-outline.svg │ │ │ ├── circle-plus.svg │ │ │ ├── close.svg │ │ │ ├── collpase.svg │ │ │ ├── comment.svg │ │ │ ├── copy.svg │ │ │ ├── culture.svg │ │ │ ├── delete-circle.svg │ │ │ ├── descending.svg │ │ │ ├── document.svg │ │ │ ├── download.svg │ │ │ ├── earth.svg │ │ │ ├── ellipsis.svg │ │ │ ├── error.svg │ │ │ ├── ethernet.svg │ │ │ ├── expand.svg │ │ │ ├── eye.svg │ │ │ ├── forward.svg │ │ │ ├── help.svg │ │ │ ├── horizontal-thumb-fill.svg │ │ │ ├── horizontal-thumb-outline.svg │ │ │ ├── info-outline.svg │ │ │ ├── info.svg │ │ │ ├── ink-dropper.svg │ │ │ ├── key.svg │ │ │ ├── keyboard-arrow-down.svg │ │ │ ├── keyboard-arrow-left.svg │ │ │ ├── keyboard-arrow-right.svg │ │ │ ├── keyboard-arrow-up.svg │ │ │ ├── link.svg │ │ │ ├── local_shipping.svg │ │ │ ├── location.svg │ │ │ ├── lock.svg │ │ │ ├── mail.svg │ │ │ ├── map.svg │ │ │ ├── mask.svg │ │ │ ├── microscope.svg │ │ │ ├── notification.svg │ │ │ ├── outline-alert.svg │ │ │ ├── outline-algorithm.svg │ │ │ ├── outline-box.svg │ │ │ ├── outline-category.svg │ │ │ ├── outline-device.svg │ │ │ ├── outline-email.svg │ │ │ ├── outline-female-avatar.svg │ │ │ ├── outline-instructions.svg │ │ │ ├── outline-lock.svg │ │ │ ├── outline-male-avatar.svg │ │ │ ├── outline-patient.svg │ │ │ ├── outline-picture.svg │ │ │ ├── outline-report.svg │ │ │ ├── outline-role.svg │ │ │ ├── outline-search.svg │ │ │ ├── outline-sharing-request.svg │ │ │ ├── outline-site.svg │ │ │ ├── outline-test.svg │ │ │ ├── outline-user.svg │ │ │ ├── patient.svg │ │ │ ├── pencil.svg │ │ │ ├── plus.svg │ │ │ ├── power.svg │ │ │ ├── print.svg │ │ │ ├── punchcard.svg │ │ │ ├── radio-button-outline.svg │ │ │ ├── radio-button-selected.svg │ │ │ ├── refresh.svg │ │ │ ├── search.svg │ │ │ ├── send.svg │ │ │ ├── strip.svg │ │ │ ├── table.svg │ │ │ ├── tag.svg │ │ │ ├── test-tube.svg │ │ │ ├── test.svg │ │ │ ├── tick.svg │ │ │ ├── time-span.svg │ │ │ ├── transfer.svg │ │ │ ├── trash.svg │ │ │ ├── trend.svg │ │ │ ├── update.svg │ │ │ ├── upload.svg │ │ │ ├── user.svg │ │ │ ├── visibility_off.svg │ │ │ ├── wrap.svg │ │ │ └── wrench.svg │ │ └── user-invite.png │ ├── javascripts │ │ ├── actions │ │ │ └── AlertActions.js.jsx │ │ ├── application.js │ │ ├── box_selector.js.jsx │ │ ├── components.js │ │ ├── components │ │ │ ├── .gitkeep │ │ │ ├── add_item_search.js.jsx │ │ │ ├── address.js.jsx │ │ │ ├── address_autosuggest.js.jsx │ │ │ ├── admin_invite_form.js.jsx │ │ │ ├── alert_aggregation.js.jsx │ │ │ ├── alert_category_select.js.jsx │ │ │ ├── alert_child_components.js.jsx │ │ │ ├── alert_conditions.js.jsx │ │ │ ├── alert_external_users.js.jsx │ │ │ ├── alert_incidents.js.jsx │ │ │ ├── alert_utilization_efficiency.js.jsx │ │ │ ├── bar_chart.js.jsx │ │ │ ├── box_batches_form.js.jsx │ │ │ ├── cdx_select.js.jsx │ │ │ ├── cdx_select_autocomplete.js.jsx │ │ │ ├── cdx_select_section_toggler.js.jsx │ │ │ ├── confirmation_modal.js.jsx │ │ │ ├── device_setup.js.jsx │ │ │ ├── encounter_form.js.jsx │ │ │ ├── encounter_new.js.jsx │ │ │ ├── encounter_show.js.jsx │ │ │ ├── flash_error_messages.js.jsx │ │ │ ├── fresh_tests_encounter_form.js.jsx │ │ │ ├── institution_invite_form.js.jsx │ │ │ ├── institution_invite_presenter.js.jsx │ │ │ ├── layout.js.jsx │ │ │ ├── location_label.js.jsx │ │ │ ├── location_select.js.jsx │ │ │ ├── modal.js.jsx.erb │ │ │ ├── navigation_context_picker.js.jsx │ │ │ ├── non_editable_map.js.jsx │ │ │ ├── option_list.js.jsx.erb │ │ │ ├── pager.js.jsx │ │ │ ├── patient_card.js.jsx.erb │ │ │ ├── patient_select.js.jsx │ │ │ ├── pie_chart.js.jsx │ │ │ ├── policy_definition.js.jsx │ │ │ ├── policy_definition_field.js.jsx │ │ │ ├── policy_item.js.jsx.erb │ │ │ ├── policy_item_detail.js.jsx │ │ │ ├── resource_list.js.jsx │ │ │ ├── sample.js.jsx │ │ │ ├── samples_reports_bar_chart.js.jsx │ │ │ ├── samples_reports_line_chart.js.jsx │ │ │ ├── samples_reports_roc_chart.js.jsx │ │ │ ├── samples_selector.js.jsx │ │ │ ├── site_select.js.jsx │ │ │ ├── sites.js.jsx │ │ │ ├── sortable_column_header.js.jsx │ │ │ ├── test_orders_list.js.jsx │ │ │ ├── test_result.js.jsx │ │ │ ├── test_results_list.js.jsx │ │ │ ├── upload_csv_box.js.jsx │ │ │ ├── user_institution_invite.js.jsx │ │ │ ├── user_invite_form.js.jsx │ │ │ └── users.js.jsx │ │ ├── device_model.js │ │ ├── liga.js │ │ ├── playground.js │ │ ├── polyfills.js │ │ ├── random_key.js │ │ ├── simulator.js │ │ ├── site.js │ │ ├── stores │ │ │ └── AlertStore.js.jsx │ │ └── styled_confirmation.js │ └── stylesheets │ │ ├── _alert.scss │ │ ├── _barby.scss │ │ ├── _barcode_card.scss │ │ ├── _batches.scss │ │ ├── _box_preview.scss │ │ ├── _buttons.scss │ │ ├── _card.scss │ │ ├── _charts.scss │ │ ├── _components.scss │ │ ├── _errors.scss │ │ ├── _forms.scss │ │ ├── _global.scss │ │ ├── _grid.scss │ │ ├── _icons.scss │ │ ├── _layout.scss │ │ ├── _leaflet-control-geocoder.scss │ │ ├── _mixins.scss │ │ ├── _notes.scss │ │ ├── _react-select.scss │ │ ├── _reset.scss │ │ ├── _sample_assays.scss │ │ ├── _sample_transfer_modal.scss │ │ ├── _samples_report.scss │ │ ├── _selector_list.scss │ │ ├── _tables.scss │ │ ├── _tabs.scss │ │ ├── _transfer_packages.scss │ │ ├── _user_institution_invites_modal.scss │ │ ├── _variables.scss │ │ ├── application.scss │ │ └── mailer.scss ├── controllers │ ├── alert_messages_controller.rb │ ├── alerts_controller.rb │ ├── api │ │ ├── activations_controller.rb │ │ ├── encounters_controller.rb │ │ ├── filters_controller.rb │ │ ├── institutions_controller.rb │ │ ├── messages_controller.rb │ │ ├── playground_controller.rb │ │ ├── sites_controller.rb │ │ ├── subscribers_controller.rb │ │ └── tests_controller.rb │ ├── api_controller.rb │ ├── api_tokens_controller.rb │ ├── application_controller.rb │ ├── assay_files_controller.rb │ ├── autocompletes_controller.rb │ ├── batches_controller.rb │ ├── boxes_controller.rb │ ├── concerns │ │ ├── .keep │ │ ├── subscribers_controller.rb │ │ └── view_helper.rb │ ├── dashboards_controller.rb │ ├── device_commands_controller.rb │ ├── device_logs_controller.rb │ ├── device_messages_controller.rb │ ├── device_models_controller.rb │ ├── devices_controller.rb │ ├── encounters_controller.rb │ ├── filters_controller.rb │ ├── home_controller.rb │ ├── incidents_controller.rb │ ├── institutions_controller.rb │ ├── locations_controller.rb │ ├── loinc_codes_controller.rb │ ├── nih_tables_controller.rb │ ├── omniauth_callbacks_controller.rb │ ├── patients_controller.rb │ ├── policies_controller.rb │ ├── qc_infos_controller.rb │ ├── registrations_controller.rb │ ├── roles_controller.rb │ ├── samples_controller.rb │ ├── samples_reports_controller.rb │ ├── sessions_controller.rb │ ├── sites_controller.rb │ ├── subscribers_controller.rb │ ├── test_results_controller.rb │ ├── transfer_packages_controller.rb │ ├── users │ │ └── invitations_controller.rb │ └── users_controller.rb ├── documents │ ├── base_pdf.rb │ ├── box_label_pdf.rb │ ├── label_pdf.rb │ ├── nih_report.rb │ ├── sample_label_pdf.rb │ └── samples_label_pdf.rb ├── helpers │ ├── activations_helper.rb │ ├── alerts_helper.rb │ ├── application_helper.rb │ ├── autocomplete_field_helper.rb │ ├── barcode_helper.rb │ ├── cdx_form_helper.rb │ ├── charts_helper.rb │ ├── confirmation_helper.rb │ ├── custom_mappings_helper.rb │ ├── device_models_helper.rb │ ├── icon_helper.rb │ ├── mailer_helper.rb │ ├── map_helper.rb │ ├── paging_helper.rb │ ├── patients_helper.rb │ ├── playground_helper.rb │ ├── roles_helper.rb │ ├── sample_helper.rb │ ├── samples_reports_helper.rb │ ├── sites_helper.rb │ └── users_helper.rb ├── jobs │ ├── alert_job.rb │ ├── application_job.rb │ ├── daily_alert_job.rb │ ├── daily_demo_data.rb │ ├── demo_data │ │ └── manifests_demo_template │ │ │ ├── cepheid.json │ │ │ └── fio.xml │ ├── hourly_alert_job.rb │ ├── hourly_utilization_efficiency_job.rb │ ├── monthly_alert_job.rb │ ├── notify_subscriber_job.rb │ ├── sentry_jobs.rb │ └── weekly_alert_job.rb ├── mailers │ ├── .keep │ ├── alert_mailer.rb │ ├── application_mailer.rb │ ├── device_mailer.rb │ └── invitation_mailer.rb ├── models │ ├── alert.rb │ ├── alert_condition_result.rb │ ├── alert_history.rb │ ├── alert_recipient.rb │ ├── application_record.rb │ ├── assay_attachment.rb │ ├── assay_file.rb │ ├── batch.rb │ ├── batch_form.rb │ ├── blender.rb │ ├── box.rb │ ├── box_form.rb │ ├── box_transfer.rb │ ├── computed_policy.rb │ ├── computed_policy_exception.rb │ ├── concerns │ │ ├── auto_id_hash.rb │ │ ├── auto_uuid.rb │ │ ├── computed_policy_concern.rb │ │ ├── core_entity_id.rb │ │ ├── date_produced.rb │ │ ├── entity.rb │ │ ├── inactivation_method.rb │ │ ├── resource.rb │ │ ├── site_contained.rb │ │ ├── specimen_role.rb │ │ └── with_location.rb │ ├── condition.rb │ ├── config │ │ └── specimen_roles.yml │ ├── core_manifest_field.rb │ ├── csv_builder.rb │ ├── csv_message_parser.rb │ ├── custom_manifest_field.rb │ ├── date_distance_helper.rb │ ├── device.rb │ ├── device_command.rb │ ├── device_log.rb │ ├── device_message.rb │ ├── device_message_importer.rb │ ├── device_message_processor.rb │ ├── device_model.rb │ ├── encounter.rb │ ├── encounter_indexer.rb │ ├── encounter_query.rb │ ├── encounters_schema.rb │ ├── entity_csv_builder.rb │ ├── entity_index_updater.rb │ ├── entity_indexable_fields.rb │ ├── entity_indexer.rb │ ├── entity_query.rb │ ├── entity_schema.rb │ ├── file_message.rb │ ├── filter.rb │ ├── ftp_info.rb │ ├── ftp_monitor.rb │ ├── headless_csv_message_parser.rb │ ├── identity.rb │ ├── institution.rb │ ├── json_message_parser.rb │ ├── localization_helper.rb │ ├── location.rb │ ├── loinc_code.rb │ ├── manifest.rb │ ├── manifest_field.rb │ ├── manifest_field_mapping.rb │ ├── manifest_field_validation.rb │ ├── message_encryption.rb │ ├── navigation_context.rb │ ├── note.rb │ ├── patient.rb │ ├── patient_form.rb │ ├── pending_institution_invite.rb │ ├── policy.rb │ ├── qc_info.rb │ ├── recipient_notification_history.rb │ ├── role.rb │ ├── sample.rb │ ├── sample_form.rb │ ├── sample_identifier.rb │ ├── samples_report.rb │ ├── samples_report_sample.rb │ ├── site.rb │ ├── ssh_key.rb │ ├── subscriber.rb │ ├── sync_helpers.rb │ ├── test_result.rb │ ├── test_result_indexer.rb │ ├── test_result_parsed_datum.rb │ ├── test_result_query.rb │ ├── tests_schema.rb │ ├── transfer_package.rb │ ├── user.rb │ ├── xml_message_parser.rb │ ├── xml_message_serializer.rb │ └── zip_serialize.rb ├── policies │ ├── implicit.json.erb │ ├── owner │ │ ├── health_organization.json.erb │ │ ├── institution.json.erb │ │ └── manufacturer.json.erb │ ├── roles │ │ ├── institution │ │ │ ├── health_organization.json.erb │ │ │ ├── institution.json.erb │ │ │ └── manufacturer.json.erb │ │ └── site │ │ │ ├── health_organization.json.erb │ │ │ ├── institution.json.erb │ │ │ └── manufacturer.json.erb │ └── superadmin.json.erb ├── presenters │ ├── sample_presenter.rb │ └── transfer_package_presenter.rb └── views │ ├── alert_mailer │ ├── alert_email.html.haml │ └── alert_email.text.haml │ ├── alert_messages │ └── index.html.haml │ ├── alerts │ ├── _filters.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ └── new.html.haml │ ├── api │ ├── encounters │ │ └── index.csv.csvbuilder │ ├── institutions │ │ └── index.csv.csvbuilder │ ├── playground │ │ ├── index.haml │ │ └── simulator.haml │ ├── sites │ │ └── index.csv.csvbuilder │ └── tests │ │ └── index.csv.csvbuilder │ ├── api_tokens │ └── index.html.haml │ ├── batches │ ├── _filters.haml │ ├── _form.haml │ ├── _index_js.haml │ ├── _samples.haml │ ├── _samples_bulk_js.haml │ ├── _samples_js.haml │ ├── _show_samples.haml │ ├── autocomplete.json.jbuilder │ ├── edit.haml │ ├── index.haml │ └── new.haml │ ├── boxes │ ├── _barcode_card.haml │ ├── _filters.haml │ ├── _form.haml │ ├── _preview.haml │ ├── _preview_for_report.haml │ ├── edit.haml │ ├── index.haml │ ├── inventory.csv.csvbuilder │ ├── new.haml │ ├── show.haml │ └── validate.json.jbuilder │ ├── components │ ├── _card.html.haml │ ├── _cdx_select.html.haml │ ├── _cdx_table.html.haml │ ├── _cdx_tabs.html.haml │ ├── _cdx_tabs_header.html.haml │ ├── _empty_data.html.haml │ ├── _location_select.html.haml │ └── _setting_card.html.haml │ ├── dashboards │ ├── index.html.haml │ └── nndd.haml │ ├── device_logs │ └── index.haml │ ├── device_mailer │ └── setup_instructions.html.haml │ ├── device_messages │ ├── _filters.haml │ └── index.haml │ ├── device_models │ ├── _form.haml │ ├── _publish.haml │ ├── edit.haml │ ├── index.haml │ ├── new.haml │ ├── show.haml │ └── show.json.jbuilder │ ├── devices │ ├── _activation_token.haml │ ├── _custom_mappings.haml │ ├── _device_card.haml │ ├── _filters.haml │ ├── _form.haml │ ├── _secret_key.haml │ ├── edit.haml │ ├── generate_activation_token.js.erb │ ├── index.csv.csvbuilder │ ├── index.haml │ ├── index.json.jbuilder │ ├── logs.haml │ ├── new.haml │ ├── performance.haml │ ├── regenerate_key.js.erb │ ├── setup.haml │ ├── show.haml │ └── token.haml │ ├── devise │ ├── confirmations │ │ └── new.html.haml │ ├── mailer │ │ ├── confirmation_instructions.html.haml │ │ ├── reset_password_instructions.html.erb │ │ └── unlock_instructions.html.erb │ ├── passwords │ │ ├── edit.html.haml │ │ └── new.html.haml │ ├── registrations │ │ ├── edit.html.haml │ │ └── new.html.haml │ ├── sessions │ │ └── new.html.haml │ ├── shared │ │ └── _links.html.erb │ └── unlocks │ │ └── new.html.haml │ ├── encounters │ ├── edit.html.haml │ ├── new.html.haml │ ├── new_index.html.haml │ └── show.html.haml │ ├── filters │ ├── _form.haml │ ├── edit.html.haml │ ├── index.html.haml │ └── new.haml │ ├── form_builder │ ├── _field.haml │ ├── _field_errors.haml │ ├── _form_actions.haml │ └── _form_errors.haml │ ├── home │ ├── design.haml │ ├── index.haml │ ├── join.haml │ ├── settings.html.haml │ └── verify.haml │ ├── incidents │ ├── _filters.html.haml │ └── index.html.haml │ ├── institutions │ ├── _form.haml │ ├── edit.haml │ ├── index.haml │ ├── index.json.jbuilder │ ├── new.haml │ ├── no_data_allowed.haml │ └── pending_approval.haml │ ├── invitation_mailer │ ├── create_institution_message.html.erb │ ├── invite_institution_message.html.erb │ └── invite_message.html.erb │ ├── layouts │ ├── application.html.haml │ ├── clean.haml │ ├── devise.haml │ ├── mailer.html.haml │ ├── mailer.text.haml │ └── messages.haml │ ├── locations │ ├── index.html.haml │ ├── index.json.jbuilder │ ├── show.html.haml │ └── show.json.jbuilder │ ├── nih_tables │ ├── nih_batches.csvbuilder │ ├── nih_challenge.csv.csvbuilder │ ├── nih_lod.csv.csvbuilder │ ├── nih_results.csv.csvbuilder │ └── nih_samples.csv.csvbuilder │ ├── patients │ ├── _filters.haml │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── new.html.haml │ └── show.html.haml │ ├── policies │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.haml │ └── new.html.haml │ ├── qc_infos │ ├── _form.haml │ ├── _show_assays.haml │ ├── _show_notes.haml │ └── edit.haml │ ├── roles │ ├── _filters.haml │ ├── _form.html.haml │ ├── edit.haml │ ├── index.haml │ └── new.haml │ ├── samples │ ├── _barcode_card.haml │ ├── _filters.haml │ ├── _form.haml │ ├── _form_assays.haml │ ├── _form_assays_js.haml │ ├── _form_notes.haml │ ├── _form_notes_js.haml │ ├── _index_bulk_actions_js.haml │ ├── _index_js.haml │ ├── _preview.haml │ ├── _show_assays.haml │ ├── _show_notes.haml │ ├── _upload_results_js.haml │ ├── autocomplete.json.jbuilder │ ├── edit.haml │ ├── index.haml │ ├── new.haml │ └── upload_results.haml │ ├── samples_reports │ ├── _confusion_matrix.haml │ ├── _filters.haml │ ├── _form.haml │ ├── index.haml │ ├── new.haml │ └── show.haml │ ├── shared │ ├── _footer.haml │ ├── _header_nav.haml │ ├── _list.haml │ ├── _pagination.html.haml │ └── _validation_errors.html.haml │ ├── sites │ ├── _filters.haml │ ├── _form.html.haml │ ├── _show.html.haml │ ├── _side.html.haml │ ├── devices.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── index.json.jbuilder │ └── new.html.haml │ ├── subscribers │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ └── new.html.haml │ ├── test_results │ ├── _filters.haml │ ├── index.haml │ └── show.haml │ ├── transfer_packages │ ├── _filters.haml │ ├── _form.haml │ ├── index.haml │ ├── new.haml │ └── show.haml │ └── users │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.haml │ ├── invitations │ ├── edit.html.haml │ └── new.html.erb │ └── no_data_allowed.haml ├── bin ├── bundle ├── rails ├── setup ├── spring └── update ├── cdx-api-elasticsearch.gemspec ├── cdx.gemspec ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cucumber.yml ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── activerecord.rb │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backports.rb │ ├── backtrace_silencers.rb │ ├── cdx.rb │ ├── config.rb │ ├── cookies_serializer.rb │ ├── devise.rb │ ├── doorkeeper.rb │ ├── filter_parameter_logging.rb │ ├── hash.rb │ ├── inflections.rb │ ├── libs.rb │ ├── location_service.rb │ ├── manifest_parsing_error.rb │ ├── mime_types.rb │ ├── object.rb │ ├── oj.rb │ ├── paperclip_defaults.rb │ ├── recaptcha.rb │ ├── sentry.rb │ ├── session_store.rb │ ├── string.rb │ ├── sync.rb │ ├── tempfile_reaper.rb │ ├── version.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ ├── devise.security_extension.de.yml │ ├── devise.security_extension.en.yml │ ├── devise_invitable.en.yml │ ├── doorkeeper.en.yml │ └── en.yml ├── puma.rb ├── routes.rb ├── schedule.rb ├── secrets.yml ├── settings.yml ├── settings │ ├── development.yml │ ├── production.yml │ └── test.yml └── spring.rb ├── db ├── migrate │ ├── 20140203233601_create_work_groups.rb │ ├── 20140203234249_devise_create_users.rb │ ├── 20140203234745_create_facilities.rb │ ├── 20140204134837_create_subscribers.rb │ ├── 20140312115721_delete_facilities_index_name.rb │ ├── 20140312144328_add_auth_token_to_subscribers.rb │ ├── 20140325195841_rename_facility_to_device.rb │ ├── 20140326151525_create_reports.rb │ ├── 20140326191422_add_secret_key_to_devices.rb │ ├── 20140404152310_create_laboratories.rb │ ├── 20140404152558_rename_work_group_to_institution.rb │ ├── 20140404172012_rename_reports_to_test_results.rb │ ├── 20140407154134_remove_institution_id_from_test_results.rb │ ├── 20140407184142_create_locations.rb │ ├── 20140415190208_create_identities.rb │ ├── 20140422171811_add_sensitive_data_to_test_results.rb │ ├── 20140423133302_rolify_create_roles.rb │ ├── 20140425152014_add_institution_id_to_devices.rb │ ├── 20140428143812_add_devices_laboratories.rb │ ├── 20140505145148_add_uuid_to_test_results.rb │ ├── 20140515170318_create_device_models.rb │ ├── 20140515171158_create_manifests.rb │ ├── 20140521153536_delete_subscribers.rb │ ├── 20140521153720_create_new_subscribers.rb │ ├── 20140521194129_add_url_user_and_url_password_to_subscribers.rb │ ├── 20140522180707_add_custom_fields_to_test_result.rb │ ├── 20140526174156_delete_rolify.rb │ ├── 20140526181013_create_policies.rb │ ├── 20140526190412_add_name_to_policies.rb │ ├── 20140530205604_add_event_id_to_test_results.rb │ ├── 20140603191744_rename_test_result_to_event.rb │ ├── 20140722154526_add_admin_level_to_locations.rb │ ├── 20140805151606_add_api_version_to_manifests.rb │ ├── 20140821200906_add_failed_to_events.rb │ ├── 20140822151308_rename_failed_events_column.rb │ ├── 20140822152516_add_index_failure_reason_to_events.rb │ ├── 20140822165416_change_index_failure_reason_events_column_to_text.rb │ ├── 20140918175424_change_manifest_version_from_integer_to_string.rb │ ├── 20140925185610_add_geo_id_to_locations.rb │ ├── 20141218155918_create_ssh_keys.rb │ ├── 20150119150526_create_activation_tokens.rb │ ├── 20150119150757_create_activations.rb │ ├── 20150119154001_add_index_to_activation_token_value.rb │ ├── 20150119172327_make_activation_index_unique.rb │ ├── 20150120144346_rename_device_secret_key_to_client_id.rb │ ├── 20150202182319_create_filters.rb │ ├── 20150202182842_add_filter_id_to_subscriber.rb │ ├── 20150202182945_migrate_subscriber_filters.rb │ ├── 20150202184854_remove_filter_from_subscriber.rb │ ├── 20150204181542_rename_filter_params_as_query.rb │ ├── 20150206142251_add_uuid_to_devices.rb │ ├── 20150223145645_create_samples.rb │ ├── 20150223151051_add_sample_to_events.rb │ ├── 20150223151900_remove_sensitive_data_from_events.rb │ ├── 20150224154748_add_verb_to_subscribers.rb │ ├── 20150225160228_add_institution_to_samples.rb │ ├── 20150227193433_create_device_events.rb │ ├── 20150227193601_remove_raw_data_from_events.rb │ ├── 20150302142243_create_device_events_events.rb │ ├── 20150304194308_add_sensitive_fields_to_events.rb │ ├── 20150304200858_add_custom_fields_to_samples.rb │ ├── 20150304202928_add_sample_uid_hash_to_samples.rb │ ├── 20150304203611_remove_sample_id_from_samples.rb │ ├── 20150304203629_add_indices_to_samples.rb │ ├── 20150305145336_add_indexed_fields_to_samples.rb │ ├── 20150305153907_add_indices_to_events.rb │ ├── 20150305175247_add_device_id_to_events.rb │ ├── 20150415173132_change_laboratory_location_id_to_geo_id.rb │ ├── 20150415173303_drop_locations_table.rb │ ├── 20150422124002_add_timestamps_to_samples.rb │ ├── 20150508170417_add_time_zone_to_devices.rb │ ├── 20150513175833_add_index_failure_data_to_device_events.rb │ ├── 20150522173544_create_patients.rb │ ├── 20150522180205_add_patient_id_to_samples.rb │ ├── 20150526153400_add_patient_id_to_events.rb │ ├── 20150527160209_add_indexed_fields_to_events.rb │ ├── 20150601165237_rename_events_to_test_results.rb │ ├── 20150601165245_rename_device_events_events_to_device_events_test_results.rb │ ├── 20150601165607_rename_event_id_column_in_device_events_test_results.rb │ ├── 20150601165748_rename_event_id_column_in_test_results.rb │ ├── 20150604132737_rename_secret_key_to_secret_key_hash_in_devices.rb │ ├── 20150604132909_migrate_secret_key_to_secret_key_hash_in_devices.rb │ ├── 20150608182645_rename_device_events_to_device_messages.rb │ ├── 20150608182743_rename_device_events_test_results_to_device_messages_test_results.rb │ ├── 20150608182846_rename_device_event_id_column_in_device_messages_test_results.rb │ ├── 20150624170646_add_custom_mappings_to_devices.rb │ ├── 20150724145211_create_conditions.rb │ ├── 20150728150405_create_encounters.rb │ ├── 20150805180134_use_entity_uid_hash.rb │ ├── 20150805185341_rename_indexed_fields_to_core_fields.rb │ ├── 20150812153349_remove_location_from_policies.rb │ ├── 20150812203030_update_filter_query_parameters.rb │ ├── 20150818200013_add_uuid_to_institutions_and_laboratories.rb │ ├── 20150821200128_set_uuid_for_institutions_and_laboratories.rb │ ├── 20150825150412_add_laboratory_id_to_devices.rb │ ├── 20150901163906_rename.rb │ ├── 20150902154438_add_serial_number_to_devices.rb │ ├── 20150915164518_remove_device_models_manifests.rb │ ├── 20150917174426_create_computed_policies.rb │ ├── 20150921222526_add_delegable_to_computed_policies.rb │ ├── 20150922185638_create_computed_policy_exceptions.rb │ ├── 20150922204816_drop_allow_column_from_computed_policies.rb │ ├── 20150925172725_create_device_logs.rb │ ├── 20150925175941_replace_entity_id_hash_with_entity_id_in_samples.rb │ ├── 20150925180545_fill_entity_id_in_samples.rb │ ├── 20150928142745_add_password_changed_at_to_user.rb │ ├── 20150928183528_add_institution_id_to_device_models.rb │ ├── 20150928201723_create_device_commands.rb │ ├── 20150929100922_create_old_passwords.rb │ ├── 20150929202058_add_not_available_serial_number_to_existing_devices.rb │ ├── 20150930130533_add_condition_device_id_to_computed_policies.rb │ ├── 20151005141913_remove_delegable_from_policies.rb │ ├── 20151005172622_add_kind_to_institutions.rb │ ├── 20151006141255_add_laboratory_and_institution_ids_to_test_results.rb │ ├── 20151006141537_set_laboratory_and_instititution_ids_defaults.rb │ ├── 20151006145712_add_published_at_to_device_models.rb │ ├── 20151008162340_rename_laboratory_to_site.rb │ ├── 20151008205841_add_supports_activation_to_device_model.rb │ ├── 20151013215720_add_locale_to_users.rb │ ├── 20151015221802_add_timestamps_in_device_time_zone_to_users.rb │ ├── 20151016143640_add_time_zone_to_users.rb │ ├── 20151019174509_create_sample_identifiers.rb │ ├── 20151019202219_add_parent_id_and_prefix_to_sites.rb │ ├── 20151020173442_change_resource_id_and_condition_site_id_to_string_in_computed_policies.rb │ ├── 20151026185300_change_resource_id_and_condition_site_id_to_string_in_computed_policy_exceptions.rb │ ├── 20151026193558_add_site_prefix_to_devices_and_test_results.rb │ ├── 20151027172759_create_doorkeeper_tables.rb │ ├── 20151027175111_add_owner_to_application.rb │ ├── 20151029165435_add_support_url_to_device_models.rb │ ├── 20151029184400_add_attachment_picture_to_device_models.rb │ ├── 20151030120316_add_names_to_user.rb │ ├── 20151030211740_rename_entity_id_hash_to_entity_id_in_encounters.rb │ ├── 20151102104047_devise_invitable_add_to_users.rb │ ├── 20151103193538_add_sample_id_reset_policy_to_sites.rb │ ├── 20151104202638_create_test_result_parsed_data.rb │ ├── 20151105211638_add_phantom_flag_to_entities.rb │ ├── 20151110161047_add_deleted_at_to_sites.rb │ ├── 20151116133521_drop_samples_duplicate_index.rb │ ├── 20151116134931_add_site_id_to_sample_identifiers.rb │ ├── 20151118155324_add_deleted_at_to_entities.rb │ ├── 20151119133838_rename_encounter_assay_to_diagnosis.rb │ ├── 20151120181949_add_last_navigation_context_to_users.rb │ ├── 20151123180754_add_attachment_setup_instructions_to_device_models.rb │ ├── 20151123201511_move_activation_tokens_to_devices.rb │ ├── 20151124172252_create_alerts.rb │ ├── 20151125151833_create_roles.rb │ ├── 20151130130846_add_main_phone_number_and_email_address_to_sites.rb │ ├── 20151201150151_add_is_active_flag_to_user.rb │ ├── 20151202174956_add_site_to_encounters.rb │ ├── 20151204105403_add_telephone_to_users.rb │ ├── 20151207120355_add_category_to_alerts.rb │ ├── 20151208152927_add_query_to_alert.rb │ ├── 20151209120802_create_alert_histories.rb │ ├── 20151209165717_add_message_to_alerts.rb │ ├── 20151209174256_create_alert_recipients.rb │ ├── 20151210114431_add_channel_type_to_alerts.rb │ ├── 20151210132301_add_email_to_alert_recipients.rb │ ├── 20151210144138_add_sample_identifier_generation_to_sites.rb │ ├── 20151210181714_add_key_to_roles.rb │ ├── 20151210184357_add_timestamps_to_sample_identifiers.rb │ ├── 20151214171318_add_site_to_alert.rb │ ├── 20151215172107_add.rb │ ├── 20151215172425_add_roles_to_alert_recipients.rb │ ├── 20151216095841_add_aggregation_frequency_to_alerts.rb │ ├── 20151216102356_add_sms_limit_to_alerts.rb │ ├── 20151216135042_create_recipient_notification_histories.rb │ ├── 20151216150910_add_for_aggregation_calculation_to_alert_history.rb │ ├── 20151218123655_add_user_updated_at_to_encounters.rb │ ├── 20151218172251_create_join_table_alert_device.rb │ ├── 20151221103428_remove_site_id_from_alerts.rb │ ├── 20151221105129_create_join_table_alert_site.rb │ ├── 20160104104519_add_anomalie_type_to_alerts.rb │ ├── 20160105165742_add_location_to_patients.rb │ ├── 20160106154918_add_notifty_patients_to_alerts.rb │ ├── 20160108181427_add_name_to_patients.rb │ ├── 20160108194936_add_entity_id_to_patients.rb │ ├── 20160112190503_add_site_prefix_to_encounters.rb │ ├── 20160113171706_add_recipient_type_to_alert_recipients.rb │ ├── 20160114154732_add_start_time_to_encounters.rb │ ├── 20160115131955_add_site_id_site_prefix_to_patients.rb │ ├── 20160115135130_add_sms_message_to_alerts.rb │ ├── 20160120213220_create_file_messages.rb │ ├── 20160120214128_add_ftp_info_to_devices.rb │ ├── 20160120214202_add_ftp_flag_to_device_models.rb │ ├── 20160125112341_add_sms_to_recipient_notification_histories.rb │ ├── 20160125134622_add_filename_pattern_to_device_models.rb │ ├── 20160128123511_add_deleted_at_to_alerts.rb │ ├── 20160203094023_create_join_table_alert_condition.rb │ ├── 20160203095033_create_alert_condition_results.rb │ ├── 20160203103630_add_alert_to_alert_condition_results.rb │ ├── 20160203150350_add_threshold_to_alerts.rb │ ├── 20160203230132_add_include_subsites_to_computed_policies.rb │ ├── 20160204091551_add_aggregation_threshold_to_alerts.rb │ ├── 20160205154644_add_sample_id_to_alerts.rb │ ├── 20160210163103_add_utilization_efficiency_to_alerts.rb │ ├── 20160210191011_add_site_id_to_device_message.rb │ ├── 20160210193741_set_site_id_in_device_messages.rb │ ├── 20160215195614_add_deleted_at_to_devices.rb │ ├── 20160218104352_add_email_limit_to_alerts.rb │ ├── 20160223111818_add_deleted_at_to_alert_recipients.rb │ ├── 20160301180433_add_site_prefix_to_role.rb │ ├── 20160307144244_add_use_aggregation_percentage_to_alerts.rb │ ├── 20160308134157_add_institution_to_alerts.rb │ ├── 20160309161106_add_time_last_aggregation_checked_to_alerts.rb │ ├── 20160310151033_add_test_result_updated_at_to_alert_histories.rb │ ├── 20160317204732_add_ftp_passive_to_devices.rb │ ├── 20160318120245_add_ftp_passive_to_file_messages.rb │ ├── 20160322190646_add_sidebar_open_to_users.rb │ ├── 20160405192357_add_allows_manual_entry_to_site.rb │ ├── 20210424172045_create_laboratory_samples.rb │ ├── 20210425195132_add_type_to_laboratory_samples.rb │ ├── 20210505201523_add_institution_to_laboratory_samples.rb │ ├── 20210519210302_add_entity_fields_to_laboratory_sample.rb │ ├── 20210521174932_create_batches.rb │ ├── 20210527215913_add_batch_to_laboratory_samples.rb │ ├── 20210603195140_remove_sample_type_from_laboratory_samples.rb │ ├── 20210614142904_create_test_qc_results.rb │ ├── 20210616220513_create_test_qc_result_assays.rb │ ├── 20210617115609_add_batch_number_to_batches.rb │ ├── 20210618125427_create_notes.rb │ ├── 20210701173411_add_isolate_name_to_laboratory_samples.rb │ ├── 20210710205858_add_batch_to_samples.rb │ ├── 20210711204458_add_sample_to_notes.rb │ ├── 20210711225220_create_assays.rb │ ├── 20210712213544_remove_laboratory_samples_and_test_qc_assays.rb │ ├── 20210719114233_add_isolate_name_to_samples.rb │ ├── 20210727162118_rename_assays_to_assay_attachments.rb │ ├── 20210727193447_add_loinc_code_and_result_to_assay_attachments.rb │ ├── 20210803151121_create_loinc_codes.rb │ ├── 20210805192509_remove_loinc_code_from_assay_attachments.rb │ ├── 20210806231327_add_loinc_code_to_assay_attachments.rb │ ├── 20210922233855_add_site_to_samples.rb │ ├── 20210924033359_add_site_to_batches.rb │ ├── 20211026021110_create_assay_file.rb │ ├── 20211028075009_add_assay_file_to_assay_attachments.rb │ ├── 20211104135226_migrate_assay_attachment_pictures_to_assay_file.rb │ ├── 20211201171200_add_specimen_role_to_samples.rb │ ├── 20211201181600_migrate_specimen_role.rb │ ├── 20211201221707_add_date_produced_to_batches.rb │ ├── 20211201224317_migrate_date_produced_in_batches.rb │ ├── 20211217152414_normalize_specimen_role_and_date_produced_samples.rb │ ├── 20211217160437_normalize_specimen_role_and_date_produced_batches.rb │ ├── 20220114191522_create_pending_institution_invites.rb │ ├── 20220114191523_add_pending_institution_invites_to_institutions.rb │ ├── 20220216134506_add_old_batch_number_to_samples.rb │ ├── 20220217152217_create_qc_infos.rb │ ├── 20220221152647_create_sample_transfers.rb │ ├── 20220222115959_add_qc_info_id_to_samples_notes_assays.rb │ ├── 20220331164557_create_transfer_packages.rb │ ├── 20220407173015_add_timestamps_to_transfer_packages.rb │ ├── 20220408103851_add_sender_institution_to_transfer_packages.rb │ ├── 20220412181435_change_sample_transfers_requires_transfer_package.rb │ ├── 20220503160512_create_boxes.rb │ ├── 20220505070823_add_confirmed_at_to_transfer_packages.rb │ ├── 20220513214928_convert_database_to_utf8_mb4.rb │ ├── 20220519121619_create_box_transfers.rb │ ├── 20220519135949_change_box_institution_null.rb │ ├── 20220531133731_add_blinded_to_boxes.rb │ ├── 20220531182313_drop_sample_transfers.rb │ ├── 20220602170219_add_indices_to_transfer_packages.rb │ ├── 20221109105200_change_sample_concentrations_to_single_value.rb │ ├── 20221125112700_create_samples_reports.rb │ ├── 20221223200957_add_distractor_to_samples.rb │ ├── 20221223203602_add_instruction_to_samples.rb │ ├── 20230731140544_fix_samples_measured_signals.rb │ └── 20231030102203_add_original_batch_id_to_samples.rb ├── schema.rb ├── seeds.rb └── seeds │ └── manifests │ ├── alere_pima_manifest.json │ ├── alere_q_manifest.json │ ├── deki_reader_manifest.json │ ├── epicenter_m.g.i.t._spanish_manifest.json │ ├── esequant_lr3_manifest.json │ ├── genexpert_csv_manifest.json │ ├── genexpert_manifest.json │ ├── genoscan_manifest.json │ └── micro_imager_manifest.json ├── deps ├── cdx-api-elasticsearch │ ├── LICENSE.txt │ ├── README.md │ ├── config │ │ └── cdx_api_fields.yml │ └── lib │ │ └── cdx │ │ └── api │ │ ├── elasticsearch.rb │ │ ├── elasticsearch │ │ ├── aggregations.rb │ │ ├── cdx_document_format.rb │ │ ├── config.rb │ │ ├── grouping │ │ │ ├── date_grouping_detail.rb │ │ │ ├── duration_grouping_detail.rb │ │ │ ├── flat_grouping_detail.rb │ │ │ ├── grouping_detail.rb │ │ │ ├── location_grouping_detail.rb │ │ │ ├── nested_grouping_detail.rb │ │ │ ├── range_grouping_detail.rb │ │ │ └── reference_table.rb │ │ ├── indexed_field.rb │ │ ├── local_timezone_conversion.rb │ │ ├── mapping_template.rb │ │ ├── model │ │ │ ├── field.rb │ │ │ └── scope.rb │ │ ├── multi_query.rb │ │ ├── null_query.rb │ │ ├── query.rb │ │ └── version.rb │ │ └── service.rb └── cdx_core │ ├── LICENSE.txt │ ├── README.md │ └── lib │ ├── cdx.rb │ ├── cdx │ ├── field.rb │ ├── fields.rb │ ├── scope.rb │ └── version.rb │ └── config │ └── fields.yml ├── docker-compose.base.yml ├── docker-compose.ci.yml ├── docker-compose.dev.yml ├── docker-compose.prod.yml ├── docker-compose.yml ├── docker-dev.env ├── docker ├── config-nndd └── web-run ├── etc ├── nndd │ ├── overrides.css │ └── overrides.js └── shapes │ └── .gitkeep ├── features ├── admin_invite_user.feature ├── alert.feature ├── incidents.feature ├── login.feature ├── password_reset.feature ├── step_definitions │ ├── .gitkeep │ ├── admin_invite_user_steps.rb │ ├── alert_steps.rb │ ├── incident_steps.rb │ ├── login_steps.rb │ └── password_reset_steps.rb └── support │ ├── alert_cucumber_helper.rb │ ├── env.rb │ ├── helpers.rb │ └── page_objects │ ├── alerts_index_page.rb │ ├── cdx_checkbox.rb │ ├── cdx_page_base.rb │ ├── cdx_page_helper.rb │ ├── cdx_select.rb │ ├── cdx_table.rb │ ├── dashboard_page.rb │ ├── device_model_page.rb │ ├── device_page.rb │ ├── edit_alert_page.rb │ ├── file_input.rb │ ├── home_page.rb │ ├── incident_page.rb │ ├── institution_page.rb │ ├── item_search_page.rb │ ├── login_page.rb │ ├── new_alert_page.rb │ ├── new_box_page.rb │ ├── new_encounter_page.rb │ ├── new_patient_page.rb │ ├── password_change.rb │ ├── patient_page.rb │ ├── policy_page.rb │ ├── roles_page.rb │ ├── samples_page.rb │ ├── show_encounter_page.rb │ ├── site_view_page.rb │ ├── test_results_page.rb │ ├── tests_run.rb │ ├── transfer_package_page.rb │ └── user_view_page.rb ├── lib ├── alerts.rb ├── assets │ └── .keep ├── delegate_missing_to.rb ├── demo_data.rb ├── extras │ ├── location_from_geojson.rb │ └── nndd_shape_importer.rb ├── reports.rb ├── reports │ ├── all_tests.rb │ ├── base.rb │ ├── device_errors.rb │ ├── devices.rb │ ├── errors.rb │ ├── grouped.rb │ ├── model_errors.rb │ ├── successful.rb │ └── unsuccessful.rb ├── ruby_dig.rb ├── sms.rb └── tasks │ ├── .keep │ ├── assay_files.rake │ ├── batches_info.rake │ ├── coverage.rake │ ├── cucumber.rake │ ├── db.rake │ ├── demo_data.rake │ ├── elasticsearch.rake │ ├── encryption.rake │ ├── ftp_monitor.rake │ ├── load_csv.rake │ ├── load_institutions.rake │ ├── load_manifests.rake │ ├── policy.rake │ ├── site.rake │ └── watch_csv.rake ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico ├── favicon.png ├── polygons │ └── .gitkeep ├── robots.txt ├── sample_acl.json └── templates │ ├── Instructions.txt │ ├── upload_box.csv │ └── upload_sample_results.csv ├── script ├── cucumber └── loinc_codes │ ├── LoincTableCore.csv │ └── import_csv.rb ├── spec ├── controllers │ ├── api │ │ ├── activations_controller_spec.rb │ │ ├── encounters_controller_spec.rb │ │ ├── filtrs_controller_spec.rb │ │ ├── institutions_controller_spec.rb │ │ ├── messages_controller_auth_spec.rb │ │ ├── messages_controller_creation_spec.rb │ │ ├── messages_controller_locations_spec.rb │ │ ├── sites_controller_spec.rb │ │ ├── subscribers_controller.rb │ │ ├── tests_controller_locations_spec.rb │ │ └── tests_controller_query_spec.rb │ ├── batches_controller_spec.rb │ ├── boxes_controller_spec.rb │ ├── device_commands_controller_spec.rb │ ├── device_logs_controller_spec.rb │ ├── device_messages_controller_spec.rb │ ├── device_models_controller_spec.rb │ ├── devices_controller_spec.rb │ ├── encounters_controller_spec.rb │ ├── filters_controller_spec.rb │ ├── institutions_controller_spec.rb │ ├── invitations_controller_spec.rb │ ├── nih_tables_controller_spec.rb │ ├── patients_controller_spec.rb │ ├── registrations_controller_spec.rb │ ├── roles_controller_spec.rb │ ├── samples_controller_spec.rb │ ├── samples_reports_controller_spec.rb │ ├── sites_controller_spec.rb │ ├── subscribers_controller_spec.rb │ ├── test_results_controller_spec.rb │ ├── transfer_packages_controller_spec.rb │ └── users_controller_spec.rb ├── features │ ├── boxes_spec.rb │ ├── deleted_spec.rb │ ├── device_model_spec.rb │ ├── device_spec.rb │ ├── encounter_spec.rb │ ├── invitation_spec.rb │ ├── navigation_context_spec.rb │ ├── patient_spec.rb │ ├── performance_spec.rb │ ├── policy_spec.rb │ ├── roles_spec.rb │ ├── transfer_packages_spec.rb │ └── welcome_spec.rb ├── fixtures │ ├── csvs │ │ ├── alere_pima.csv │ │ ├── alere_q.csv │ │ ├── alere_q.csv.zip │ │ ├── csv_box_1.csv │ │ ├── csv_box_2.csv │ │ ├── csv_box_no_headers.csv │ │ ├── epicenter_headless_sample.csv │ │ ├── epicenter_headless_sample_utf16.csv │ │ ├── epicenter_sample.csv │ │ ├── genoscan_sample.csv │ │ ├── samples_results_1.csv │ │ └── samples_results_2.csv │ ├── jsons │ │ ├── genexpert_sample.json │ │ ├── genexpert_sample_mtb_very_low.json │ │ ├── genexpert_sample_qc.json │ │ └── micro_imager_sample.json │ └── xmls │ │ └── deki_reader_sample.xml ├── helpers │ ├── alerts_helper.rb │ ├── cdx_form_helper_spec.rb │ ├── mailer_helper_spec.rb │ └── users_helper_spec.rb ├── jobs │ ├── daily_demo_data_spec.rb │ ├── hourly_alert_job_spec.rb │ └── hourly_utilization_efficiency_job.rb ├── lib │ ├── alerts_spec.rb │ ├── reports │ │ ├── all_tests_spec.rb │ │ ├── base_spec.rb │ │ ├── device_spec.rb │ │ ├── error_spec.rb │ │ └── grouped_spec.rb │ └── sms_spec.rb ├── mailers │ ├── alert_mailer_list_spec.rb │ ├── alert_mailer_spec.rb │ ├── device_mailer_spec.rb │ ├── invitation_mailer_spec.rb │ └── previews │ │ ├── alert_mailer_preview.rb │ │ ├── device_mailer_preview.rb │ │ └── invitation_mailer_preview.rb ├── models │ ├── activation_token_spec.rb │ ├── alert_recipient_spec.rb │ ├── alert_spec.rb │ ├── assay_attachment_spec.rb │ ├── blender_spec.rb │ ├── cdx_api_elasticsearch_mapping_template_spec.rb │ ├── cdx_api_multi_spec.rb │ ├── cdx_api_spec.rb │ ├── cdx_spec.rb │ ├── computed_policy_spec.rb │ ├── condition_spec.rb │ ├── csv_builder_spec.rb │ ├── csv_message_parser_spec.rb │ ├── device_message_importer_spec.rb │ ├── device_message_processor_spec.rb │ ├── device_message_spec.rb │ ├── device_model_spec.rb │ ├── device_spec.rb │ ├── encounter_indexer_spec.rb │ ├── encounter_spec.rb │ ├── encounters_schema_spec.rb │ ├── field_spec.rb │ ├── ftp_monitor_spec.rb │ ├── institution_spec.rb │ ├── json_message_parser_spec.rb │ ├── local_timezone_conversion_spec.rb │ ├── manifest_application_spec.rb │ ├── manifest_creation_spec.rb │ ├── manifest_field_mapping_spec.rb │ ├── manifest_operations_spec.rb │ ├── manifest_validations_spec.rb │ ├── message_encryption_spec.rb │ ├── patient_spec.rb │ ├── policy_spec.rb │ ├── query_spec.rb │ ├── resource_spec.rb │ ├── role_spec.rb │ ├── sample_identifier_spec.rb │ ├── sample_spec.rb │ ├── samples_report_spec.rb │ ├── site_spec.rb │ ├── ssh_key_spec.rb │ ├── subscriber_spec.rb │ ├── test_result_indexer_spec.rb │ ├── test_result_query_spec.rb │ ├── test_result_spec.rb │ ├── tests_schema_spec.rb │ ├── transfer_package_spec.rb │ ├── user_spec.rb │ └── xml_message_parser_spec.rb ├── policy_spec_helper.rb ├── spec_helper.rb └── support │ ├── blueprints.rb │ ├── capybara.rb │ ├── cdx_api_helpers.rb │ ├── cdx_fields_helper.rb │ ├── database_cleaner.rb │ ├── default_manifest.rb │ ├── default_params_helper.rb │ ├── device_message_spec_helper.rb │ ├── device_spec_helper.rb │ ├── elasticsearch_context.rb │ ├── feature_spec_helpers.rb │ ├── manifest_spec_helper.rb │ ├── manifest_validation_context.rb │ ├── spec_fixtures.rb │ ├── test_result_spec_helper.rb │ └── uploaded_file_helper.rb ├── tmp └── docker │ └── .keep └── vendor └── assets ├── images ├── geocoder.png └── throbber.gif ├── javascripts ├── .keep ├── Leaflet.Sleep.js ├── classnames.js ├── jquery.are-you-sure.js ├── jquery.autocomplete.js ├── jquery.custom-file-input.js ├── leaflet-control-geocoder.js ├── react-autosuggest.js ├── react-dom.js ├── react-input-autosize.js ├── react-leaflet.js ├── react-select.js └── reflux.js └── stylesheets └── .keep /.dockerignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | .git 3 | tmp 4 | log 5 | etc/shapes 6 | -------------------------------------------------------------------------------- /.es_version: -------------------------------------------------------------------------------- 1 | 1.7.4 2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --format progress 4 | --format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log 5 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.4.10 2 | -------------------------------------------------------------------------------- /Dockerfile.selenium: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories 4 | RUN apk add firefox-esr geckodriver 5 | RUN ln -sf /usr/bin/firefox-esr /usr/bin/firefox 6 | 7 | EXPOSE 4444 8 | EXPOSE 5900 9 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/fonts/OpenSans/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/fonts/OpenSans/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Roboto/RobotoMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/fonts/Roboto/RobotoMono-Bold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Roboto/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/fonts/Roboto/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/arr-select-down-inv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arr-select-down-inv.png -------------------------------------------------------------------------------- /app/assets/images/arr-select-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arr-select-down.png -------------------------------------------------------------------------------- /app/assets/images/arr-select-right-inv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arr-select-right-inv.png -------------------------------------------------------------------------------- /app/assets/images/arr-select-up-inv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arr-select-up-inv.png -------------------------------------------------------------------------------- /app/assets/images/arr-select-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arr-select-up.png -------------------------------------------------------------------------------- /app/assets/images/arrow-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arrow-down.png -------------------------------------------------------------------------------- /app/assets/images/arrow-left-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arrow-left-white.png -------------------------------------------------------------------------------- /app/assets/images/arrow-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arrow-left.png -------------------------------------------------------------------------------- /app/assets/images/arrow-top-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/arrow-top-header.png -------------------------------------------------------------------------------- /app/assets/images/assay-results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/assay-results.png -------------------------------------------------------------------------------- /app/assets/images/card-unkown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/card-unkown.png -------------------------------------------------------------------------------- /app/assets/images/cdp_platform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/cdp_platform.png -------------------------------------------------------------------------------- /app/assets/images/cdx-logo-bw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/cdx-logo-bw.png -------------------------------------------------------------------------------- /app/assets/images/cdx-logo-med.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/cdx-logo-med.png -------------------------------------------------------------------------------- /app/assets/images/cdx-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/cdx-logo.png -------------------------------------------------------------------------------- /app/assets/images/checkmark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/genexpert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/genexpert.png -------------------------------------------------------------------------------- /app/assets/images/ic-cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-cross.png -------------------------------------------------------------------------------- /app/assets/images/ic-email-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-email-black.png -------------------------------------------------------------------------------- /app/assets/images/ic-health-organization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-health-organization.png -------------------------------------------------------------------------------- /app/assets/images/ic-institution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-institution.png -------------------------------------------------------------------------------- /app/assets/images/ic-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-login.png -------------------------------------------------------------------------------- /app/assets/images/ic-manufacturer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-manufacturer.png -------------------------------------------------------------------------------- /app/assets/images/ic-negative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-negative.png -------------------------------------------------------------------------------- /app/assets/images/ic-on-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-on-off.png -------------------------------------------------------------------------------- /app/assets/images/ic-pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-pencil.png -------------------------------------------------------------------------------- /app/assets/images/ic-positive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-positive.png -------------------------------------------------------------------------------- /app/assets/images/ic-search-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-search-blue.png -------------------------------------------------------------------------------- /app/assets/images/ic-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/ic-search.png -------------------------------------------------------------------------------- /app/assets/images/icons-140x140-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/icons-140x140-black.png -------------------------------------------------------------------------------- /app/assets/images/icons-20x20-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/icons-20x20-black.png -------------------------------------------------------------------------------- /app/assets/images/icons-20x20-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/icons-20x20-blue.png -------------------------------------------------------------------------------- /app/assets/images/icons-20x20-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/icons-20x20-white.png -------------------------------------------------------------------------------- /app/assets/images/icons/alert.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/algorithm.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/arrow-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/arrow-left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/arrow-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/arrow-up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/ascending.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/barchart.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/bell.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/cartridge.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/check.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/check_circle.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/checkbox-outline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/checkbox-selected.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/circle-minus-outline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/circle-minus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/circle-plus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/close.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/collpase.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/comment.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/copy.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/delete-circle.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/images/icons/descending.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/document.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/download.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/error.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/ethernet.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/expand.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/forward.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/horizontal-thumb-fill.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/horizontal-thumb-outline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/info.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/keyboard-arrow-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/keyboard-arrow-left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/keyboard-arrow-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/keyboard-arrow-up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/local_shipping.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/location.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/mail.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/map.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/microscope.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/notification.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/outline-alert.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/outline-email.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/pencil.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/plus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/print.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/radio-button-outline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/search.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/send.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/strip.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/table.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/test-tube.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/test.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/tick.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/transfer.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/trash.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/trend.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/upload.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/user.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/icons/wrap.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/user-invite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/images/user-invite.png -------------------------------------------------------------------------------- /app/assets/javascripts/actions/AlertActions.js.jsx: -------------------------------------------------------------------------------- 1 | var AlertActions = Reflux.createActions([ 2 | 'createAlert', 3 | 'updateAlert', 4 | 'deleteAlert' 5 | ]); 6 | -------------------------------------------------------------------------------- /app/assets/javascripts/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/app/assets/javascripts/components/.gitkeep -------------------------------------------------------------------------------- /app/assets/javascripts/components/layout.js.jsx: -------------------------------------------------------------------------------- 1 | var FlexFullRow = React.createClass({ 2 | render: function() { 3 | return ( 4 |
Hello <%= @resource.email %>!
2 | 3 |Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 | 5 |Click the link below to unlock your account:
6 | 7 |<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
8 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.haml: -------------------------------------------------------------------------------- 1 | .row 2 | .col 3 | %h1 Resend unlock instructions 4 | = cdx_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| 5 | .row 6 | .col 7 | = f.email_field :email, autofocus: true, placeholder: 'Email', class: "input-block" 8 | = f.field_errors :unconfirmed_email 9 | %br 10 | .row 11 | .col 12 | = f.submit "Resend unlock instructions", class: "btn-secondary input-block" 13 | -------------------------------------------------------------------------------- /app/views/filters/edit.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to filters_path(@device), class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | #{filter.name} 10 | 11 | = render 'form' 12 | 13 | -------------------------------------------------------------------------------- /app/views/filters/new.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to filters_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Filter 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/form_builder/_field.haml: -------------------------------------------------------------------------------- 1 | .row.form-field{class: "#{form.has_error?(method) ? "form-field--error " : ""}form-field--#{method}" } 2 | .col.form-field__label 3 | - label_options = options[:label] || {} 4 | = form.label method, label_options[:text], label_options 5 | .col 6 | = yield 7 | = form.field_errors method, full_message: options[:full_message] 8 | -------------------------------------------------------------------------------- /app/views/form_builder/_field_errors.haml: -------------------------------------------------------------------------------- 1 | .field-errors 2 | %ul.errors 3 | - messages.each do |message| 4 | %li 5 | = message 6 | -------------------------------------------------------------------------------- /app/views/form_builder/_form_actions.haml: -------------------------------------------------------------------------------- 1 | .row.button-actions 2 | .col 3 | = yield 4 | -------------------------------------------------------------------------------- /app/views/form_builder/_form_errors.haml: -------------------------------------------------------------------------------- 1 | - if form.has_errors? 2 | .row.form-errors 3 | .col{style: "flex-grow: 0; padding-right: 0;"} 4 | %span.icon.icon-alert.icon-red 5 | .col 6 | %strong 7 | The form contains errors. Try to fix them and submit again. 8 | 9 | - unless messages.empty? 10 | %ul.errors 11 | - messages.each do |message| 12 | %li 13 | = message 14 | -------------------------------------------------------------------------------- /app/views/home/index.haml: -------------------------------------------------------------------------------- 1 | %h3 This is CDP's home. 2 | 3 | - unless current_user 4 | Please 5 | = link_to "Sign in", new_session_path(:user) 6 | -------------------------------------------------------------------------------- /app/views/home/verify.haml: -------------------------------------------------------------------------------- 1 | .message 2 | = image_tag "ic-email-black.png" 3 | %h1 4 | Check your email to verify your account 5 | %small 6 | Look for email with the subject "CDX account verification" 7 | -------------------------------------------------------------------------------- /app/views/institutions/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@institutions) do |institution| 2 | json.extract! institution, :id, :name, :user_id 3 | json.url institution_url(institution, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/institutions/new.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | - unless @institutions.size == 0 8 | = link_to institutions_path, class: 'side-link', title: 'Back' do 9 | = image_tag "arrow-left-white.png" 10 | New Institution 11 | 12 | = render 'form' 13 | -------------------------------------------------------------------------------- /app/views/institutions/no_data_allowed.haml: -------------------------------------------------------------------------------- 1 | %h1 You have no access to data of the selected institution. 2 | -------------------------------------------------------------------------------- /app/views/institutions/pending_approval.haml: -------------------------------------------------------------------------------- 1 | .message 2 | = image_tag "ic-email-black.png" 3 | %h1 4 | Please contact your system's administrator 5 | %small 6 | Your account needs to be activated in order to have access to the system 7 | -------------------------------------------------------------------------------- /app/views/layouts/clean.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | %html 3 | %head 4 | %title Connected Diagnostics Platform 5 | = Gon::Base.render_data({}) 6 | = stylesheet_link_tag "application", :media => "all" 7 | = javascript_include_tag "application" 8 | = csrf_meta_tags 9 | %body.devise{class: @body_class} 10 | .wrapper 11 | 12 | .row.center 13 | = content_for?(:cdp_content) ? yield(:cdp_content) : yield 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.haml: -------------------------------------------------------------------------------- 1 | = yield 2 | -------------------------------------------------------------------------------- /app/views/locations/index.html.haml: -------------------------------------------------------------------------------- 1 | .row 2 | .col 3 | %table.table 4 | %tr 5 | %th.tableheader{colspan:100} Locations 6 | %tr 7 | %th Name 8 | - @locations.each do |location| 9 | %tr 10 | %td= link_to location.name, locations_path(parent_id: location.id) 11 | 12 | -------------------------------------------------------------------------------- /app/views/locations/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@locations) do |location| 2 | json.extract! location, :id, :name 3 | json.url location_url(location, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/locations/show.html.haml: -------------------------------------------------------------------------------- 1 | %p#notice= notice 2 | 3 | %h3 #{@location.name} 4 | - if @location.parent 5 | %p 6 | %b Parent: 7 | = @location.parent.name 8 | %p 9 | %b Admin level: 10 | = "#{@location.type} (#{@location.admin_level})" 11 | 12 | 13 | .actions 14 | = link_to 'Back', locations_path 15 | -------------------------------------------------------------------------------- /app/views/locations/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @location, :id, :name, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/patients/edit.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to patients_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | = @patient.name 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/patients/new.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to patients_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Patient 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/policies/edit.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to policies_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | #{@policy.name} 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/policies/new.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to policies_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Policy 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/qc_infos/_show_notes.haml: -------------------------------------------------------------------------------- 1 | = f.form_field :notes do 2 | #notes 3 | = f.fields_for :notes do |note| 4 | .note 5 | .info 6 | = "by #{note.object.user.full_name} #{@localization_helper.format_datetime(note.object.updated_at)} " 7 | .description 8 | = note.object.description 9 | .dashed-line 10 | -------------------------------------------------------------------------------- /app/views/qc_infos/edit.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to edit_sample_path(id: params[:sample_id]), class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | = @qc_info.uuid 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/roles/edit.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to roles_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | = @role.name 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/roles/new.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to roles_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Role 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/samples/_index_js.haml: -------------------------------------------------------------------------------- 1 | :javascript 2 | function checkboxesName() { 3 | return "sample_ids[]"; 4 | } 5 | 6 | function actionsId() { 7 | return [ 8 | "bulk_print", 9 | "bulk_destroy", 10 | "bulk_transfer" 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /app/views/samples/_show_notes.haml: -------------------------------------------------------------------------------- 1 | .row 2 | .col.pe-2 3 | = f.label :notes 4 | #notes.col 5 | = f.fields_for :notes do |note| 6 | .note 7 | .info 8 | = "by #{note.object.user.full_name} #{@localization_helper.format_datetime(note.object.updated_at)} " 9 | .description 10 | = note.object.description 11 | .dashed-line 12 | -------------------------------------------------------------------------------- /app/views/samples/autocomplete.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@samples) do |sample| 2 | json.uuid sample.uuid 3 | json.batch_number sample.batch_number 4 | json.concentration sample.concentration 5 | end 6 | -------------------------------------------------------------------------------- /app/views/samples/edit.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to @view_helper[:back_path], class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | = @sample_form.uuid 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/samples/new.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to @view_helper[:back_path], class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Sample 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/samples_reports/new.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to samples_reports_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Report 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/shared/_footer.haml: -------------------------------------------------------------------------------- 1 | Version: #{Rails.application.config.version_name} 2 | -------------------------------------------------------------------------------- /app/views/shared/_list.haml: -------------------------------------------------------------------------------- 1 | .selector-list-item 2 | = yield 3 | -------------------------------------------------------------------------------- /app/views/shared/_validation_errors.html.haml: -------------------------------------------------------------------------------- 1 | .alert-container 2 | .alert.alert-error 3 | %ul 4 | - model.errors.full_messages.each do |msg| 5 | %li= msg 6 | -------------------------------------------------------------------------------- /app/views/sites/edit.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2{entity_html_options(@site)} 7 | = link_to sites_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | = @site.name 10 | 11 | - if @can_move 12 | = render 'form' 13 | - else 14 | = render 'show' 15 | -------------------------------------------------------------------------------- /app/views/sites/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@sites) do |site| 2 | json.extract! site, :id 3 | json.url site_url(site, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/sites/new.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to sites_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Site 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/subscribers/edit.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to subscribers_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | #{subscriber.name} 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/subscribers/new.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to subscribers_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | New Subscriber 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/transfer_packages/new.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.add-new 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to @view_helper[:back_path], class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left-white.png" 9 | Send boxes 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/users/edit.html.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.edit 3 | .col.pe-10 4 | .row 5 | .col 6 | %h2 7 | = link_to users_path, class: 'side-link', title: 'Back' do 8 | = image_tag "arrow-left.png" 9 | = @user.email 10 | 11 | = render 'form' 12 | -------------------------------------------------------------------------------- /app/views/users/invitations/new.html.erb: -------------------------------------------------------------------------------- 1 |<%= f.label field %>
8 | <%= f.text_field field %>
<%= f.submit t("devise.invitations.new.submit_button") %>
12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/users/no_data_allowed.haml: -------------------------------------------------------------------------------- 1 | - content_for(:subheader) do 2 | .row.center.filters 3 | .col.pe-10 4 | .row 5 | .col 6 | %h1 7 | Users 8 | .row 9 | .col 10 | = empty_data icon: 'outline-user' do |c| 11 | - c.body do 12 | %h1 You have no access to users of the selected institution. 13 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/cucumber.yml: -------------------------------------------------------------------------------- 1 | <% 2 | rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" 3 | rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" 4 | std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" 5 | %> 6 | default: <%= std_opts %> features 7 | wip: --tags @wip:3 --wip features 8 | rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip 9 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /config/initializers/backports.rb: -------------------------------------------------------------------------------- 1 | require "delegate_missing_to" 2 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/config.rb: -------------------------------------------------------------------------------- 1 | Config.setup do |config| 2 | config.use_env = true 3 | config.env_prefix = "SETTINGS" 4 | config.env_separator = '__' 5 | config.env_converter = :downcase 6 | config.env_parse_values = true 7 | end 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/hash.rb: -------------------------------------------------------------------------------- 1 | class Hash 2 | 3 | def deep_merge_not_nil!(hash) 4 | self.deep_merge!(hash) { |key, v1, v2| v2.nil? ? v1 : v2 } 5 | end 6 | 7 | def reverse_deep_merge!(other_hash) 8 | replace(other_hash.deep_merge(self)) 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/libs.rb: -------------------------------------------------------------------------------- 1 | require "#{Rails.root}/lib/extras/nndd_shape_importer" 2 | require "#{Rails.root}/lib/extras/location_from_geojson" 3 | -------------------------------------------------------------------------------- /config/initializers/location_service.rb: -------------------------------------------------------------------------------- 1 | LocationService.setup do |config| 2 | config.url = Settings.location_service_url 3 | config.set = Settings.location_service_set 4 | config.logger = Rails.logger 5 | end 6 | 7 | Location 8 | require File.join("#{Rails.root}", 'app/models/location') 9 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/oj.rb: -------------------------------------------------------------------------------- 1 | # TODO: Upgrade to oj 3.10.1 to leverage Oj.optimize_rails to automatically 2 | # override JSON and ActiveSupport::JSON with full compatibility. 3 | Oj.default_options = {mode: :compat} 4 | -------------------------------------------------------------------------------- /config/initializers/recaptcha.rb: -------------------------------------------------------------------------------- 1 | if Settings.recaptcha.enabled 2 | Recaptcha.configure do |config| 3 | config.site_key = Settings.recaptcha.site_key 4 | config.secret_key = Settings.recaptcha.secret_key 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_cdp_session' 4 | -------------------------------------------------------------------------------- /config/initializers/string.rb: -------------------------------------------------------------------------------- 1 | class String 2 | def resource_name 3 | self 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /config/initializers/sync.rb: -------------------------------------------------------------------------------- 1 | require 'cdx_sync' 2 | 3 | CDXSync.instance_eval do 4 | 5 | def default_sync_dir_path 6 | Rails.application.config.sync_dir_path 7 | end 8 | 9 | def default_authorized_keys_path 10 | Rails.application.config.authorized_keys_path 11 | end 12 | 13 | # This path is relative to dockerized 14 | # cdx-sync-sshd filesystem 15 | def rrsync_location 16 | '/usr/local/bin/rrsync' 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /config/initializers/tempfile_reaper.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.middleware.use Rack::TempfileReaper 2 | -------------------------------------------------------------------------------- /config/initializers/version.rb: -------------------------------------------------------------------------------- 1 | RevisionFilePath = "#{::Rails.root.to_s}/REVISION" 2 | VersionFilePath = "#{::Rails.root.to_s}/VERSION" 3 | 4 | version = if Settings.app_version.presence 5 | Settings.app_version 6 | elsif FileTest.exists?(VersionFilePath) 7 | IO.read(VersionFilePath) 8 | elsif FileTest.exists?(RevisionFilePath) 9 | IO.read(RevisionFilePath) 10 | else 11 | "latest" 12 | end 13 | 14 | Rails.application.config.version_name = version 15 | -------------------------------------------------------------------------------- /config/settings/development.yml: -------------------------------------------------------------------------------- 1 | nndd_url: "http://localhost:9000" 2 | location_service_url: "http://locations-stg.instedd.org" 3 | -------------------------------------------------------------------------------- /config/settings/production.yml: -------------------------------------------------------------------------------- 1 | web_session_timeout: 300 2 | user_password_expire_in_months: 3 3 | -------------------------------------------------------------------------------- /config/settings/test.yml: -------------------------------------------------------------------------------- 1 | location_service_url: "http://locations.instedd.org" 2 | location_service_set: "test" 3 | web_session_timeout: 120 4 | user_password_expire_in_months: 3 5 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /db/migrate/20140203233601_create_work_groups.rb: -------------------------------------------------------------------------------- 1 | class CreateWorkGroups < ActiveRecord::Migration 2 | def change 3 | create_table :work_groups do |t| 4 | t.string :name 5 | t.references :user, index: true 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140203234745_create_facilities.rb: -------------------------------------------------------------------------------- 1 | class CreateFacilities < ActiveRecord::Migration 2 | def change 3 | create_table :facilities do |t| 4 | t.string :name 5 | t.references :work_group, index: true 6 | t.string :index_name 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140204134837_create_subscribers.rb: -------------------------------------------------------------------------------- 1 | class CreateSubscribers < ActiveRecord::Migration 2 | def change 3 | create_table :subscribers do |t| 4 | t.string :name 5 | t.string :callback_url 6 | t.references :work_group, index: true 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140312115721_delete_facilities_index_name.rb: -------------------------------------------------------------------------------- 1 | class DeleteFacilitiesIndexName < ActiveRecord::Migration 2 | def change 3 | remove_column :facilities, :index_name 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140312144328_add_auth_token_to_subscribers.rb: -------------------------------------------------------------------------------- 1 | class AddAuthTokenToSubscribers < ActiveRecord::Migration 2 | def change 3 | add_column :subscribers, :auth_token, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140325195841_rename_facility_to_device.rb: -------------------------------------------------------------------------------- 1 | class RenameFacilityToDevice < ActiveRecord::Migration 2 | def change 3 | rename_table :facilities, :devices 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140326151525_create_reports.rb: -------------------------------------------------------------------------------- 1 | class CreateReports < ActiveRecord::Migration 2 | def change 3 | create_table :reports do |t| 4 | t.integer :work_group_id 5 | t.integer :device_id 6 | t.binary :data 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140326191422_add_secret_key_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddSecretKeyToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :secret_key, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140404172012_rename_reports_to_test_results.rb: -------------------------------------------------------------------------------- 1 | class RenameReportsToTestResults < ActiveRecord::Migration 2 | def change 3 | rename_table :reports, :test_results 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140407154134_remove_institution_id_from_test_results.rb: -------------------------------------------------------------------------------- 1 | class RemoveInstitutionIdFromTestResults < ActiveRecord::Migration 2 | def up 3 | remove_column :test_results, :institution_id 4 | end 5 | def down 6 | add_column :test_results, :institution_id, :integer 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20140415190208_create_identities.rb: -------------------------------------------------------------------------------- 1 | class CreateIdentities < ActiveRecord::Migration 2 | def change 3 | create_table :identities do |t| 4 | t.integer :user_id 5 | t.string :provider 6 | t.string :token 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140422171811_add_sensitive_data_to_test_results.rb: -------------------------------------------------------------------------------- 1 | class AddSensitiveDataToTestResults < ActiveRecord::Migration 2 | def change 3 | add_column :test_results, :sensitive_data, :binary 4 | rename_column(:test_results, :data, :raw_data) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140425152014_add_institution_id_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddInstitutionIdToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :institution_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140428143812_add_devices_laboratories.rb: -------------------------------------------------------------------------------- 1 | class AddDevicesLaboratories < ActiveRecord::Migration 2 | def change 3 | create_table :devices_laboratories, id: false do |t| 4 | t.belongs_to :device 5 | t.belongs_to :laboratory 6 | end 7 | 8 | remove_column :devices, :laboratory_id 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140505145148_add_uuid_to_test_results.rb: -------------------------------------------------------------------------------- 1 | class AddUuidToTestResults < ActiveRecord::Migration 2 | def change 3 | add_column :test_results, :uuid, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140515170318_create_device_models.rb: -------------------------------------------------------------------------------- 1 | class CreateDeviceModels < ActiveRecord::Migration 2 | def change 3 | create_table :device_models do |t| 4 | t.string :name 5 | 6 | t.timestamps 7 | end 8 | 9 | add_column :devices, :device_model_id, :integer 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140515171158_create_manifests.rb: -------------------------------------------------------------------------------- 1 | class CreateManifests < ActiveRecord::Migration 2 | def change 3 | create_table :manifests do |t| 4 | t.integer :version 5 | t.text :definition 6 | 7 | t.timestamps 8 | end 9 | 10 | create_table :device_models_manifests, id: false do |t| 11 | t.belongs_to :manifest 12 | t.belongs_to :device_model 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20140521153536_delete_subscribers.rb: -------------------------------------------------------------------------------- 1 | class DeleteSubscribers < ActiveRecord::Migration 2 | def up 3 | drop_table :subscribers 4 | end 5 | 6 | def down 7 | create_table :subscribers do |t| 8 | t.string :name 9 | t.string :callback_url 10 | t.references :work_group, index: true 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20140521153720_create_new_subscribers.rb: -------------------------------------------------------------------------------- 1 | class CreateNewSubscribers < ActiveRecord::Migration 2 | def change 3 | create_table :subscribers do |t| 4 | t.integer :user_id 5 | t.string :name 6 | t.string :url 7 | t.text :filter 8 | t.text :fields 9 | t.timestamp :last_run_at 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20140521194129_add_url_user_and_url_password_to_subscribers.rb: -------------------------------------------------------------------------------- 1 | class AddUrlUserAndUrlPasswordToSubscribers < ActiveRecord::Migration 2 | def change 3 | add_column :subscribers, :url_user, :string 4 | add_column :subscribers, :url_password, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140522180707_add_custom_fields_to_test_result.rb: -------------------------------------------------------------------------------- 1 | class AddCustomFieldsToTestResult < ActiveRecord::Migration 2 | def change 3 | add_column :test_results, :custom_fields, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140526181013_create_policies.rb: -------------------------------------------------------------------------------- 1 | class CreatePolicies < ActiveRecord::Migration 2 | def change 3 | create_table :policies do |t| 4 | t.integer :user_id 5 | t.integer :granter_id 6 | t.text :definition 7 | t.boolean :delegable 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20140526190412_add_name_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddNameToPolicies < ActiveRecord::Migration 2 | def change 3 | add_column :policies, :name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140530205604_add_event_id_to_test_results.rb: -------------------------------------------------------------------------------- 1 | class AddEventIdToTestResults < ActiveRecord::Migration 2 | def change 3 | add_column :test_results, :event_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140603191744_rename_test_result_to_event.rb: -------------------------------------------------------------------------------- 1 | class RenameTestResultToEvent < ActiveRecord::Migration 2 | def change 3 | rename_table :test_results, :events 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140722154526_add_admin_level_to_locations.rb: -------------------------------------------------------------------------------- 1 | class AddAdminLevelToLocations < ActiveRecord::Migration 2 | def change 3 | add_column :locations, :admin_level, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140805151606_add_api_version_to_manifests.rb: -------------------------------------------------------------------------------- 1 | class AddApiVersionToManifests < ActiveRecord::Migration 2 | def change 3 | add_column :manifests, :api_version, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140821200906_add_failed_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddFailedToEvents < ActiveRecord::Migration 2 | def change 3 | add_column :events, :failed, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140822151308_rename_failed_events_column.rb: -------------------------------------------------------------------------------- 1 | class RenameFailedEventsColumn < ActiveRecord::Migration 2 | def change 3 | rename_column :events, :failed, :index_failed 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140822152516_add_index_failure_reason_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddIndexFailureReasonToEvents < ActiveRecord::Migration 2 | def change 3 | add_column :events, :index_failure_reason, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140822165416_change_index_failure_reason_events_column_to_text.rb: -------------------------------------------------------------------------------- 1 | class ChangeIndexFailureReasonEventsColumnToText < ActiveRecord::Migration 2 | def change 3 | change_column :events, :index_failure_reason, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140918175424_change_manifest_version_from_integer_to_string.rb: -------------------------------------------------------------------------------- 1 | class ChangeManifestVersionFromIntegerToString < ActiveRecord::Migration 2 | def change 3 | change_column :manifests, :version, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140925185610_add_geo_id_to_locations.rb: -------------------------------------------------------------------------------- 1 | class AddGeoIdToLocations < ActiveRecord::Migration 2 | def change 3 | add_column :locations, :geo_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141218155918_create_ssh_keys.rb: -------------------------------------------------------------------------------- 1 | class CreateSshKeys < ActiveRecord::Migration 2 | def change 3 | create_table :ssh_keys do |t| 4 | t.text :public_key 5 | t.references :device, index: true 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20150119150526_create_activation_tokens.rb: -------------------------------------------------------------------------------- 1 | class CreateActivationTokens < ActiveRecord::Migration 2 | def change 3 | create_table :activation_tokens do |t| 4 | t.string :value 5 | t.string :device_secret_key 6 | t.references :device, index: true 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150119150757_create_activations.rb: -------------------------------------------------------------------------------- 1 | class CreateActivations < ActiveRecord::Migration 2 | def change 3 | create_table :activations do |t| 4 | t.references :activation_token, index: true 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20150119154001_add_index_to_activation_token_value.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToActivationTokenValue < ActiveRecord::Migration 2 | def change 3 | add_index :activation_tokens, :value, unique: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150119172327_make_activation_index_unique.rb: -------------------------------------------------------------------------------- 1 | class MakeActivationIndexUnique < ActiveRecord::Migration 2 | def change 3 | remove_index :activations, :activation_token_id 4 | add_index :activations, :activation_token_id, unique: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150120144346_rename_device_secret_key_to_client_id.rb: -------------------------------------------------------------------------------- 1 | class RenameDeviceSecretKeyToClientId < ActiveRecord::Migration 2 | def change 3 | rename_column :activation_tokens, :device_secret_key, :client_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150202182319_create_filters.rb: -------------------------------------------------------------------------------- 1 | class CreateFilters < ActiveRecord::Migration 2 | def change 3 | create_table :filters do |t| 4 | t.references :user, index: true 5 | t.string :name 6 | t.text :params 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150202182842_add_filter_id_to_subscriber.rb: -------------------------------------------------------------------------------- 1 | class AddFilterIdToSubscriber < ActiveRecord::Migration 2 | def change 3 | add_reference :subscribers, :filter, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150202184854_remove_filter_from_subscriber.rb: -------------------------------------------------------------------------------- 1 | class RemoveFilterFromSubscriber < ActiveRecord::Migration 2 | def change 3 | remove_column :subscribers, :filter, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150204181542_rename_filter_params_as_query.rb: -------------------------------------------------------------------------------- 1 | class RenameFilterParamsAsQuery < ActiveRecord::Migration 2 | def change 3 | rename_column(:filters, :params, :query) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150206142251_add_uuid_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddUuidToDevices < ActiveRecord::Migration 2 | def change 3 | rename_column :devices, :secret_key, :uuid 4 | add_column :devices, :secret_key, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150223145645_create_samples.rb: -------------------------------------------------------------------------------- 1 | class CreateSamples < ActiveRecord::Migration 2 | def change 3 | create_table :samples do |t| 4 | t.string :sample_id 5 | t.string :uuid 6 | t.binary :sensitive_data 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20150223151051_add_sample_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddSampleToEvents < ActiveRecord::Migration 2 | def change 3 | add_column :events, :sample_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150223151900_remove_sensitive_data_from_events.rb: -------------------------------------------------------------------------------- 1 | class RemoveSensitiveDataFromEvents < ActiveRecord::Migration 2 | def change 3 | remove_column :events, :sensitive_data, :binary 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150224154748_add_verb_to_subscribers.rb: -------------------------------------------------------------------------------- 1 | class AddVerbToSubscribers < ActiveRecord::Migration 2 | def change 3 | add_column :subscribers, :verb, :string, :default => 'GET' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150225160228_add_institution_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddInstitutionToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :institution_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150227193433_create_device_events.rb: -------------------------------------------------------------------------------- 1 | class CreateDeviceEvents < ActiveRecord::Migration 2 | def change 3 | create_table :device_events do |t| 4 | t.binary :raw_data 5 | t.references :device, index: true 6 | t.boolean :index_failed 7 | t.text :index_failure_reason 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20150227193601_remove_raw_data_from_events.rb: -------------------------------------------------------------------------------- 1 | class RemoveRawDataFromEvents < ActiveRecord::Migration 2 | def change 3 | remove_column :events, :raw_data, :binary 4 | remove_column :events, :device_id, :integer 5 | remove_column :events, :index_failed, :boolean 6 | remove_column :events, :index_failure_reason, :text 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150302142243_create_device_events_events.rb: -------------------------------------------------------------------------------- 1 | class CreateDeviceEventsEvents < ActiveRecord::Migration 2 | def change 3 | create_table :device_events_events do |t| 4 | t.belongs_to :device_event, index: true 5 | t.belongs_to :event, index: true 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150304194308_add_sensitive_fields_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddSensitiveFieldsToEvents < ActiveRecord::Migration 2 | def change 3 | add_column :events, :sensitive_data, :binary 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150304200858_add_custom_fields_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddCustomFieldsToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :custom_fields, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150304202928_add_sample_uid_hash_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddSampleUidHashToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :sample_uid_hash, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150304203611_remove_sample_id_from_samples.rb: -------------------------------------------------------------------------------- 1 | class RemoveSampleIdFromSamples < ActiveRecord::Migration 2 | def change 3 | remove_column :samples, :sample_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150304203629_add_indices_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddIndicesToSamples < ActiveRecord::Migration 2 | def change 3 | add_index "samples", ["institution_id", "sample_uid_hash"] 4 | add_index "samples", ["uuid"] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150305145336_add_indexed_fields_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddIndexedFieldsToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :indexed_fields, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150305153907_add_indices_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddIndicesToEvents < ActiveRecord::Migration 2 | def change 3 | add_index "events", ["sample_id"] 4 | add_index "events", ["uuid"] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150305175247_add_device_id_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddDeviceIdToEvents < ActiveRecord::Migration 2 | def change 3 | add_column :events, :device_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150415173132_change_laboratory_location_id_to_geo_id.rb: -------------------------------------------------------------------------------- 1 | class ChangeLaboratoryLocationIdToGeoId < ActiveRecord::Migration 2 | def change 3 | add_column :laboratories, :location_geoid, :string, limit: 60 4 | remove_column :laboratories, :location_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150422124002_add_timestamps_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddTimestampsToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :created_at, :datetime 4 | add_column :samples, :updated_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150508170417_add_time_zone_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddTimeZoneToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :time_zone, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150513175833_add_index_failure_data_to_device_events.rb: -------------------------------------------------------------------------------- 1 | class AddIndexFailureDataToDeviceEvents < ActiveRecord::Migration 2 | def change 3 | add_column :device_events, :index_failure_data, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150522173544_create_patients.rb: -------------------------------------------------------------------------------- 1 | class CreatePatients < ActiveRecord::Migration 2 | def change 3 | create_table :patients do |t| 4 | t.binary :sensitive_data 5 | t.text :custom_fields 6 | t.text :indexed_fields 7 | t.string :patient_id_hash 8 | t.string :uuid 9 | t.references :institution, index: true 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20150522180205_add_patient_id_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddPatientIdToSamples < ActiveRecord::Migration 2 | def change 3 | add_reference :samples, :patient, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150526153400_add_patient_id_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddPatientIdToEvents < ActiveRecord::Migration 2 | def change 3 | add_reference :events, :patient, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150527160209_add_indexed_fields_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddIndexedFieldsToEvents < ActiveRecord::Migration 2 | def change 3 | add_column :events, :indexed_fields, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150601165237_rename_events_to_test_results.rb: -------------------------------------------------------------------------------- 1 | class RenameEventsToTestResults < ActiveRecord::Migration 2 | def change 3 | rename_table :events, :test_results 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150601165245_rename_device_events_events_to_device_events_test_results.rb: -------------------------------------------------------------------------------- 1 | class RenameDeviceEventsEventsToDeviceEventsTestResults < ActiveRecord::Migration 2 | def change 3 | rename_table :device_events_events, :device_events_test_results 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150601165607_rename_event_id_column_in_device_events_test_results.rb: -------------------------------------------------------------------------------- 1 | class RenameEventIdColumnInDeviceEventsTestResults < ActiveRecord::Migration 2 | def change 3 | rename_column :device_events_test_results, :event_id, :test_result_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150601165748_rename_event_id_column_in_test_results.rb: -------------------------------------------------------------------------------- 1 | class RenameEventIdColumnInTestResults < ActiveRecord::Migration 2 | def change 3 | rename_column :test_results, :event_id, :test_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150604132737_rename_secret_key_to_secret_key_hash_in_devices.rb: -------------------------------------------------------------------------------- 1 | class RenameSecretKeyToSecretKeyHashInDevices < ActiveRecord::Migration 2 | def change 3 | rename_column :devices, :secret_key, :secret_key_hash 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150604132909_migrate_secret_key_to_secret_key_hash_in_devices.rb: -------------------------------------------------------------------------------- 1 | class MigrateSecretKeyToSecretKeyHashInDevices < ActiveRecord::Migration 2 | def up 3 | devices = execute "SELECT id, secret_key_hash FROM devices" 4 | devices.each do |id, secret_key| 5 | execute "UPDATE devices SET secret_key_hash = '#{MessageEncryption.hash(secret_key)}' WHERE id = #{id}" 6 | end 7 | end 8 | 9 | def down 10 | raise ActiveRecord::IrreversibleMigration 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20150608182645_rename_device_events_to_device_messages.rb: -------------------------------------------------------------------------------- 1 | class RenameDeviceEventsToDeviceMessages < ActiveRecord::Migration 2 | def change 3 | rename_table :device_events, :device_messages 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150608182743_rename_device_events_test_results_to_device_messages_test_results.rb: -------------------------------------------------------------------------------- 1 | class RenameDeviceEventsTestResultsToDeviceMessagesTestResults < ActiveRecord::Migration 2 | def change 3 | rename_table :device_events_test_results, :device_messages_test_results 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150608182846_rename_device_event_id_column_in_device_messages_test_results.rb: -------------------------------------------------------------------------------- 1 | class RenameDeviceEventIdColumnInDeviceMessagesTestResults < ActiveRecord::Migration 2 | def change 3 | rename_column :device_messages_test_results, :device_event_id, :device_message_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150624170646_add_custom_mappings_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddCustomMappingsToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :custom_mappings, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150724145211_create_conditions.rb: -------------------------------------------------------------------------------- 1 | class CreateConditions < ActiveRecord::Migration 2 | def change 3 | create_table :conditions do |t| 4 | t.string :name 5 | 6 | t.timestamps 7 | end 8 | 9 | create_table :conditions_manifests, id: false do |t| 10 | t.belongs_to :manifest 11 | t.belongs_to :condition 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20150805180134_use_entity_uid_hash.rb: -------------------------------------------------------------------------------- 1 | class UseEntityUidHash < ActiveRecord::Migration 2 | def change 3 | rename_column :patients, :patient_id_hash, :entity_uid_hash 4 | rename_column :samples, :sample_uid_hash, :entity_uid_hash 5 | rename_column :encounters, :encounter_id_hash, :entity_uid_hash 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20150805185341_rename_indexed_fields_to_core_fields.rb: -------------------------------------------------------------------------------- 1 | class RenameIndexedFieldsToCoreFields < ActiveRecord::Migration 2 | def change 3 | rename_column :test_results, :indexed_fields, :core_fields 4 | rename_column :patients, :indexed_fields, :core_fields 5 | rename_column :samples, :indexed_fields, :core_fields 6 | rename_column :encounters, :indexed_fields, :core_fields 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150818200013_add_uuid_to_institutions_and_laboratories.rb: -------------------------------------------------------------------------------- 1 | class AddUuidToInstitutionsAndLaboratories < ActiveRecord::Migration 2 | def change 3 | add_column :institutions, :uuid, :string 4 | add_column :laboratories, :uuid, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150901163906_rename.rb: -------------------------------------------------------------------------------- 1 | class Rename < ActiveRecord::Migration 2 | def change 3 | rename_column :encounters, :entity_uid_hash, :entity_id_hash 4 | rename_column :patients, :entity_uid_hash, :entity_id_hash 5 | rename_column :samples, :entity_uid_hash, :entity_id_hash 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20150902154438_add_serial_number_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddSerialNumberToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :serial_number, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150917174426_create_computed_policies.rb: -------------------------------------------------------------------------------- 1 | class CreateComputedPolicies < ActiveRecord::Migration 2 | def change 3 | create_table :computed_policies do |t| 4 | t.integer :user_id 5 | t.boolean :allow 6 | t.string :action 7 | t.string :resource_type 8 | t.integer :resource_id, null: true 9 | t.integer :condition_institution_id, null: true 10 | t.integer :condition_laboratory_id, null: true 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20150921222526_add_delegable_to_computed_policies.rb: -------------------------------------------------------------------------------- 1 | class AddDelegableToComputedPolicies < ActiveRecord::Migration 2 | def change 3 | add_column :computed_policies, :delegable, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150922204816_drop_allow_column_from_computed_policies.rb: -------------------------------------------------------------------------------- 1 | class DropAllowColumnFromComputedPolicies < ActiveRecord::Migration 2 | def change 3 | remove_column :computed_policies, :allow, :boolean, default: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150925172725_create_device_logs.rb: -------------------------------------------------------------------------------- 1 | class CreateDeviceLogs < ActiveRecord::Migration 2 | def change 3 | create_table :device_logs do |t| 4 | t.integer :device_id 5 | t.binary :message 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20150925175941_replace_entity_id_hash_with_entity_id_in_samples.rb: -------------------------------------------------------------------------------- 1 | class ReplaceEntityIdHashWithEntityIdInSamples < ActiveRecord::Migration 2 | def change 3 | remove_column :samples, :entity_id_hash, :string 4 | add_column :samples, :entity_id, :string 5 | 6 | add_index :samples, [:institution_id, :entity_id] 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150925180545_fill_entity_id_in_samples.rb: -------------------------------------------------------------------------------- 1 | class FillEntityIdInSamples < ActiveRecord::Migration 2 | 3 | class SampleForMigration < ActiveRecord::Base 4 | self.table_name = "samples" 5 | serialize :core_fields, Hash 6 | end 7 | 8 | def up 9 | SampleForMigration.all.each do |sample| 10 | sample.entity_id = sample.core_fields["id"] 11 | sample.save! 12 | end 13 | end 14 | 15 | def down 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20150928142745_add_password_changed_at_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddPasswordChangedAtToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :password_changed_at, :datetime 4 | add_index :users, :password_changed_at 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150928183528_add_institution_id_to_device_models.rb: -------------------------------------------------------------------------------- 1 | class AddInstitutionIdToDeviceModels < ActiveRecord::Migration 2 | def change 3 | add_column :device_models, :institution_id, :integer, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150928201723_create_device_commands.rb: -------------------------------------------------------------------------------- 1 | class CreateDeviceCommands < ActiveRecord::Migration 2 | def change 3 | create_table :device_commands do |t| 4 | t.integer :device_id 5 | t.string :name 6 | t.string :command 7 | 8 | t.timestamps null: false 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150929202058_add_not_available_serial_number_to_existing_devices.rb: -------------------------------------------------------------------------------- 1 | class AddNotAvailableSerialNumberToExistingDevices < ActiveRecord::Migration 2 | def up 3 | execute "UPDATE devices SET serial_number = 'n/a' WHERE serial_number IS NULL" 4 | end 5 | 6 | def down 7 | raise ActiveRecord::IrreversibleMigration 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20150930130533_add_condition_device_id_to_computed_policies.rb: -------------------------------------------------------------------------------- 1 | class AddConditionDeviceIdToComputedPolicies < ActiveRecord::Migration 2 | def change 3 | add_column :computed_policies, :condition_device_id, :integer, null: true 4 | add_column :computed_policy_exceptions, :condition_device_id, :integer, null: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151005141913_remove_delegable_from_policies.rb: -------------------------------------------------------------------------------- 1 | class RemoveDelegableFromPolicies < ActiveRecord::Migration 2 | def change 3 | remove_column :policies, :delegable, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151005172622_add_kind_to_institutions.rb: -------------------------------------------------------------------------------- 1 | class AddKindToInstitutions < ActiveRecord::Migration 2 | def change 3 | add_column :institutions, :kind, :string, default: "institution" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151006141255_add_laboratory_and_institution_ids_to_test_results.rb: -------------------------------------------------------------------------------- 1 | class AddLaboratoryAndInstitutionIdsToTestResults < ActiveRecord::Migration 2 | def change 3 | add_column :test_results, :laboratory_id, :integer 4 | add_column :test_results, :institution_id, :integer 5 | 6 | add_index :test_results, :laboratory_id 7 | add_index :test_results, :institution_id 8 | add_index :test_results, :device_id 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20151006145712_add_published_at_to_device_models.rb: -------------------------------------------------------------------------------- 1 | class AddPublishedAtToDeviceModels < ActiveRecord::Migration 2 | 3 | def change 4 | add_column :device_models, :published_at, :datetime, null: true 5 | add_index :device_models, :published_at 6 | connection.execute("UPDATE device_models SET published_at = NOW() WHERE published_at IS NULL") 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20151008162340_rename_laboratory_to_site.rb: -------------------------------------------------------------------------------- 1 | class RenameLaboratoryToSite < ActiveRecord::Migration 2 | def change 3 | rename_column :computed_policies, :condition_laboratory_id, :condition_site_id 4 | rename_column :computed_policy_exceptions, :condition_laboratory_id, :condition_site_id 5 | rename_column :devices, :laboratory_id, :site_id 6 | rename_table :laboratories, :sites 7 | rename_column :test_results, :laboratory_id, :site_id 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20151008205841_add_supports_activation_to_device_model.rb: -------------------------------------------------------------------------------- 1 | class AddSupportsActivationToDeviceModel < ActiveRecord::Migration 2 | def change 3 | add_column :device_models, :supports_activation, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151013215720_add_locale_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddLocaleToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :locale, :string, default: "en" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151015221802_add_timestamps_in_device_time_zone_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddTimestampsInDeviceTimeZoneToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :timestamps_in_device_time_zone, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151016143640_add_time_zone_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddTimeZoneToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :time_zone, :string, default: "UTC" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151019202219_add_parent_id_and_prefix_to_sites.rb: -------------------------------------------------------------------------------- 1 | class AddParentIdAndPrefixToSites < ActiveRecord::Migration 2 | def change 3 | add_column :sites, :parent_id, :integer 4 | add_column :sites, :prefix, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151020173442_change_resource_id_and_condition_site_id_to_string_in_computed_policies.rb: -------------------------------------------------------------------------------- 1 | class ChangeResourceIdAndConditionSiteIdToStringInComputedPolicies < ActiveRecord::Migration 2 | def change 3 | change_column :computed_policies, :resource_id, :string 4 | change_column :computed_policies, :condition_site_id, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151026185300_change_resource_id_and_condition_site_id_to_string_in_computed_policy_exceptions.rb: -------------------------------------------------------------------------------- 1 | class ChangeResourceIdAndConditionSiteIdToStringInComputedPolicyExceptions < ActiveRecord::Migration 2 | def change 3 | change_column :computed_policy_exceptions, :resource_id, :string 4 | change_column :computed_policy_exceptions, :condition_site_id, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151026193558_add_site_prefix_to_devices_and_test_results.rb: -------------------------------------------------------------------------------- 1 | class AddSitePrefixToDevicesAndTestResults < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :site_prefix, :string 4 | add_column :test_results, :site_prefix, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151027175111_add_owner_to_application.rb: -------------------------------------------------------------------------------- 1 | class AddOwnerToApplication < ActiveRecord::Migration 2 | def change 3 | add_column :oauth_applications, :owner_id, :integer, null: true 4 | add_column :oauth_applications, :owner_type, :string, null: true 5 | add_index :oauth_applications, [:owner_id, :owner_type] 6 | end 7 | end -------------------------------------------------------------------------------- /db/migrate/20151029165435_add_support_url_to_device_models.rb: -------------------------------------------------------------------------------- 1 | class AddSupportUrlToDeviceModels < ActiveRecord::Migration 2 | def change 3 | add_column :device_models, :support_url, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151029184400_add_attachment_picture_to_device_models.rb: -------------------------------------------------------------------------------- 1 | class AddAttachmentPictureToDeviceModels < ActiveRecord::Migration 2 | def self.up 3 | change_table :device_models do |t| 4 | t.attachment :picture 5 | end 6 | end 7 | 8 | def self.down 9 | remove_attachment :device_models, :picture 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20151030120316_add_names_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddNamesToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :first_name, :string 4 | add_column :users, :last_name, :string 5 | add_index :users, :last_name 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20151030211740_rename_entity_id_hash_to_entity_id_in_encounters.rb: -------------------------------------------------------------------------------- 1 | class RenameEntityIdHashToEntityIdInEncounters < ActiveRecord::Migration 2 | def change 3 | rename_column :encounters, :entity_id_hash, :entity_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151103193538_add_sample_id_reset_policy_to_sites.rb: -------------------------------------------------------------------------------- 1 | class AddSampleIdResetPolicyToSites < ActiveRecord::Migration 2 | def change 3 | add_column :sites, :sample_id_reset_policy, :string, default: "yearly" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151104202638_create_test_result_parsed_data.rb: -------------------------------------------------------------------------------- 1 | class CreateTestResultParsedData < ActiveRecord::Migration 2 | def change 3 | create_table :test_result_parsed_data do |t| 4 | t.integer :test_result_id 5 | t.binary :data 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20151110161047_add_deleted_at_to_sites.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToSites < ActiveRecord::Migration 2 | def change 3 | add_column :sites, :deleted_at, :datetime 4 | add_index :sites, :deleted_at 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151116133521_drop_samples_duplicate_index.rb: -------------------------------------------------------------------------------- 1 | class DropSamplesDuplicateIndex < ActiveRecord::Migration 2 | def up 3 | remove_index "samples", name: "index_samples_on_institution_id_and_entity_id_hash" 4 | end 5 | 6 | def down 7 | add_index "samples", ["institution_id"], name: "index_samples_on_institution_id_and_entity_id_hash", using: :btree 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20151118155324_add_deleted_at_to_entities.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToEntities < ActiveRecord::Migration 2 | def change 3 | %W(test_results sample_identifiers samples encounters patients).each do |table| 4 | add_column table, :deleted_at, :datetime 5 | add_index table, :deleted_at 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20151120181949_add_last_navigation_context_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddLastNavigationContextToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :last_navigation_context, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151123180754_add_attachment_setup_instructions_to_device_models.rb: -------------------------------------------------------------------------------- 1 | class AddAttachmentSetupInstructionsToDeviceModels < ActiveRecord::Migration 2 | def self.up 3 | change_table :device_models do |t| 4 | t.attachment :setup_instructions 5 | end 6 | end 7 | 8 | def self.down 9 | remove_attachment :device_models, :setup_instructions 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20151124172252_create_alerts.rb: -------------------------------------------------------------------------------- 1 | class CreateAlerts < ActiveRecord::Migration 2 | def change 3 | create_table :alerts do |t| 4 | t.references :user, index: true 5 | t.string :name 6 | t.string :description 7 | t.boolean :enabled, default: true 8 | t.integer :receipients, default: 0 9 | t.datetime :last_alert 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20151125151833_create_roles.rb: -------------------------------------------------------------------------------- 1 | class CreateRoles < ActiveRecord::Migration 2 | def change 3 | create_table :roles do |t| 4 | t.string :name, null: false 5 | t.references :institution, null: false 6 | t.references :site 7 | t.references :policy, null: false 8 | 9 | t.timestamps 10 | end 11 | 12 | create_table :roles_users, id: false do |t| 13 | t.belongs_to :role 14 | t.belongs_to :user 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20151130130846_add_main_phone_number_and_email_address_to_sites.rb: -------------------------------------------------------------------------------- 1 | class AddMainPhoneNumberAndEmailAddressToSites < ActiveRecord::Migration 2 | def change 3 | add_column :sites, :main_phone_number, :string 4 | add_column :sites, :email_address, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151201150151_add_is_active_flag_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddIsActiveFlagToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :is_active, :boolean, default: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151202174956_add_site_to_encounters.rb: -------------------------------------------------------------------------------- 1 | class AddSiteToEncounters < ActiveRecord::Migration 2 | def change 3 | add_reference :encounters, :site, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151204105403_add_telephone_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddTelephoneToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :telephone, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151207120355_add_category_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddCategoryToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :error_code, :string 4 | add_column :alerts, :category_type, :integer 5 | add_column :alerts, :aggregation_type, :integer, default:0 6 | remove_column :alerts, :receipients 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20151208152927_add_query_to_alert.rb: -------------------------------------------------------------------------------- 1 | class AddQueryToAlert < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :query, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151209120802_create_alert_histories.rb: -------------------------------------------------------------------------------- 1 | class CreateAlertHistories < ActiveRecord::Migration 2 | def change 3 | create_table :alert_histories do |t| 4 | t.boolean :read, default: false 5 | t.references :user, index: true 6 | t.references :alert, index: true 7 | t.references :test_result 8 | t.timestamps 9 | end 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /db/migrate/20151209165717_add_message_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddMessageToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :message, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151209174256_create_alert_recipients.rb: -------------------------------------------------------------------------------- 1 | class CreateAlertRecipients < ActiveRecord::Migration 2 | def change 3 | create_table :alert_recipients do |t| 4 | t.references :user, index: true 5 | t.references :alert, index: true 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20151210114431_add_channel_type_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddChannelTypeToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :channel_type, :integer, default:0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151210132301_add_email_to_alert_recipients.rb: -------------------------------------------------------------------------------- 1 | class AddEmailToAlertRecipients < ActiveRecord::Migration 2 | def change 3 | add_column :alert_recipients, :email, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151210144138_add_sample_identifier_generation_to_sites.rb: -------------------------------------------------------------------------------- 1 | class AddSampleIdentifierGenerationToSites < ActiveRecord::Migration 2 | def change 3 | add_column :sites, :last_sample_identifier_entity_id, :string 4 | add_column :sites, :last_sample_identifier_date, :date 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151210181714_add_key_to_roles.rb: -------------------------------------------------------------------------------- 1 | class AddKeyToRoles < ActiveRecord::Migration 2 | def change 3 | add_column :roles, :key, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151214171318_add_site_to_alert.rb: -------------------------------------------------------------------------------- 1 | class AddSiteToAlert < ActiveRecord::Migration 2 | def change 3 | change_table :alerts do |t| 4 | t.references :site 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20151215172425_add_roles_to_alert_recipients.rb: -------------------------------------------------------------------------------- 1 | class AddRolesToAlertRecipients < ActiveRecord::Migration 2 | def change 3 | change_table :alert_recipients do |t| 4 | t.references :role 5 | end 6 | end 7 | end 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /db/migrate/20151216095841_add_aggregation_frequency_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddAggregationFrequencyToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :aggregation_frequency, :integer, default:0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151216102356_add_sms_limit_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddSmsLimitToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :sms_limit, :integer, default:0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151216135042_create_recipient_notification_histories.rb: -------------------------------------------------------------------------------- 1 | class CreateRecipientNotificationHistories < ActiveRecord::Migration 2 | def change 3 | create_table :recipient_notification_histories do |t| 4 | t.references :user, index: true 5 | t.references :alert_recipient 6 | t.references :alert_history 7 | t.references :alert 8 | t.integer :channel_type 9 | t.string :message_sent 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20151216150910_add_for_aggregation_calculation_to_alert_history.rb: -------------------------------------------------------------------------------- 1 | class AddForAggregationCalculationToAlertHistory < ActiveRecord::Migration 2 | def change 3 | add_column :alert_histories, :for_aggregation_calculation, :boolean, default:false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151218123655_add_user_updated_at_to_encounters.rb: -------------------------------------------------------------------------------- 1 | class AddUserUpdatedAtToEncounters < ActiveRecord::Migration 2 | def change 3 | add_column :encounters, :user_updated_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151218172251_create_join_table_alert_device.rb: -------------------------------------------------------------------------------- 1 | class CreateJoinTableAlertDevice < ActiveRecord::Migration 2 | def change 3 | create_join_table :alerts, :devices do |t| 4 | t.index [:alert_id, :device_id] 5 | t.index [:device_id, :alert_id] 6 | end 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /db/migrate/20151221103428_remove_site_id_from_alerts.rb: -------------------------------------------------------------------------------- 1 | class RemoveSiteIdFromAlerts < ActiveRecord::Migration 2 | def change 3 | remove_column :alerts, :site_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20151221105129_create_join_table_alert_site.rb: -------------------------------------------------------------------------------- 1 | class CreateJoinTableAlertSite < ActiveRecord::Migration 2 | def change 3 | create_join_table :alerts, :sites do |t| 4 | # t.index [:alert_id, :site_id] 5 | # t.index [:site_id, :alert_id] 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160104104519_add_anomalie_type_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddAnomalieTypeToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :anomalie_type, :integer, default:0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160105165742_add_location_to_patients.rb: -------------------------------------------------------------------------------- 1 | class AddLocationToPatients < ActiveRecord::Migration 2 | def change 3 | add_column :patients, :location_geoid, :string, limit: 60 4 | add_column :patients, :lat, :float 5 | add_column :patients, :lng, :float 6 | add_column :patients, :address, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160106154918_add_notifty_patients_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddNotiftyPatientsToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :notify_patients, :boolean, default:0 4 | end 5 | end -------------------------------------------------------------------------------- /db/migrate/20160108181427_add_name_to_patients.rb: -------------------------------------------------------------------------------- 1 | class AddNameToPatients < ActiveRecord::Migration 2 | def change 3 | add_column :patients, :name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160108194936_add_entity_id_to_patients.rb: -------------------------------------------------------------------------------- 1 | class AddEntityIdToPatients < ActiveRecord::Migration 2 | def change 3 | add_column :patients, :entity_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160112190503_add_site_prefix_to_encounters.rb: -------------------------------------------------------------------------------- 1 | class AddSitePrefixToEncounters < ActiveRecord::Migration 2 | def change 3 | add_column :encounters, :site_prefix, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160113171706_add_recipient_type_to_alert_recipients.rb: -------------------------------------------------------------------------------- 1 | class AddRecipientTypeToAlertRecipients < ActiveRecord::Migration 2 | def change 3 | add_column :alert_recipients, :recipient_type, :integer, default:0 4 | add_column :alert_recipients, :telephone, :string 5 | add_column :alert_recipients, :first_name, :string 6 | add_column :alert_recipients, :last_name, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160114154732_add_start_time_to_encounters.rb: -------------------------------------------------------------------------------- 1 | class AddStartTimeToEncounters < ActiveRecord::Migration 2 | def change 3 | add_column :encounters, :start_time, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160115131955_add_site_id_site_prefix_to_patients.rb: -------------------------------------------------------------------------------- 1 | class AddSiteIdSitePrefixToPatients < ActiveRecord::Migration 2 | def change 3 | add_reference :patients, :site, index: true, foreign_key: true 4 | add_column :patients, :site_prefix, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20160115135130_add_sms_message_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddSmsMessageToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :sms_message, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160120214128_add_ftp_info_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddFtpInfoToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :ftp_hostname, :string 4 | add_column :devices, :ftp_username, :string 5 | add_column :devices, :ftp_password, :string 6 | add_column :devices, :ftp_directory, :string 7 | add_column :devices, :ftp_port, :integer 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20160120214202_add_ftp_flag_to_device_models.rb: -------------------------------------------------------------------------------- 1 | class AddFtpFlagToDeviceModels < ActiveRecord::Migration 2 | def change 3 | add_column :device_models, :supports_ftp, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160125112341_add_sms_to_recipient_notification_histories.rb: -------------------------------------------------------------------------------- 1 | class AddSmsToRecipientNotificationHistories < ActiveRecord::Migration 2 | def change 3 | add_column :recipient_notification_histories, :sms_response_id, :integer 4 | add_column :recipient_notification_histories, :sms_response_guid, :string 5 | add_column :recipient_notification_histories, :sms_response_token, :string 6 | end 7 | end 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /db/migrate/20160125134622_add_filename_pattern_to_device_models.rb: -------------------------------------------------------------------------------- 1 | class AddFilenamePatternToDeviceModels < ActiveRecord::Migration 2 | def change 3 | add_column :device_models, :filename_pattern, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160128123511_add_deleted_at_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :deleted_at, :datetime 4 | add_index :alerts, :deleted_at 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20160203094023_create_join_table_alert_condition.rb: -------------------------------------------------------------------------------- 1 | class CreateJoinTableAlertCondition < ActiveRecord::Migration 2 | def change 3 | create_join_table :alerts, :conditions do |t| 4 | t.index [:alert_id, :condition_id] 5 | t.index [:condition_id, :alert_id] 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160203095033_create_alert_condition_results.rb: -------------------------------------------------------------------------------- 1 | class CreateAlertConditionResults < ActiveRecord::Migration 2 | def change 3 | create_table :alert_condition_results do |t| 4 | t.string :result 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160203103630_add_alert_to_alert_condition_results.rb: -------------------------------------------------------------------------------- 1 | class AddAlertToAlertConditionResults < ActiveRecord::Migration 2 | def change 3 | add_column :alert_condition_results, :alert_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160203150350_add_threshold_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddThresholdToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :test_result_min_threshold, :integer 4 | add_column :alerts, :test_result_max_threshold, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20160203230132_add_include_subsites_to_computed_policies.rb: -------------------------------------------------------------------------------- 1 | class AddIncludeSubsitesToComputedPolicies < ActiveRecord::Migration 2 | def change 3 | add_column :computed_policies, :include_subsites, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160204091551_add_aggregation_threshold_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddAggregationThresholdToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :aggregation_threshold, :integer, default:0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160205154644_add_sample_id_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddSampleIdToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :sample_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160210163103_add_utilization_efficiency_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddUtilizationEfficiencyToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :utilization_efficiency_type, :integer, default:0 4 | add_column :alerts, :utilization_efficiency_number, :integer, default:0 5 | add_column :alerts, :utilization_efficiency_last_checked, :datetime 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160210191011_add_site_id_to_device_message.rb: -------------------------------------------------------------------------------- 1 | class AddSiteIdToDeviceMessage < ActiveRecord::Migration 2 | def change 3 | add_reference :device_messages, :site, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160210193741_set_site_id_in_device_messages.rb: -------------------------------------------------------------------------------- 1 | class SetSiteIdInDeviceMessages < ActiveRecord::Migration 2 | def up 3 | connection.execute <<-SQL 4 | UPDATE device_messages 5 | SET site_id = (SELECT site_id FROM devices WHERE devices.id = device_messages.device_id) 6 | SQL 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160215195614_add_deleted_at_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :deleted_at, :datetime 4 | add_index :devices, :deleted_at 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20160218104352_add_email_limit_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddEmailLimitToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :email_limit, :integer, default:0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160223111818_add_deleted_at_to_alert_recipients.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToAlertRecipients < ActiveRecord::Migration 2 | def change 3 | add_column :alert_recipients, :deleted_at, :datetime 4 | add_index :alert_recipients, :deleted_at 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20160301180433_add_site_prefix_to_role.rb: -------------------------------------------------------------------------------- 1 | class AddSitePrefixToRole < ActiveRecord::Migration 2 | def change 3 | add_column :roles, :site_prefix, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160307144244_add_use_aggregation_percentage_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddUseAggregationPercentageToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :use_aggregation_percentage, :boolean, default:0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160308134157_add_institution_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddInstitutionToAlerts < ActiveRecord::Migration 2 | def change 3 | add_reference :alerts, :institution, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160309161106_add_time_last_aggregation_checked_to_alerts.rb: -------------------------------------------------------------------------------- 1 | class AddTimeLastAggregationCheckedToAlerts < ActiveRecord::Migration 2 | def change 3 | add_column :alerts, :time_last_aggregation_checked, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160310151033_add_test_result_updated_at_to_alert_histories.rb: -------------------------------------------------------------------------------- 1 | class AddTestResultUpdatedAtToAlertHistories < ActiveRecord::Migration 2 | def change 3 | add_column :alert_histories, :test_result_updated_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160317204732_add_ftp_passive_to_devices.rb: -------------------------------------------------------------------------------- 1 | class AddFtpPassiveToDevices < ActiveRecord::Migration 2 | def change 3 | add_column :devices, :ftp_passive, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160318120245_add_ftp_passive_to_file_messages.rb: -------------------------------------------------------------------------------- 1 | class AddFtpPassiveToFileMessages < ActiveRecord::Migration 2 | def change 3 | add_column :file_messages, :ftp_passive, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160322190646_add_sidebar_open_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddSidebarOpenToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :sidebar_open, :boolean, default: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160405192357_add_allows_manual_entry_to_site.rb: -------------------------------------------------------------------------------- 1 | class AddAllowsManualEntryToSite < ActiveRecord::Migration 2 | def change 3 | add_column :sites, :allows_manual_entry, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210424172045_create_laboratory_samples.rb: -------------------------------------------------------------------------------- 1 | class CreateLaboratorySamples < ActiveRecord::Migration 2 | def change 3 | create_table :laboratory_samples do |t| 4 | t.string :uuid 5 | 6 | t.timestamps null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210425195132_add_type_to_laboratory_samples.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToLaboratorySamples < ActiveRecord::Migration 2 | def change 3 | add_column :laboratory_samples, :sample_type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210505201523_add_institution_to_laboratory_samples.rb: -------------------------------------------------------------------------------- 1 | class AddInstitutionToLaboratorySamples < ActiveRecord::Migration 2 | def change 3 | add_reference :laboratory_samples, :institution, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210519210302_add_entity_fields_to_laboratory_sample.rb: -------------------------------------------------------------------------------- 1 | class AddEntityFieldsToLaboratorySample < ActiveRecord::Migration 2 | def change 3 | add_column :laboratory_samples, :core_fields, :text 4 | add_column :laboratory_samples, :custom_fields, :text 5 | add_column :laboratory_samples, :sensitive_data, :binary 6 | 7 | add_column :laboratory_samples, :deleted_at, :datetime 8 | add_index :laboratory_samples, :deleted_at 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20210527215913_add_batch_to_laboratory_samples.rb: -------------------------------------------------------------------------------- 1 | class AddBatchToLaboratorySamples < ActiveRecord::Migration 2 | def change 3 | add_reference :laboratory_samples, :batch, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210603195140_remove_sample_type_from_laboratory_samples.rb: -------------------------------------------------------------------------------- 1 | class RemoveSampleTypeFromLaboratorySamples < ActiveRecord::Migration 2 | def change 3 | remove_column :laboratory_samples, :sample_type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210614142904_create_test_qc_results.rb: -------------------------------------------------------------------------------- 1 | class CreateTestQcResults < ActiveRecord::Migration 2 | def change 3 | create_table :test_qc_results do |t| 4 | t.references :laboratory_sample, index: true 5 | t.timestamps null: false 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20210616220513_create_test_qc_result_assays.rb: -------------------------------------------------------------------------------- 1 | class CreateTestQcResultAssays < ActiveRecord::Migration 2 | def change 3 | create_table :test_qc_result_assays do |t| 4 | t.references :test_qc_result, index: true 5 | t.attachment :picture 6 | t.timestamps null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210617115609_add_batch_number_to_batches.rb: -------------------------------------------------------------------------------- 1 | class AddBatchNumberToBatches < ActiveRecord::Migration 2 | def change 3 | add_column :batches, :batch_number, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210618125427_create_notes.rb: -------------------------------------------------------------------------------- 1 | class CreateNotes < ActiveRecord::Migration 2 | def change 3 | create_table :notes do |t| 4 | t.text :description 5 | t.references :user, index: true 6 | t.references :laboratory_sample, index: true 7 | 8 | t.timestamps null: false 9 | end 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /db/migrate/20210701173411_add_isolate_name_to_laboratory_samples.rb: -------------------------------------------------------------------------------- 1 | class AddIsolateNameToLaboratorySamples < ActiveRecord::Migration 2 | def change 3 | add_column :laboratory_samples, :isolate_name, :string 4 | add_index :laboratory_samples, :isolate_name 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210710205858_add_batch_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddBatchToSamples < ActiveRecord::Migration 2 | def change 3 | add_reference :samples, :batch, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210711204458_add_sample_to_notes.rb: -------------------------------------------------------------------------------- 1 | class AddSampleToNotes < ActiveRecord::Migration 2 | def change 3 | add_reference :notes, :sample, index: true, foreign_key: true 4 | remove_reference :notes, :laboratory_sample, index: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210711225220_create_assays.rb: -------------------------------------------------------------------------------- 1 | class CreateAssays < ActiveRecord::Migration 2 | def change 3 | create_table :assays do |t| 4 | t.references :sample, index: true, foreign_key: true 5 | t.attachment :picture 6 | t.timestamps null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210712213544_remove_laboratory_samples_and_test_qc_assays.rb: -------------------------------------------------------------------------------- 1 | class RemoveLaboratorySamplesAndTestQcAssays < ActiveRecord::Migration 2 | def change 3 | drop_table :laboratory_samples 4 | drop_table :test_qc_results 5 | drop_table :test_qc_result_assays 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20210719114233_add_isolate_name_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddIsolateNameToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :isolate_name, :string 4 | add_index :samples, :isolate_name 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210727162118_rename_assays_to_assay_attachments.rb: -------------------------------------------------------------------------------- 1 | class RenameAssaysToAssayAttachments < ActiveRecord::Migration 2 | def change 3 | rename_table :assays, :assay_attachments 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210803151121_create_loinc_codes.rb: -------------------------------------------------------------------------------- 1 | class CreateLoincCodes < ActiveRecord::Migration 2 | def change 3 | create_table :loinc_codes do |t| 4 | t.string :loinc_number 5 | t.string :component 6 | end 7 | 8 | add_index :loinc_codes, :loinc_number 9 | add_index :loinc_codes, :component 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20210805192509_remove_loinc_code_from_assay_attachments.rb: -------------------------------------------------------------------------------- 1 | class RemoveLoincCodeFromAssayAttachments < ActiveRecord::Migration 2 | def change 3 | remove_column :assay_attachments, :loinc_code, :string 4 | end 5 | end -------------------------------------------------------------------------------- /db/migrate/20210806231327_add_loinc_code_to_assay_attachments.rb: -------------------------------------------------------------------------------- 1 | class AddLoincCodeToAssayAttachments < ActiveRecord::Migration 2 | def change 3 | add_reference :assay_attachments, :loinc_code, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210922233855_add_site_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddSiteToSamples < ActiveRecord::Migration 2 | def change 3 | add_reference :samples, :site, index: true, foreign_key: true 4 | add_column :samples, :site_prefix, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210924033359_add_site_to_batches.rb: -------------------------------------------------------------------------------- 1 | class AddSiteToBatches < ActiveRecord::Migration 2 | def change 3 | add_reference :batches, :site, index: true, foreign_key: true 4 | add_column :batches, :site_prefix, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20211026021110_create_assay_file.rb: -------------------------------------------------------------------------------- 1 | class CreateAssayFile < ActiveRecord::Migration 2 | def change 3 | create_table :assay_files do |t| 4 | t.belongs_to :assay_attachment, index: true 5 | t.attachment :picture 6 | t.timestamps null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20211028075009_add_assay_file_to_assay_attachments.rb: -------------------------------------------------------------------------------- 1 | class AddAssayFileToAssayAttachments < ActiveRecord::Migration 2 | def change 3 | add_reference :assay_attachments, :assay_file, index: true, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211201171200_add_specimen_role_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddSpecimenRoleToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :specimen_role, :string 4 | add_index :samples, :specimen_role 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20211201221707_add_date_produced_to_batches.rb: -------------------------------------------------------------------------------- 1 | class AddDateProducedToBatches < ActiveRecord::Migration 2 | def change 3 | add_column :batches, :date_produced, :datetime 4 | add_index :batches, :date_produced 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220114191523_add_pending_institution_invites_to_institutions.rb: -------------------------------------------------------------------------------- 1 | class AddPendingInstitutionInvitesToInstitutions < ActiveRecord::Migration 2 | def change 3 | add_column :institutions, :pending_institution_invite_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220216134506_add_old_batch_number_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddOldBatchNumberToSamples < ActiveRecord::Migration 2 | def change 3 | add_column :samples, :old_batch_number, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220222115959_add_qc_info_id_to_samples_notes_assays.rb: -------------------------------------------------------------------------------- 1 | class AddQcInfoIdToSamplesNotesAssays < ActiveRecord::Migration 2 | def change 3 | add_reference :samples, :qc_info, index: true 4 | add_reference :assay_attachments, :qc_info, index: true 5 | add_reference :notes, :qc_info, index: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220412181435_change_sample_transfers_requires_transfer_package.rb: -------------------------------------------------------------------------------- 1 | class ChangeSampleTransfersRequiresTransferPackage < ActiveRecord::Migration 2 | def up 3 | change_column_null :sample_transfers, :transfer_package_id, false 4 | end 5 | 6 | def down 7 | change_column_null :sample_transfers, :transfer_package_id, true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20220505070823_add_confirmed_at_to_transfer_packages.rb: -------------------------------------------------------------------------------- 1 | class AddConfirmedAtToTransferPackages < ActiveRecord::Migration 2 | def up 3 | add_column :transfer_packages, :confirmed_at, :datetime, null: true 4 | add_index :transfer_packages, :confirmed_at 5 | 6 | TransferPackage.reset_column_information 7 | end 8 | 9 | def down 10 | remove_column :transfer_packages, :confirmed_at, :datetime 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20220519121619_create_box_transfers.rb: -------------------------------------------------------------------------------- 1 | class CreateBoxTransfers < ActiveRecord::Migration 2 | def change 3 | create_table :box_transfers do |t| 4 | t.references :box, index: true, foreign_key: true, null: false 5 | t.references :transfer_package, index: true, foreign_key: true, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20220519135949_change_box_institution_null.rb: -------------------------------------------------------------------------------- 1 | class ChangeBoxInstitutionNull < ActiveRecord::Migration 2 | def up 3 | change_column_null :boxes, :institution_id, true 4 | end 5 | 6 | def down 7 | change_column_null :boxes, :institution_id, false 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20220531133731_add_blinded_to_boxes.rb: -------------------------------------------------------------------------------- 1 | class AddBlindedToBoxes < ActiveRecord::Migration 2 | def change 3 | add_column :boxes, :blinded, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220602170219_add_indices_to_transfer_packages.rb: -------------------------------------------------------------------------------- 1 | class AddIndicesToTransferPackages < ActiveRecord::Migration 2 | def change 3 | add_index :transfer_packages, :uuid, unique: true 4 | add_index :transfer_packages, :receiver_institution_id 5 | add_index :transfer_packages, :sender_institution_id 6 | add_index :transfer_packages, :created_at 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20221223200957_add_distractor_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddDistractorToSamples < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :samples, :distractor, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20221223203602_add_instruction_to_samples.rb: -------------------------------------------------------------------------------- 1 | class AddInstructionToSamples < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :samples, :instruction, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /deps/cdx-api-elasticsearch/lib/cdx/api/elasticsearch/grouping/reference_table.rb: -------------------------------------------------------------------------------- 1 | class ReferenceTable 2 | attr_reader :name 3 | attr_reader :query_target 4 | attr_reader :value_field 5 | 6 | def initialize(name, query_target, value_field) 7 | @name = name 8 | @query_target = query_target 9 | @value_field = value_field 10 | end 11 | end -------------------------------------------------------------------------------- /deps/cdx-api-elasticsearch/lib/cdx/api/elasticsearch/null_query.rb: -------------------------------------------------------------------------------- 1 | class Cdx::Api::Elasticsearch::NullQuery 2 | def initialize(params, fields) 3 | @params = params 4 | @result_name = fields.result_name 5 | end 6 | 7 | def execute 8 | {@result_name => [], "total_count" => 0} 9 | end 10 | 11 | def grouped_by 12 | @params["group_by"].split(',') 13 | end 14 | 15 | def elasticsearch_query 16 | nil 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /deps/cdx-api-elasticsearch/lib/cdx/api/elasticsearch/version.rb: -------------------------------------------------------------------------------- 1 | module Cdx 2 | module Api 3 | module Elasticsearch 4 | VERSION = "0.0.1" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /deps/cdx_core/README.md: -------------------------------------------------------------------------------- 1 | # Cdx 2 | 3 | This gem contains CDX core fields specification 4 | 5 | ## Installation 6 | 7 | Add this line to your application's Gemfile: 8 | 9 | ```ruby 10 | gem 'cdx', github: 'instedd/cdp', branch: 'master' 11 | ``` 12 | 13 | And then execute: 14 | 15 | $ bundle 16 | -------------------------------------------------------------------------------- /deps/cdx_core/lib/cdx.rb: -------------------------------------------------------------------------------- 1 | require "cdx/version" 2 | require "cdx/fields" 3 | require "cdx/field" 4 | require "cdx/scope" 5 | require "yaml" 6 | require "active_support/core_ext/hash" 7 | -------------------------------------------------------------------------------- /deps/cdx_core/lib/cdx/version.rb: -------------------------------------------------------------------------------- 1 | module Cdx 2 | VERSION = "0.0.1" 3 | end 4 | -------------------------------------------------------------------------------- /docker-compose.ci.yml: -------------------------------------------------------------------------------- 1 | version: "2.4" 2 | 3 | services: 4 | web: 5 | volumes: 6 | - ./vendor/bundle:/usr/local/bundle 7 | 8 | csv_watch: 9 | volumes: 10 | - ./vendor/bundle:/usr/local/bundle 11 | 12 | ftp_monitor: 13 | volumes: 14 | - ./vendor/bundle:/usr/local/bundle 15 | 16 | sidekiq: 17 | volumes: 18 | - ./vendor/bundle:/usr/local/bundle 19 | -------------------------------------------------------------------------------- /docker-dev.env: -------------------------------------------------------------------------------- 1 | MYSQL_HOST=db 2 | MYSQL_PASSWORD=root 3 | SMTP_HOST=smtp 4 | SMTP_PORT=25 5 | SMTP_TLS=false 6 | ELASTICSEARCH_URL=elasticsearch:9200 7 | SSH_KEYS_PATH=/home/cdx-sync/.ssh/authorized_keys 8 | SSH_SYNC_DIR=/home/cdx-sync/sync 9 | SECRET_KEY_BASE=4f13a3e80905baa2e8e35489ebfae43d265cf8ca92bcac80e1ed0d2265874765fb667bf805cb7fd8edda1a18b65a0e4de57e41af5ceb64c0f78ffe803c483857 10 | REDIS_URL=redis://redis:6379 11 | PUMA_OPTIONS= 12 | PUBLIC_REGISTRATION=true 13 | -------------------------------------------------------------------------------- /docker/web-run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /etc/envvars 3 | cd /app 4 | exec su -p -c "bundle exec whenever --update-crontab && bundle exec puma $PUMA_OPTIONS -e $RAILS_ENV" app 5 | -------------------------------------------------------------------------------- /etc/nndd/overrides.js: -------------------------------------------------------------------------------- 1 | window.overrides = { 2 | "brand": "CDP", 3 | "api": "/api", 4 | "useLocalStorage" : true, 5 | "reportMainField": "condition", 6 | "mapCenter": [15.978, 105.807], 7 | "mapBounds": null, 8 | "onlyShowPositiveResults": false, 9 | "parentURL": "/dashboards/nndd", 10 | "showMarkersOnMap": false, 11 | "proxies": [ 12 | { 13 | "context": ["/api"], 14 | "host": "localhost", 15 | "port": 3000 16 | } 17 | ] 18 | }; 19 | -------------------------------------------------------------------------------- /etc/shapes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/etc/shapes/.gitkeep -------------------------------------------------------------------------------- /features/incidents.feature: -------------------------------------------------------------------------------- 1 | @javascript 2 | Feature: view incidents 3 | 4 | Background: 5 | Given the user has an account 6 | 7 | Scenario: No alerts then no incidents 8 | Then the user should see no incidents 9 | -------------------------------------------------------------------------------- /features/step_definitions/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/features/step_definitions/.gitkeep -------------------------------------------------------------------------------- /features/step_definitions/incident_steps.rb: -------------------------------------------------------------------------------- 1 | Then(/^the user should see no incidents$/) do 2 | @incidents = IncidentsPage.new 3 | @incidents.load 4 | 5 | within(@incidents.form) do |form| 6 | form.alert_group.set "Show all" 7 | form.select_date.set "Previous month" 8 | end 9 | expect(page).not_to have_xpath('//table/tr') 10 | end 11 | -------------------------------------------------------------------------------- /features/support/page_objects/alerts_index_page.rb: -------------------------------------------------------------------------------- 1 | class AlertsIndexPage < SitePrism::Page 2 | set_url '/alerts' 3 | end 4 | -------------------------------------------------------------------------------- /features/support/page_objects/cdx_table.rb: -------------------------------------------------------------------------------- 1 | class CdxTable < SitePrism::Section 2 | class Item < SitePrism::Section 3 | def click 4 | root_element.all("td").first.click 5 | end 6 | end 7 | 8 | sections :items, Item, "tbody tr" 9 | end 10 | -------------------------------------------------------------------------------- /features/support/page_objects/dashboard_page.rb: -------------------------------------------------------------------------------- 1 | class DashboardPage < CdxPageBase 2 | set_url '/dashboards/index{?query*}' 3 | 4 | section :tests_run, TestsRun, '#tests_run' 5 | end 6 | -------------------------------------------------------------------------------- /features/support/page_objects/edit_alert_page.rb: -------------------------------------------------------------------------------- 1 | class EditAlertPage < SitePrism::Page 2 | set_url '/alerts/{id}/edit' 3 | 4 | section 'form', '#new_alert' do 5 | element :name, '#alertname' 6 | 7 | element :submit, '#submit' 8 | 9 | element :delete, '#delete_alert' 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /features/support/page_objects/file_input.rb: -------------------------------------------------------------------------------- 1 | class FileInput < SitePrism::Section 2 | def attach(path) 3 | path = Rails.root.join(path) 4 | 5 | Array(path).each do |p| 6 | raise Capybara::FileNotFound, "cannot attach file, #{p} does not exist" unless File.exist?(p.to_s) 7 | end 8 | 9 | root_element.set(path) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /features/support/page_objects/home_page.rb: -------------------------------------------------------------------------------- 1 | class HomePage < CdxPageBase 2 | set_url '/' 3 | 4 | section :user_menu, "header .user" do 5 | element :icon, ".icon-user" 6 | element :logout, :link, "Log out" 7 | end 8 | 9 | section 'form', '#new_user' do 10 | element :user_name, '#user_email' 11 | element :password, '#user_password' 12 | element :login, '[name="commit"]' 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /features/support/page_objects/incident_page.rb: -------------------------------------------------------------------------------- 1 | class IncidentsPage < CdxPageBase 2 | set_url "/incidents" 3 | 4 | section 'form', '#filters-form' do 5 | section :alert_group, CdxSelect, "label", text: /Alert Group/i 6 | section :select_date, CdxSelect, "label", text: /Date/i 7 | end 8 | 9 | section :table, CdxTable, "table" 10 | end 11 | -------------------------------------------------------------------------------- /features/support/page_objects/institution_page.rb: -------------------------------------------------------------------------------- 1 | class InstitutionNewFromInvitePage < CdxPageBase 2 | set_url '/institutions/new{?query*}' 3 | 4 | element :name, :field, "Name" 5 | end 6 | -------------------------------------------------------------------------------- /features/support/page_objects/login_page.rb: -------------------------------------------------------------------------------- 1 | class LoginPage < SitePrism::Page 2 | set_url '/users/sign_in' 3 | 4 | section 'form', '#new_user' do 5 | element :user_name, '#user_email' 6 | element :password, '#user_password' 7 | element :login, '[name="commit"]' 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /features/support/page_objects/new_patient_page.rb: -------------------------------------------------------------------------------- 1 | class NewPatientPage < CdxPageBase 2 | set_url "/patients/new{?query*}" 3 | 4 | element :name, :field, "Name" 5 | element :patient_id, :field, "Patient id" 6 | 7 | end 8 | -------------------------------------------------------------------------------- /features/support/page_objects/patient_page.rb: -------------------------------------------------------------------------------- 1 | class PatientPage < CdxPageBase 2 | set_url '/patients{/patient_id}{?query*}' 3 | end 4 | -------------------------------------------------------------------------------- /features/support/page_objects/policy_page.rb: -------------------------------------------------------------------------------- 1 | class PolicyPage < SitePrism::Page 2 | set_url '/policies/new' 3 | 4 | section 'form', '#new_policy' do 5 | element :email, '#policy_user_id' 6 | element :name, '#policy_name' 7 | element :policy, '#policy_definition' 8 | element :invite, '[name="commit"]' 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /features/support/page_objects/roles_page.rb: -------------------------------------------------------------------------------- 1 | class RolesPage < CdxPageBase 2 | set_url "/roles" 3 | 4 | section :table, CdxTable, "table" 5 | end 6 | -------------------------------------------------------------------------------- /features/support/page_objects/show_encounter_page.rb: -------------------------------------------------------------------------------- 1 | class ShowEncounterPage < CdxPageBase 2 | set_url "/encounters/{id}" 3 | 4 | def id 5 | url_matches['id'].to_i 6 | end 7 | 8 | def encounter 9 | Encounter.find(self.id) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /features/support/page_objects/site_view_page.rb: -------------------------------------------------------------------------------- 1 | class SiteEditPage < CdxPageBase 2 | set_url '/sites{/site_id}/edit{?query*}' 3 | 4 | def shows_deleted? 5 | page.has_css?('h2.deleted') 6 | end 7 | 8 | section :parent_site, CdxSelect, "label", text: /Parent site/i 9 | end 10 | -------------------------------------------------------------------------------- /features/support/page_objects/test_results_page.rb: -------------------------------------------------------------------------------- 1 | class TestResultsPage < CdxPageBase 2 | set_url '/test_results/{?query*}' 3 | 4 | section :table, CdxTable, "table" 5 | end 6 | -------------------------------------------------------------------------------- /features/support/page_objects/tests_run.rb: -------------------------------------------------------------------------------- 1 | class TestsRun < SitePrism::Section 2 | class PieChart < SitePrism::Section 3 | element :total, 'svg .main.total:first-child' 4 | end 5 | 6 | section :pie_chart, PieChart, '[data-react-class="PieChart"]' 7 | end 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/lib/assets/.keep -------------------------------------------------------------------------------- /lib/reports.rb: -------------------------------------------------------------------------------- 1 | module Reports 2 | require 'reports/base' 3 | require 'reports/all_tests' 4 | require "reports/device_errors" 5 | require "reports/devices" 6 | require "reports/errors" 7 | require "reports/grouped" 8 | require "reports/model_errors" 9 | require "reports/successful" 10 | require "reports/unsuccessful" 11 | end 12 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/tasks/assay_files.rake: -------------------------------------------------------------------------------- 1 | namespace :assay_files do 2 | desc "delete AssayFiles that don't have any AssayAttachment (parent model) associated" 3 | task garbage_collector: :environment do 4 | assay_files = AssayFile.where("created_at > ? AND assay_attachment_id IS NULL", 7.days.ago) 5 | AssayFile.destroy(assay_files.map(&:id)) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/tasks/ftp_monitor.rake: -------------------------------------------------------------------------------- 1 | namespace :ftp do 2 | desc "Start FTP monitor to download remote files" 3 | task start: :environment do 4 | FtpMonitor.new(300).run! 5 | end 6 | 7 | desc "Delete the failed file messages as a way to reprocess those files in the next monitoring iteration" 8 | task reset_failed: :environment do 9 | FileMessage.where(status: 'failed').delete_all 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/tasks/load_csv.rake: -------------------------------------------------------------------------------- 1 | require 'cdx_sync' 2 | namespace :csv do 3 | desc "Load all csv files on the sync folder" 4 | task :load => :environment do |task, args| 5 | DeviceMessageImporter.new(Settings.sync_pattern).import_from CDXSync::SyncDirectory.new 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/log/.keep -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/public/favicon.ico -------------------------------------------------------------------------------- /public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/public/favicon.png -------------------------------------------------------------------------------- /public/polygons/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/public/polygons/.gitkeep -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /public/templates/upload_box.csv: -------------------------------------------------------------------------------- 1 | Batch,Concentration,Distractor,Instructions,Replicates 2 | batch1,100,no,Add 175 ml of media,2 3 | batch1,1000,no,Add 175 ml of media,2 4 | batch2,2,yes,Add 250 ml of media,4 5 | batch2,200,yes,Add 100 ml of media,4 6 | -------------------------------------------------------------------------------- /script/cucumber: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first 4 | if vendored_cucumber_bin 5 | load File.expand_path(vendored_cucumber_bin) 6 | else 7 | require 'rubygems' unless ENV['NO_RUBYGEMS'] 8 | require 'cucumber' 9 | load Cucumber::BINARY 10 | end 11 | -------------------------------------------------------------------------------- /spec/controllers/api/filtrs_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Api::FiltersController do 4 | setup_fixtures do 5 | @user = User.make! 6 | @institution = Institution.make! user: @user 7 | end 8 | 9 | before(:each) { sign_in user } 10 | 11 | it "list filters" do 12 | filter = Filter.make!(user: user, query: { site: 1 }) 13 | 14 | get :index, format: 'json' 15 | expect(response.body).to eq([filter].to_json) 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/features/welcome_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "the login process" do 4 | it "existing user can login" do 5 | user = User.make! 6 | Institution.make! user: user 7 | 8 | goto_page HomePage do |page| 9 | page.form.user_name.set user.email 10 | page.form.password.set user.password 11 | page.form.login.click 12 | end 13 | 14 | expect(page).to have_content 'Signed in successfully' 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/fixtures/csvs/alere_q.csv.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/spec/fixtures/csvs/alere_q.csv.zip -------------------------------------------------------------------------------- /spec/fixtures/csvs/csv_box_1.csv: -------------------------------------------------------------------------------- 1 | Batch,Concentration,Distractor,Instructions,Replicates 2 | DISTRACTOR,10,no,Add 10ml,2 3 | DISTRACTOR,20,no,Add 10ml,2 4 | -------------------------------------------------------------------------------- /spec/fixtures/csvs/csv_box_2.csv: -------------------------------------------------------------------------------- 1 | Batch,Concentration,Distractor,Instructions,Replicates 2 | VIRUS,10,no,Add 10ml,2 3 | DISTRACTOR,10,yes,Add 10ml,2 4 | DISTRACTOR,20,yes,Add 10ml,2 5 | -------------------------------------------------------------------------------- /spec/fixtures/csvs/csv_box_no_headers.csv: -------------------------------------------------------------------------------- 1 | VIRUS,10,no,Add 10ml,2 2 | DISTRACTOR,10,yes,Add 10ml,2 3 | DISTRACTOR,20,yes,Add 10ml,2 4 | -------------------------------------------------------------------------------- /spec/fixtures/csvs/epicenter_headless_sample_utf16.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/spec/fixtures/csvs/epicenter_headless_sample_utf16.csv -------------------------------------------------------------------------------- /spec/fixtures/csvs/samples_results_1.csv: -------------------------------------------------------------------------------- 1 | 01234567-8ce1-a0c8-ac1b-58bed3633e88,10,positive 2 | -------------------------------------------------------------------------------- /spec/fixtures/csvs/samples_results_2.csv: -------------------------------------------------------------------------------- 1 | 01234567-8ce1-a0c8-ac1b-58bed3633e88,20,negative 2 | -------------------------------------------------------------------------------- /spec/fixtures/jsons/genexpert_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "result": "MTB DETECTED MEDIUM|Rif Resistance DETECTED", 4 | "assay_name": "MTB-RIF Assay G4_noQC1_2", 5 | "sample_ID": "A-1234-5", 6 | "system_user": "JaneDoe", 7 | "device_serial_number": "123456", 8 | "end_time": "2015-04-07T20:08:41-05:00", 9 | "start_time": "2015-04-07T18:31:20-05:00", 10 | "event_id": "76B4AFBA09A143718CED4767ACC4EAE7", 11 | "test_type": "0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/jsons/genexpert_sample_qc.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "result": "MTB DETECTED MEDIUM|Rif Resistance NOT DETECTED", 4 | "assay_name": "MTB-RIF Assay G4_noQC1_2", 5 | "sample_ID": "A-1234-6", 6 | "system_user": "JaneDoe", 7 | "device_serial_number": "123456", 8 | "end_time": "2015-04-08T20:08:41-05:00", 9 | "start_time": "2015-04-08T18:31:20-05:00", 10 | "event_id": "C6A54C7053C0458184325B1A6132A1A5", 11 | "test_type": "1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spec/mailers/device_mailer_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | RSpec.describe DeviceMailer, type: :mailer do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/mailers/previews/alert_mailer_preview.rb: -------------------------------------------------------------------------------- 1 | # Preview all emails at http://localhost:3000/rails/mailers/alert_mailer 2 | class AlertMailerPreview < ActionMailer::Preview 3 | 4 | end 5 | -------------------------------------------------------------------------------- /spec/mailers/previews/device_mailer_preview.rb: -------------------------------------------------------------------------------- 1 | # Preview all emails at http://localhost:3000/rails/mailers/device_mailer 2 | class DeviceMailerPreview < ActionMailer::Preview 3 | def setup_instructions 4 | device = Device.find(2) 5 | device.set_key 6 | DeviceMailer.setup_instructions(User.first, "jdoe@example.org", device) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/models/assay_attachment_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe AssayAttachment do 4 | it "validates presence of result or file" do 5 | attachment = AssayAttachment.make(result: nil, assay_file: nil) 6 | attachment.validate 7 | expect(attachment.errors).to have_key(:result) 8 | expect(attachment.errors).to have_key(:assay_file) 9 | attachment.result = "foo bar" 10 | attachment.validate 11 | expect(attachment.errors).to be_empty 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/models/encounters_schema_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe EncountersSchema do 4 | 5 | context "encounters fields" do 6 | 7 | it "renders all encounters scopes" do 8 | expect(EncountersSchema.new.build['properties'].keys).to contain_exactly("institution", "site", "patient", "encounter") 9 | end 10 | 11 | end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /spec/models/query_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Cdx::Api::Elasticsearch::Query do 4 | describe '#grouped_by' do 5 | it 'returns an array with the group by fields of this query' do 6 | query = Cdx::Api::Elasticsearch::Query.new({"group_by" => "field1,field2,field3"}, Cdx::Fields.test) 7 | expect(query.grouped_by.sort).to eq ['field1', 'field2', 'field3'] 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /spec/support/cdx_fields_helper.rb: -------------------------------------------------------------------------------- 1 | module CdxFieldsHelper 2 | 3 | def register_cdx_fields(data) 4 | expect(Cdx::Fields).to receive(:fields_data).and_wrap_original do |m, *args| 5 | m.call(*args).deep_merge("entities" => data.deep_stringify_keys) 6 | end.at_least(:once) 7 | Cdx::Fields.reload 8 | end 9 | 10 | def self.included(mod) 11 | mod.class_eval do 12 | before(:each) do 13 | Cdx::Fields.reload 14 | end 15 | end 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /spec/support/manifest_validation_context.rb: -------------------------------------------------------------------------------- 1 | shared_context "skip manifest validation", validate_manifest: false do 2 | 3 | before(:each) do 4 | allow_any_instance_of(Manifest).to receive(:manifest_validation) 5 | end 6 | 7 | end 8 | -------------------------------------------------------------------------------- /tmp/docker/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/tmp/docker/.keep -------------------------------------------------------------------------------- /vendor/assets/images/geocoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/vendor/assets/images/geocoder.png -------------------------------------------------------------------------------- /vendor/assets/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/vendor/assets/images/throbber.gif -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instedd/cdx/8b4c7f8701d64b15fe3718fe2f2a11482f9a726d/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------