From e60a40ddca172dd1f8d21a4cc13adb0ddfab6bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=83=D0=BB=D0=B0=D1=82=20=D0=A5=D0=B0=D0=B9=D1=80?= =?UTF-8?q?=D1=83=D0=BB=D0=BB=D0=B8=D0=BD?= Date: Tue, 12 Nov 2024 14:16:28 +0300 Subject: [PATCH 1/6] micord.env to test liquibase --- config/micord.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/micord.env b/config/micord.env index 1e356e1..d443adb 100644 --- a/config/micord.env +++ b/config/micord.env @@ -4,4 +4,4 @@ DB_APP_USERNAME=ervu_business_metrics DB_APP_PASSWORD=ervu_business_metrics DB_APP_HOST=10.10.31.119 DB_APP_PORT=5432 -DB_APP_NAME=ervu_bm_empty +DB_APP_NAME=ervu_test_bm From afe124d56288ca47753e6f3f25bd4e18e9ca0928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=83=D0=BB=D0=B0=D1=82=20=D0=A5=D0=B0=D0=B9=D1=80?= =?UTF-8?q?=D1=83=D0=BB=D0=BB=D0=B8=D0=BD?= Date: Tue, 12 Nov 2024 14:25:59 +0300 Subject: [PATCH 2/6] =?UTF-8?q?micord.env=20=D0=B2=D0=B5=D1=80=D0=BD=D1=83?= =?UTF-8?q?=D0=BB=20=D1=81=D1=82=D0=B0=D0=BD=D0=B4=D0=B0=D1=80=D1=82=D0=BD?= =?UTF-8?q?=D1=83=D1=8E=20=D0=B1=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/micord.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/micord.env b/config/micord.env index d443adb..a6cb5fe 100644 --- a/config/micord.env +++ b/config/micord.env @@ -4,4 +4,4 @@ DB_APP_USERNAME=ervu_business_metrics DB_APP_PASSWORD=ervu_business_metrics DB_APP_HOST=10.10.31.119 DB_APP_PORT=5432 -DB_APP_NAME=ervu_test_bm +DB_APP_NAME=ervu_business_metrics From 2f53bdf8fd6df8b6b6f777bcb164b4532a90f311 Mon Sep 17 00:00:00 2001 From: ilyin Date: Tue, 12 Nov 2024 15:10:50 +0300 Subject: [PATCH 3/6] convertation_view --- .../v_1.0/20241031-ERVU-168_create_db.xml | 89 +++++++++++++++++-- .../v_1.0/20241109-ERVU-168_update_db.xml | 30 ------- .../resources/config/v_1.0/changelog-1.0.xml | 1 - 3 files changed, 82 insertions(+), 38 deletions(-) delete mode 100644 backend/src/main/resources/config/v_1.0/20241109-ERVU-168_update_db.xml 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 From fbec64fcebe79c6e20d785aecc8183aa94278e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=83=D0=BB=D0=B0=D1=82=20=D0=A5=D0=B0=D0=B9=D1=80?= =?UTF-8?q?=D1=83=D0=BB=D0=BB=D0=B8=D0=BD?= Date: Tue, 12 Nov 2024 16:35:03 +0300 Subject: [PATCH 4/6] =?UTF-8?q?=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D1=8B?= =?UTF-8?q?=20=D1=81=D0=B8=D0=BD=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sync-backend.ps1 | 4 ++++ sync-frontend.ps1 | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 sync-backend.ps1 create mode 100644 sync-frontend.ps1 diff --git a/sync-backend.ps1 b/sync-backend.ps1 new file mode 100644 index 0000000..b4d79b7 --- /dev/null +++ b/sync-backend.ps1 @@ -0,0 +1,4 @@ +$DestDir = 'C:\work\ervu-business-metrics-backend' +$SourceDir = (Get-Location) + +robocopy $SourceDir $DestDir /S /mir /XF .npmrc sync-frontend.ps1 sync-backend.ps1 .gitignore .studioignore Dockerfile.pgs2 .gitlab-ci.yml config.md project.md system-requirements.md /XD $SourceDir\config .git target .studio $SourceDir\frontend\build $SourceDir\frontend\build_dev $SourceDir\frontend\dist \ No newline at end of file diff --git a/sync-frontend.ps1 b/sync-frontend.ps1 new file mode 100644 index 0000000..17044a3 --- /dev/null +++ b/sync-frontend.ps1 @@ -0,0 +1,4 @@ +$DestDir = 'C:\work\ervu-business-metrics-frontend' +$SourceDir = (Get-Location) + +robocopy $SourceDir $DestDir /S /mir /XF .npmrc sync-frontend.ps1 sync-backend.ps1 .gitignore .studioignore Dockerfile.pgs2 .gitlab-ci.yml config.md project.md system-requirements.md /XD $SourceDir\config .git target .studio $SourceDir\frontend\build $SourceDir\frontend\build_dev $SourceDir\frontend\dist \ No newline at end of file From c68b9f549dc406e205d8f421267ae89188fa0cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=83=D0=BB=D0=B0=D1=82=20=D0=A5=D0=B0=D0=B9=D1=80?= =?UTF-8?q?=D1=83=D0=BB=D0=BB=D0=B8=D0=BD?= Date: Tue, 12 Nov 2024 16:36:59 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D1=8B?= =?UTF-8?q?=20=D1=81=D0=B8=D0=BD=D0=BA=D0=B0=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sync-backend.ps1 | 2 +- sync-frontend.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sync-backend.ps1 b/sync-backend.ps1 index b4d79b7..0d43c91 100644 --- a/sync-backend.ps1 +++ b/sync-backend.ps1 @@ -1,4 +1,4 @@ $DestDir = 'C:\work\ervu-business-metrics-backend' $SourceDir = (Get-Location) -robocopy $SourceDir $DestDir /S /mir /XF .npmrc sync-frontend.ps1 sync-backend.ps1 .gitignore .studioignore Dockerfile.pgs2 .gitlab-ci.yml config.md project.md system-requirements.md /XD $SourceDir\config .git target .studio $SourceDir\frontend\build $SourceDir\frontend\build_dev $SourceDir\frontend\dist \ No newline at end of file +robocopy $SourceDir $DestDir /S /mir /XF .npmrc sync-frontend.ps1 sync-backend.ps1 .gitignore .studioignore Dockerfile.pgs2 .gitlab-ci.yml config.md project.md system-requirements.md /XD $SourceDir\config .git target .studio $SourceDir\frontend\build $SourceDir\frontend\build_dev $SourceDir\frontend\dist $SourceDir\frontend\node_modules \ No newline at end of file diff --git a/sync-frontend.ps1 b/sync-frontend.ps1 index 17044a3..92e0f2d 100644 --- a/sync-frontend.ps1 +++ b/sync-frontend.ps1 @@ -1,4 +1,4 @@ $DestDir = 'C:\work\ervu-business-metrics-frontend' $SourceDir = (Get-Location) -robocopy $SourceDir $DestDir /S /mir /XF .npmrc sync-frontend.ps1 sync-backend.ps1 .gitignore .studioignore Dockerfile.pgs2 .gitlab-ci.yml config.md project.md system-requirements.md /XD $SourceDir\config .git target .studio $SourceDir\frontend\build $SourceDir\frontend\build_dev $SourceDir\frontend\dist \ No newline at end of file +robocopy $SourceDir $DestDir /S /mir /XF .npmrc sync-frontend.ps1 sync-backend.ps1 .gitignore .studioignore Dockerfile.pgs2 .gitlab-ci.yml config.md project.md system-requirements.md /XD $SourceDir\config .git target .studio $SourceDir\frontend\build $SourceDir\frontend\build_dev $SourceDir\frontend\dist $SourceDir\frontend\node_modules \ No newline at end of file From aecae4c01524569432ba18c614aac1ca35a5a5a2 Mon Sep 17 00:00:00 2001 From: ilyin Date: Tue, 12 Nov 2024 16:37:11 +0300 Subject: [PATCH 6/6] ERVU-168 --- .../v_1.0/20241031-ERVU-168_create_db.xml | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) 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 6bb6163..376d499 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 @@ -420,6 +420,13 @@ CREATE INDEX IF NOT EXISTS idx_records_info_id_uk_id_ern_date ON init_registration_info.records_info_id_uk_id_ern (info_date); CREATE INDEX IF NOT EXISTS idx_records_info_id_uk_id_ern_recr ON init_registration_info.records_info_id_uk_id_ern (recruitment_id); CREATE INDEX IF NOT EXISTS idx_records_info_id_uk_id_ern_recr_date ON init_registration_info.records_info_id_uk_id_ern (recruitment_id, info_date); + + CREATE OR REPLACE VIEW init_registration_info.view_records_info_id_uk_id_ern AS + SELECT + 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 + FROM init_registration_info.records_info_id_uk_id_ern; CREATE TABLE IF NOT EXISTS init_registration_info.info_sent_to_lk_epgu @@ -475,6 +482,15 @@ CREATE INDEX IF NOT EXISTS idx_decision_formation_status_date ON init_registration_info.decision_formation_status (info_date); CREATE INDEX IF NOT EXISTS idx_decision_formation_status_recr ON init_registration_info.decision_formation_status (recruitment_id); CREATE INDEX IF NOT EXISTS idx_decision_formation_status_recr_date ON init_registration_info.decision_formation_status (recruitment_id, info_date); + + CREATE OR REPLACE VIEW init_registration_info.view_decision_formation_status AS + SELECT + 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, + round(count_waiting_sign::numeric * 100 / (count_signed + count_suggested + count_waiting_sign + count_refused)) AS percent_waiting_sign, + round(count_refused::numeric * 100 / (count_signed + count_suggested + count_waiting_sign + count_refused)) AS percent_refused + FROM init_registration_info.decision_formation_status; CREATE TABLE IF NOT EXISTS init_registration_info.incidents_info @@ -540,7 +556,7 @@ 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 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 'Не назначен исполнитель в пределах допустимых сроков'; @@ -552,6 +568,18 @@ 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); CREATE INDEX IF NOT EXISTS idx_applications_received_from_epgu_recr_date ON init_registration_info.applications_received_from_epgu (recruitment_id, info_date); + + CREATE OR REPLACE VIEW init_registration_info.view_applications_received_from_epgu AS + SELECT + 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, + round(count_refusal_provide_service::numeric * 100 / count_all) AS percent_refusal_provide_service, + round(count_executor_not_appointed_expired::numeric * 100 / count_all) AS percent_executor_not_appointed_expired, + round(count_executor_not_appointed_on_time::numeric * 100 / count_all) AS percent_executor_not_appointed_on_time, + round(count_received::numeric * 100 / count_all) AS percent_received, + round(count_provided::numeric * 100 / count_all) AS percent_provided + FROM init_registration_info.applications_received_from_epgu; CREATE TABLE IF NOT EXISTS init_registration_info.statuses_decisions_on_epgu @@ -573,6 +601,13 @@ 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 OR REPLACE VIEW init_registration_info.view_statuses_decisions_on_epgu AS + SELECT + 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; + + CREATE TABLE IF NOT EXISTS metrics.criminal_administrative_liability ( criminal_administrative_liability_id bigserial NOT NULL PRIMARY KEY,