Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore mambaetl #45

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9ce7760
Restore MambaETL changes
Jul 19, 2023
450d85a
Rwanda dimennsions
Jul 20, 2023
fc36c65
Formats and script cleanups
smallgod Jul 21, 2023
bf5dc09
Call the right ETL script
smallgod Jul 21, 2023
c9227ce
reset liquibase changeset id
smallgod Jul 21, 2023
fe71dc1
Resolve parse date Error
smallgod Jul 21, 2023
0a47ae9
Change type of date
smallgod Jul 21, 2023
843749c
Adds DATETIME type to report query
smallgod Jul 22, 2023
5451476
increment liquibase id
smallgod Jul 22, 2023
80d4fe9
Adds moh-billing report insurance columns
smallgod Aug 19, 2023
9f3b72d
Adds flattening logic for billing reports
smallgod Aug 20, 2023
39f5588
Add extra group columns to report query
smallgod Aug 20, 2023
6028c82
rectify issue with date param in query
smallgod Aug 21, 2023
f1d2538
Rebase - Upgrade MambaETL dependency entries
smallgod Aug 26, 2023
a1c42d6
Rebase - Adds lab encounter type to flatten
smallgod Sep 15, 2023
caf47f3
Remove redundant column from reports config
smallgod Sep 15, 2023
0bf88b7
Adds condition to UPDATE statements
smallgod Sep 15, 2023
54e1104
Remove non-null restriction on service_bill table
smallgod Sep 15, 2023
52b69c4
Removes non-null restriction for new models in billing module
smallgod Sep 15, 2023
e6cdc39
Adds support for separate analysis DB
smallgod Sep 29, 2023
9bffee2
Adds analysis db support
smallgod Oct 2, 2023
c966794
rebase - Upgraded MambaETL version to May-7th-2024 version
smallgod Jun 30, 2024
ab6264c
rebase - Set ETL to use same database as transactional data
smallgod Jul 1, 2024
21472fb
rebase - Updated module to reflect new Mamba changes
smallgod Aug 15, 2024
8b8a21f
Removed hardcoded service Id values
smallgod Aug 15, 2024
b392256
Fixed issue with unexpected naming
smallgod Aug 15, 2024
7458c26
added support to fetch insurance report via API
smallgod Aug 16, 2024
cda630d
Shutdown ETL threads upon module shutdown
smallgod Aug 16, 2024
1b45556
Changed order of dropping tables to resolve FK issue
smallgod Aug 16, 2024
06d96e8
rebase - corrected table name
smallgod Aug 18, 2024
05fe73a
modified report name
smallgod Aug 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change type of date
  • Loading branch information
smallgod committed Jan 16, 2025
commit 0a47ae95bcffdf6dcd6a5e69ecc9d501867d9fed
37 changes: 18 additions & 19 deletions api/src/main/resources/mamba/create_stored_procedures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4969,25 +4969,24 @@ INSERT INTO mamba_fact_patient_service_bill(admission_date, closing_date, benefi
gender, doctor_name, service_bill_quantity, service_bill_unit_price,
insurance_id, hop_service_id, global_bill_id, hop_service_name)

SELECT -- DATE_FORMAT(gb.created_date, '%d/%m/%Y') AS admission_date,
DATE(gb.created_date) AS admission_date,
DATE(gb.closing_date) AS closing_date,
bps.person_name_long AS beneficiary_name,
ben.owner_name AS household_head_name,
ben.owner_code AS family_code,
ben.level AS beneficiary_level,
isp.insurance_card_no AS card_number,
ben.company AS company_name,
bps.age AS age,
DATE(bps.birthdate) AS birth_date,
bps.gender AS gender,
gb.closed_by_name AS doctor_name,
psb.quantity AS service_bill_quantity,
psb.unit_price AS service_bill_unit_price,
ins.insurance_id AS insurance_id,
psb.service_id AS hop_service_id,
gb.global_bill_id AS global_bill_id,
hp.name AS hop_service_name
SELECT DATE(DATE_FORMAT(gb.created_date, '%m/%d/%Y')) AS admission_date,
DATE(DATE_FORMAT(gb.closing_date, '%m/%d/%Y')) AS closing_date,
bps.person_name_long AS beneficiary_name,
ben.owner_name AS household_head_name,
ben.owner_code AS family_code,
ben.level AS beneficiary_level,
isp.insurance_card_no AS card_number,
ben.company AS company_name,
bps.age AS age,
DATE(DATE_FORMAT(bps.birthdate, '%m/%d/%Y')) AS birth_date,
bps.gender AS gender,
gb.closed_by_name AS doctor_name,
psb.quantity AS service_bill_quantity,
psb.unit_price AS service_bill_unit_price,
ins.insurance_id AS insurance_id,
psb.service_id AS hop_service_id,
gb.global_bill_id AS global_bill_id,
hp.name AS hop_service_name

FROM mamba_dim_patient_service_bill psb
INNER JOIN mamba_dim_consommation cons ON psb.consommation_id = cons.consommation_id
Expand Down
37 changes: 18 additions & 19 deletions api/src/main/resources/mamba/liquibase_create_stored_procedures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4817,25 +4817,24 @@ INSERT INTO mamba_fact_patient_service_bill(admission_date, closing_date, benefi
gender, doctor_name, service_bill_quantity, service_bill_unit_price,
insurance_id, hop_service_id, global_bill_id, hop_service_name)

SELECT -- DATE_FORMAT(gb.created_date, '%d/%m/%Y') AS admission_date,
DATE(gb.created_date) AS admission_date,
DATE(gb.closing_date) AS closing_date,
bps.person_name_long AS beneficiary_name,
ben.owner_name AS household_head_name,
ben.owner_code AS family_code,
ben.level AS beneficiary_level,
isp.insurance_card_no AS card_number,
ben.company AS company_name,
bps.age AS age,
DATE(bps.birthdate) AS birth_date,
bps.gender AS gender,
gb.closed_by_name AS doctor_name,
psb.quantity AS service_bill_quantity,
psb.unit_price AS service_bill_unit_price,
ins.insurance_id AS insurance_id,
psb.service_id AS hop_service_id,
gb.global_bill_id AS global_bill_id,
hp.name AS hop_service_name
SELECT DATE(DATE_FORMAT(gb.created_date, '%m/%d/%Y')) AS admission_date,
DATE(DATE_FORMAT(gb.closing_date, '%m/%d/%Y')) AS closing_date,
bps.person_name_long AS beneficiary_name,
ben.owner_name AS household_head_name,
ben.owner_code AS family_code,
ben.level AS beneficiary_level,
isp.insurance_card_no AS card_number,
ben.company AS company_name,
bps.age AS age,
DATE(DATE_FORMAT(bps.birthdate, '%m/%d/%Y')) AS birth_date,
bps.gender AS gender,
gb.closed_by_name AS doctor_name,
psb.quantity AS service_bill_quantity,
psb.unit_price AS service_bill_unit_price,
ins.insurance_id AS insurance_id,
psb.service_id AS hop_service_id,
gb.global_bill_id AS global_bill_id,
hp.name AS hop_service_name

FROM mamba_dim_patient_service_bill psb
INNER JOIN mamba_dim_consommation cons ON psb.consommation_id = cons.consommation_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ CREATE TABLE IF NOT EXISTS mamba_dim_admission
admission_id INT NOT NULL,
insurance_policy_id int not null,
is_admitted tinyint(1) not null,
admission_date datetime not null,
discharging_date datetime null,
admission_date DATETIME not null,
discharging_date DATETIME null,
discharged_by int null,
disease_type varchar(100) null,
admission_type tinyint(1) null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ CREATE TABLE IF NOT EXISTS mamba_dim_bill_payment
bill_payment_id INT NOT NULL,
patient_bill_id int not null,
amount_paid decimal(20, 2) not null,
date_received datetime null,
date_received DATETIME null,
collector int not null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS mamba_dim_billable_service
maxima_to_pay decimal(20, 2) null,
start_date date not null,
end_date date null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS mamba_dim_department
department_id INT NOT NULL,
name varchar(50) null,
description varchar(50) null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ CREATE TABLE mamba_dim_global_bill
(
id INT NOT NULL AUTO_INCREMENT,
global_bill_id INT NOT NULL,
admission_id int not null,
insurance_id int null,
bill_identifier varchar(250) not null,
global_amount decimal not null,
closing_date datetime null,
closed TINYINT(1) not null,
closed_by_id int null,
closed_by_name varchar(255) null,
closed_reason varchar(150) null,
edited_by int null,
edit_reason varchar(150) null,
created_date datetime not null,
admission_id INT NOT NULL,
insurance_id INT null,
bill_identifier varchar(250) NOT NULL,
global_amount DECIMAL NOT NULL,
closing_date DATETIME NULL,
closed TINYINT(1) NOT NULL,
closed_by_id INT NULL,
closed_by_name varchar(255) NULL,
closed_reason varchar(150) NULL,
edited_by INT NULL,
edit_reason varchar(150) NULL,
created_date DATETIME NOT NULL,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CREATE TABLE mamba_dim_hop_service
service_id INT NOT NULL,
name varchar(50) null,
description varchar(50) null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CREATE TABLE mamba_dim_insurance_bill
id INT NOT NULL AUTO_INCREMENT,
insurance_bill_id INT NOT NULL,
amount decimal not null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CREATE TABLE mamba_dim_insurance_policy
owner int not null,
coverage_start_date date not null,
expiration_date date null,
created_date datetime not null,
created_date DATETIME not null,

constraint mamba_dim_insurance_policy_insurance_card_no_UNIQUE
unique (insurance_card_no),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CREATE TABLE mamba_dim_paid_service_bill
patient_service_bill_id int not null,
paid_quantity decimal not null,
voided smallint not null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE TABLE mamba_dim_patient_bill
amount decimal(20, 2) not null,
is_paid smallint null,
status varchar(150) null,
created_date datetime null,
created_date DATETIME null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CREATE TABLE mamba_dim_patient_service_bill
drug_frequency varchar(255) null,
item_type tinyint(1) null,
voided smallint not null,
created_date datetime null,
created_date DATETIME null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CREATE TABLE mamba_dim_service_category
name varchar(150) not null,
description varchar(250) null,
price decimal null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CREATE TABLE mamba_dim_third_party_bill
id INT NOT NULL AUTO_INCREMENT,
third_party_bill_id INT NOT NULL,
amount decimal not null,
created_date datetime not null,
created_date DATETIME not null,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
CREATE TABLE mamba_fact_patient_service_bill
(
id INT NOT NULL AUTO_INCREMENT,
admission_date DATE NOT NULL,
closing_date DATE NULL,
admission_date DATETIME NOT NULL,
closing_date DATETIME NULL,
beneficiary_name TEXT NULL,
household_head_name VARCHAR(255) NULL,
family_code VARCHAR(255) NULL,
Expand All @@ -22,6 +22,7 @@ CREATE TABLE mamba_fact_patient_service_bill
hop_service_id INT NULL,
global_bill_id INT NOT NULL,
hop_service_name VARCHAR(50) NULL,
global_bill_identifier VARCHAR(250) NULL,

PRIMARY KEY (id)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,32 @@
INSERT INTO mamba_fact_patient_service_bill(admission_date, closing_date, beneficiary_name, household_head_name,
family_code, beneficiary_level, card_number, company_name, age, birth_date,
gender, doctor_name, service_bill_quantity, service_bill_unit_price,
insurance_id, hop_service_id, global_bill_id, hop_service_name)
insurance_id, hop_service_id, global_bill_id, hop_service_name,
global_bill_identifier)

SELECT DATE(DATE_FORMAT(gb.created_date, '%m/%d/%Y')) AS admission_date,
DATE(DATE_FORMAT(gb.closing_date, '%m/%d/%Y')) AS closing_date,
bps.person_name_long AS beneficiary_name,
ben.owner_name AS household_head_name,
ben.owner_code AS family_code,
ben.level AS beneficiary_level,
isp.insurance_card_no AS card_number,
ben.company AS company_name,
bps.age AS age,
DATE(DATE_FORMAT(bps.birthdate, '%m/%d/%Y')) AS birth_date,
bps.gender AS gender,
gb.closed_by_name AS doctor_name,
psb.quantity AS service_bill_quantity,
psb.unit_price AS service_bill_unit_price,
ins.insurance_id AS insurance_id,
psb.service_id AS hop_service_id,
gb.global_bill_id AS global_bill_id,
hp.name AS hop_service_name
SELECT -- DATE(DATE_FORMAT(gb.created_date, '%d/%m/%Y')) AS admission_date,
-- DATE(gb.created_date) AS admission_date,
gb.created_date AS admission_date,
gb.closing_date AS closing_date,
bps.person_name_long AS beneficiary_name,
ben.owner_name AS household_head_name,
ben.owner_code AS family_code,
ben.level AS beneficiary_level,
isp.insurance_card_no AS card_number,
ben.company AS company_name,
bps.age AS age,
-- DATE(bps.birthdate) AS birth_date,
-- DATE(DATE_FORMAT(bps.birthdate, '%d/%m/%Y')) AS birth_date,
bps.birthdate AS birth_date,
bps.gender AS gender,
gb.closed_by_name AS doctor_name,
psb.quantity AS service_bill_quantity,
psb.unit_price AS service_bill_unit_price,
ins.insurance_id AS insurance_id,
psb.service_id AS hop_service_id,
gb.global_bill_id AS global_bill_id,
hp.name AS hop_service_name,
gb.bill_identifier AS global_bill_identifier

FROM mamba_dim_patient_service_bill psb
INNER JOIN mamba_dim_consommation cons ON psb.consommation_id = cons.consommation_id
Expand Down