Merge remote-tracking branch 'origin/develop' into ervu/tmp_makets

* origin/develop:
  ERVU-168
  скрипты синка fix
  скрипты синка
  convertation_view
  micord.env вернул стандартную бд
  micord.env to test liquibase
This commit is contained in:
Фоат Саляхов 2024-11-13 09:45:03 +03:00
commit 17af0c82a9
6 changed files with 127 additions and 40 deletions

View file

@ -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;
</sql>
</changeSet>
@ -382,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
@ -403,7 +448,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 +468,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;
@ -436,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
@ -492,16 +547,39 @@
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 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);
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
@ -522,6 +600,38 @@
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 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,
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;
</sql>
</changeSet>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<changeSet id="0001" author="ilyin">
<comment>add columns</comment>
<sql>
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 'Услуга по заявлению оказана';
</sql>
</changeSet>
</databaseChangeLog>

View file

@ -6,6 +6,5 @@
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<include file="20241031-ERVU-168_create_db.xml" relativeToChangelogFile="true"/>
<include file="20241109-ERVU-168_update_db.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View file

@ -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_business_metrics

4
sync-backend.ps1 Normal file
View file

@ -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 $SourceDir\frontend\node_modules

4
sync-frontend.ps1 Normal file
View file

@ -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 $SourceDir\frontend\node_modules