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 f45b2d7..fcaffee 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 @@ -218,18 +218,24 @@ recruitment_id varchar(36) NOT NULL constraint fk_conv_info_records_from_easu_recruitment_id references metrics.recruitment, update_date timestamp without time zone NOT NULL DEFAULT now(), info_date date NOT NULL, - count_all bigint NOT NULL DEFAULT 0, count_unique bigint NOT NULL DEFAULT 0, count_identified bigint NOT NULL DEFAULT 0 ) WITH (OIDS = FALSE); ALTER TABLE IF EXISTS metrics.convert_info_records_from_easu OWNER to ervu_business_metrics; - COMMENT ON TABLE metrics.convert_info_records_from_easu IS 'Загрузка Данных из ЕАСУ "ГОризонт-М"'; + COMMENT ON TABLE metrics.convert_info_records_from_easu IS 'Загрузка Данных из ЕАСУ "Горизонт-М"'; CREATE INDEX IF NOT EXISTS idx_convert_info_records_from_easu_date ON metrics.convert_info_records_from_easu (info_date); CREATE INDEX IF NOT EXISTS idx_convert_info_records_from_easu_recr ON metrics.convert_info_records_from_easu (recruitment_id); CREATE INDEX IF NOT EXISTS idx_convert_info_records_from_easu_recr_date ON metrics.convert_info_records_from_easu (recruitment_id, info_date); + + 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 + FROM metrics.convert_info_records_from_easu; CREATE TABLE IF NOT EXISTS metrics.convert_info_not_identifited_records ( @@ -248,6 +254,13 @@ CREATE INDEX IF NOT EXISTS idx_convert_info_not_identifited_records_date ON metrics.convert_info_not_identifited_records (info_date); CREATE INDEX IF NOT EXISTS idx_convert_info_not_identifited_records_recr ON metrics.convert_info_not_identifited_records (recruitment_id); CREATE INDEX IF NOT EXISTS idx_convert_info_not_identifited_records_recr_date ON metrics.convert_info_not_identifited_records (recruitment_id, info_date); + + CREATE OR REPLACE VIEW metrics.view_convert_info_not_identifited_records AS + SELECT + 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 + FROM metrics.convert_info_not_identifited_records; CREATE TABLE IF NOT EXISTS metrics.convert_info_loaded_records @@ -267,6 +280,13 @@ CREATE INDEX IF NOT EXISTS idx_convert_info_loaded_records_date ON metrics.convert_info_loaded_records (info_date); CREATE INDEX IF NOT EXISTS idx_convert_info_loaded_records_recr ON metrics.convert_info_loaded_records (recruitment_id); CREATE INDEX IF NOT EXISTS idx_convert_info_loaded_records_recr_date ON metrics.convert_info_loaded_records (recruitment_id, info_date); + + CREATE OR REPLACE VIEW metrics.view_convert_info_loaded_records AS + SELECT + 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 + FROM metrics.convert_info_loaded_records; CREATE TABLE IF NOT EXISTS metrics.convert_info_common_results @@ -306,11 +326,22 @@ WITH (OIDS = FALSE); ALTER TABLE IF EXISTS metrics.convert_info_sent_to_lk_epgu OWNER to ervu_business_metrics; - COMMENT ON TABLE metrics.convert_info_sent_to_lk_epgu IS 'Конвертация. ДОставка уведомлений в ЛК на ЕПГУ'; + COMMENT ON TABLE metrics.convert_info_sent_to_lk_epgu IS 'Конвертация. Доставка уведомлений в ЛК на ЕПГУ'; CREATE INDEX IF NOT EXISTS idx_convert_info_sent_to_lk_epgu_date ON metrics.convert_info_sent_to_lk_epgu (info_date); CREATE INDEX IF NOT EXISTS idx_convert_info_sent_to_lk_epgu_recr ON metrics.convert_info_sent_to_lk_epgu (recruitment_id); CREATE INDEX IF NOT EXISTS idx_convert_info_sent_to_lk_epgu_recr_date ON metrics.convert_info_sent_to_lk_epgu (recruitment_id, info_date); + + CREATE OR REPLACE VIEW metrics.view_convert_info_sent_to_lk_epgu AS + SELECT + 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, + round(count_delivered::numeric * 100 / (count_status_formed + count_status_not_formed)) AS percent_delivered, + round(count_error::numeric * 100 / (count_status_formed + count_status_not_formed)) AS percent_error, + round(count_viewed::numeric * 100 / (count_status_formed + count_status_not_formed)) AS percent_viewed, + round(count_not_viewed::numeric * 100 / (count_status_formed + count_status_not_formed)) AS percent_not_viewed + FROM metrics.convert_info_sent_to_lk_epgu; CREATE TABLE IF NOT EXISTS metrics.convert_info_comparison_csv_xml @@ -320,7 +351,7 @@ update_date timestamp without time zone NOT NULL DEFAULT now(), info_date date NOT NULL, count_xml_formed bigint NOT NULL DEFAULT 0, - count_csv bigint NOT NULL DEFAULT 0 + count_csv_formed bigint NOT NULL DEFAULT 0 ) WITH (OIDS = FALSE); ALTER TABLE IF EXISTS metrics.convert_info_comparison_csv_xml OWNER to ervu_business_metrics; @@ -330,6 +361,13 @@ CREATE INDEX IF NOT EXISTS idx_convert_info_comparison_csv_xml_date ON metrics.convert_info_comparison_csv_xml (info_date); CREATE INDEX IF NOT EXISTS idx_convert_info_comparison_csv_xml_recr ON metrics.convert_info_comparison_csv_xml (recruitment_id); CREATE INDEX IF NOT EXISTS idx_convert_info_comparison_csv_xml_recr_date ON metrics.convert_info_comparison_csv_xml (recruitment_id, info_date); + + 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 + FROM metrics.convert_info_comparison_csv_xml; @@ -403,7 +441,7 @@ WITH (OIDS = FALSE); ALTER TABLE IF EXISTS init_registration_info.info_sent_to_lk_epgu OWNER to ervu_business_metrics; - COMMENT ON TABLE init_registration_info.info_sent_to_lk_epgu IS 'Первоначальная постановка на учет. ДОставка уведомлений в ЛК на ЕПГУ'; + COMMENT ON TABLE init_registration_info.info_sent_to_lk_epgu IS 'Первоначальная постановка на учет. Доставка уведомлений в ЛК на ЕПГУ'; COMMENT ON COLUMN init_registration_info.info_sent_to_lk_epgu.info_source IS 'информация об источнике - PERSONAL_VISIT, GIR_VU, EPGU'; COMMENT ON COLUMN init_registration_info.info_sent_to_lk_epgu.info_age IS 'Информациия о каком возрасте 17_YEARS, 18_YEAR'; @@ -423,7 +461,8 @@ info_age varchar NOT NULL, count_signed bigint NOT NULL DEFAULT 0, count_suggested bigint NOT NULL DEFAULT 0, - count_waiting_sign bigint NOT NULL DEFAULT 0 + count_waiting_sign bigint NOT NULL DEFAULT 0, + count_refused bigint NOT NULL DEFAULT 0 ) WITH (OIDS = FALSE); ALTER TABLE IF EXISTS init_registration_info.decision_formation_status OWNER to ervu_business_metrics; @@ -492,12 +531,23 @@ count_executor_appointed bigint NOT NULL DEFAULT 0, count_registered bigint NOT NULL DEFAULT 0, count_registration_refusal bigint NOT NULL DEFAULT 0, - count_refusal_provide_service bigint NOT NULL DEFAULT 0 + count_refusal_provide_service bigint NOT NULL DEFAULT 0, + count_executor_not_appointed_expired bigint NOT NULL DEFAULT 0, + count_executor_not_appointed_on_time bigint NOT NULL DEFAULT 0, + count_received bigint NOT NULL DEFAULT 0, + count_provided bigint NOT NULL DEFAULT 0 ) WITH (OIDS = FALSE); ALTER TABLE IF EXISTS init_registration_info.applications_received_from_epgu OWNER to ervu_business_metrics; COMMENT ON TABLE init_registration_info.applications_received_from_epgu IS 'Первоначальная постановка на учет. Первоначальная постановка на учет по данным из ГИР ВУ'; + + COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_executor_not_appointed_expired IS 'Не назначен исполнитель свыше допустимых сроков (просрочено)'; + COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_executor_not_appointed_on_time IS 'Не назначен исполнитель в пределах допустимых сроков'; + COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_received IS 'Заявление получено ведомством'; + COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_registration_refusal IS 'Получен отказ в регистрации'; + COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_refusal_provide_service IS 'Получен отказ в предоставлении услуги по заявлению'; + COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_provided IS 'Услуга по заявлению оказана'; CREATE INDEX IF NOT EXISTS idx_applications_received_from_epgu_date ON init_registration_info.applications_received_from_epgu (info_date); CREATE INDEX IF NOT EXISTS idx_applications_received_from_epgu_recr ON init_registration_info.applications_received_from_epgu (recruitment_id); @@ -522,6 +572,31 @@ CREATE INDEX IF NOT EXISTS idx_statuses_decisions_on_epgu_date ON init_registration_info.statuses_decisions_on_epgu (info_date); CREATE INDEX IF NOT EXISTS idx_statuses_decisions_on_epgu_recr ON init_registration_info.statuses_decisions_on_epgu (recruitment_id); CREATE INDEX IF NOT EXISTS idx_statuses_decisions_on_epgu_recr_date ON init_registration_info.statuses_decisions_on_epgu (recruitment_id, info_date); + + CREATE TABLE IF NOT EXISTS metrics.criminal_administrative_liability + ( + criminal_administrative_liability_id bigserial NOT NULL PRIMARY KEY, + recruitment_id varchar(36) NOT NULL constraint fk_criminal_administrative_liability_recruitment_id references metrics.recruitment, + update_date timestamp without time zone NOT NULL DEFAULT now(), + info_date date NOT NULL, + count_administrative bigint NOT NULL DEFAULT 0, + count_criminal bigint NOT NULL DEFAULT 0 + ) + WITH (OIDS = FALSE); + ALTER TABLE IF EXISTS metrics.criminal_administrative_liability OWNER to ervu_business_metrics; + + COMMENT ON TABLE metrics.criminal_administrative_liability IS 'Учет уголовной, административной ответственности'; + + CREATE INDEX IF NOT EXISTS idx_criminal_administrative_liability_date ON metrics.criminal_administrative_liability (info_date); + CREATE INDEX IF NOT EXISTS idx_criminal_administrative_liability_recr ON metrics.criminal_administrative_liability (recruitment_id); + CREATE INDEX IF NOT EXISTS idx_criminal_administrative_liability_recr_date ON metrics.criminal_administrative_liability (recruitment_id, info_date); + + CREATE OR REPLACE VIEW metrics.view_criminal_administrative_liability AS + SELECT + 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 + FROM metrics.criminal_administrative_liability; diff --git a/backend/src/main/resources/config/v_1.0/20241109-ERVU-168_update_db.xml b/backend/src/main/resources/config/v_1.0/20241109-ERVU-168_update_db.xml deleted file mode 100644 index d62b889..0000000 --- a/backend/src/main/resources/config/v_1.0/20241109-ERVU-168_update_db.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - add columns - - ALTER TABLE init_registration_info.decision_formation_status ADD COLUMN IF NOT EXISTS count_refused bigint NOT NULL DEFAULT 0; - - ALTER TABLE init_registration_info.applications_received_from_epgu ADD COLUMN IF NOT EXISTS count_executor_not_appointed_expired bigint NOT NULL DEFAULT 0; - ALTER TABLE init_registration_info.applications_received_from_epgu ADD COLUMN IF NOT EXISTS count_executor_not_appointed_on_time bigint NOT NULL DEFAULT 0; - ALTER TABLE init_registration_info.applications_received_from_epgu ADD COLUMN IF NOT EXISTS count_received bigint NOT NULL DEFAULT 0; - ALTER TABLE init_registration_info.applications_received_from_epgu ADD COLUMN IF NOT EXISTS count_provided bigint NOT NULL DEFAULT 0; - - COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_executor_not_appointed_expired IS 'Не назначен исполнитель свыше допустимых сроков (просрочено)'; - COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_executor_not_appointed_on_time IS 'Не назначен исполнитель в пределах допустимых сроков'; - COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_received IS 'Заявление получено ведомством'; - COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_registration_refusal IS 'Получен отказ в регистрации'; - COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_refusal_provide_service IS 'Получен отказ в предоставлении услуги по заявлению'; - COMMENT ON COLUMN init_registration_info.applications_received_from_epgu.count_provided IS 'Услуга по заявлению оказана'; - - - - - - - \ No newline at end of file diff --git a/backend/src/main/resources/config/v_1.0/changelog-1.0.xml b/backend/src/main/resources/config/v_1.0/changelog-1.0.xml index 5351e77..1b42fdb 100644 --- a/backend/src/main/resources/config/v_1.0/changelog-1.0.xml +++ b/backend/src/main/resources/config/v_1.0/changelog-1.0.xml @@ -6,6 +6,5 @@ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> - \ No newline at end of file