From fb7e7b12408bbf1dacae23e6766e06779b25dad4 Mon Sep 17 00:00:00 2001 From: ilyin Date: Wed, 13 Nov 2024 12:03:09 +0300 Subject: [PATCH] ERVU-168_first_registration_database --- .../v_1.0/20241031-ERVU-168_create_db.xml | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/backend/src/main/resources/config/v_1.0/20241031-ERVU-168_create_db.xml b/backend/src/main/resources/config/v_1.0/20241031-ERVU-168_create_db.xml index 376d499..02c904d 100644 --- a/backend/src/main/resources/config/v_1.0/20241031-ERVU-168_create_db.xml +++ b/backend/src/main/resources/config/v_1.0/20241031-ERVU-168_create_db.xml @@ -219,7 +219,7 @@ update_date timestamp without time zone NOT NULL DEFAULT now(), info_date date NOT NULL, count_unique bigint NOT NULL DEFAULT 0, - count_identified bigint NOT NULL DEFAULT 0 + count_flk_and_duplicate bigint NOT NULL DEFAULT 0 ) WITH (OIDS = FALSE); ALTER TABLE IF EXISTS metrics.convert_info_records_from_easu OWNER to ervu_business_metrics; @@ -232,9 +232,10 @@ CREATE OR REPLACE VIEW metrics.view_convert_info_records_from_easu AS SELECT - count_unique + count_identified AS count_all, - round(count_unique::numeric * 100 / (count_unique + count_identified)) AS percent_unique, - round(count_identified::numeric * 100 / (count_unique + count_identified)) AS percent_identified + convert_info_records_from_easu_id, + count_unique + count_flk_and_duplicate AS count_all, + round(count_unique::numeric * 100 / (count_unique + count_flk_and_duplicate)) AS percent_unique, + round(count_flk_and_duplicate::numeric * 100 / (count_unique + count_flk_and_duplicate)) AS percent_flk_and_duplicate FROM metrics.convert_info_records_from_easu; CREATE TABLE IF NOT EXISTS metrics.convert_info_not_identifited_records @@ -257,6 +258,7 @@ CREATE OR REPLACE VIEW metrics.view_convert_info_not_identifited_records AS SELECT + convert_info_not_identifited_records_id, count_not_in_csv + count_not_in_xml AS count_all, round(count_not_in_xml::numeric * 100 / (count_not_in_csv + count_not_in_xml)) AS percent_not_in_xml, round(count_not_in_csv::numeric * 100 / (count_not_in_csv + count_not_in_xml)) AS percent_not_in_csv @@ -283,6 +285,7 @@ CREATE OR REPLACE VIEW metrics.view_convert_info_loaded_records AS SELECT + convert_info_loaded_records_id, count_success + count_error AS count_all, round(count_error::numeric * 100 / (count_success + count_error)) AS percent_error, round(count_success::numeric * 100 / (count_success + count_error)) AS percent_success @@ -334,6 +337,7 @@ CREATE OR REPLACE VIEW metrics.view_convert_info_sent_to_lk_epgu AS SELECT + convert_info_sent_to_lk_epgu_id, round(count_status_formed::numeric * 100 / (count_status_formed + count_status_not_formed)) AS percent_status_formed, round(count_status_not_formed::numeric * 100 / (count_status_formed + count_status_not_formed)) AS percent_status_not_formed, round(count_sended::numeric* 100 / (count_status_formed + count_status_not_formed)) AS percent_sended, @@ -364,9 +368,8 @@ CREATE OR REPLACE VIEW metrics.view_convert_info_comparison_csv_xml AS SELECT - count_xml_formed + count_csv_formed AS count_all, - round(count_csv_formed::numeric * 100 / (count_xml_formed + count_csv_formed)) AS percent_csv_formed, - round(count_xml_formed::numeric * 100 / (count_xml_formed + count_csv_formed)) AS percent_xml_formed + convert_info_comparison_csv_xml_id, + round(count_csv_formed::numeric * 100 / count_xml_formed ) AS percent_csv_formed FROM metrics.convert_info_comparison_csv_xml; @@ -423,6 +426,7 @@ CREATE OR REPLACE VIEW init_registration_info.view_records_info_id_uk_id_ern AS SELECT + records_info_id_uk_id_ern_id, round(records_with_id_uk::numeric * 100 / count_all) AS percent_with_id_uk, round(records_without_id_uk::numeric * 100 / count_all) AS percent_without_id_uk, round(records_with_id_ern::numeric * 100 / count_all) AS percent_with_id_ern @@ -485,6 +489,7 @@ CREATE OR REPLACE VIEW init_registration_info.view_decision_formation_status AS SELECT + decision_formation_status_id, count_signed + count_suggested + count_waiting_sign + count_refused AS count_all, round(count_signed::numeric * 100 / (count_signed + count_suggested + count_waiting_sign + count_refused)) AS percent_signed, round(count_suggested::numeric * 100 / (count_signed + count_suggested + count_waiting_sign + count_refused)) AS percent_suggested, @@ -511,10 +516,17 @@ COMMENT ON COLUMN init_registration_info.incidents_info.info_source IS 'информация об источнике - PERSONAL_VISIT, EPGU'; COMMENT ON COLUMN init_registration_info.incidents_info.info_age IS 'Информациия о каком возрасте 17_YEARS, 18_YEAR'; - CREATE INDEX IF NOT EXISTS idx_incidents_info_date ON init_registration_info.incidents_info (info_date); CREATE INDEX IF NOT EXISTS idx_incidents_info_recr ON init_registration_info.incidents_info (recruitment_id); CREATE INDEX IF NOT EXISTS idx_incidents_info_recr_date ON init_registration_info.incidents_info (recruitment_id, info_date); + + CREATE OR REPLACE VIEW init_registration_info.view_incidents_info AS + SELECT + incidents_info_id, + count_without_id_ern + count_discrepancy_epgu_info AS count_all, + round(count_without_id_ern::numeric * 100 / (count_without_id_ern + count_discrepancy_epgu_info)) AS percent_without_id_ern, + round(count_discrepancy_epgu_info::numeric * 100 / (count_without_id_ern + count_discrepancy_epgu_info)) AS percent_discrepancy_epgu_info + FROM init_registration_info.incidents_info; CREATE TABLE IF NOT EXISTS init_registration_info.init_registration_from_gir_vu @@ -571,6 +583,7 @@ CREATE OR REPLACE VIEW init_registration_info.view_applications_received_from_epgu AS SELECT + applications_received_from_epgu_id, round(count_executor_appointed::numeric * 100 / count_all) AS percent_executor_appointed, round(count_registered::numeric * 100 / count_all) AS percent_registered, round(count_registration_refusal::numeric * 100 / count_all) AS percent_registration_refusal, @@ -603,6 +616,7 @@ CREATE OR REPLACE VIEW init_registration_info.view_statuses_decisions_on_epgu AS SELECT + statuses_decisions_on_epgu_id, round(count_signed::numeric * 100 / count_loaded) AS percent_signed, round(count_formed_for_signing::numeric * 100 / count_loaded) AS percent_formed_for_signing FROM init_registration_info.statuses_decisions_on_epgu; @@ -628,6 +642,7 @@ CREATE OR REPLACE VIEW metrics.view_criminal_administrative_liability AS SELECT + criminal_administrative_liability_id, count_administrative + count_criminal AS count_all, round(count_criminal::numeric * 100 / (count_administrative + count_criminal)) AS percent_criminal, round(count_administrative::numeric * 100 / (count_administrative + count_criminal)) AS percent_administrative