线上问诊:数仓开发(二)
系列文章目录
线上问诊:业务数据采集
线上问诊:数仓数据同步
线上问诊:数仓开发(一)
线上问诊:数仓开发(二)
文章目录
- 系列文章目录
- 前言
- 一、DWS
- 1.最近1日汇总表
- 1.交易域医院患者性别年龄段粒度问诊最近1日汇总表
- 2.交易域医院患者性别年龄段粒度问诊支付成功最近1日汇总表
- 3.交易域医院患者性别年龄段粒度处方开单最近1日汇总表
- 4.交易域医院患者性别年龄段粒度处方开单支付成功最近1日汇总表
- 5.交易域医生粒度问诊最近1日汇总表
- 6.首日装载脚本
- 7.每日数据装载
- 2.最近n日汇总表
- 1.交易域医院患者性别年龄段粒度问诊最近n日汇总表
- 2.交易域医院患者性别年龄段粒度问诊支付成功最近n日汇总表
- 3.交易域医院患者性别年龄段粒度处方开单最近n日汇总表
- 4.交易域医院患者性别年龄段粒度处方开单支付成功最近n日汇总表
- 5.交易域医生粒度问诊最近n日汇总表
- 6.首日装载脚本
- 3.历史至今汇总表
- 1.交易域医生粒度问诊历史至今汇总表
- 2.互动域医院用户粒度用户评价历史至今汇总表
- 3.互动域医院粒度用户评价历史至今汇总表
- 4.首日数据装载
- 5.每日数据装载
- 总结
前言
我们这次博客继续完成数仓的开发
一、DWS
1.最近1日汇总表
1.交易域医院患者性别年龄段粒度问诊最近1日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_1d
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-122]老年期',`consultation_amount` DECIMAL(16, 2) COMMENT '问诊金额',`consultation_count` BIGINT COMMENT '问诊次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊最近1日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_1d'TBLPROPERTIES ('orc.compress' = 'snappy');
2.交易域医院患者性别年龄段粒度问诊支付成功最近1日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_pay_suc_1d
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',`consultation_pay_suc_amount` DECIMAL(16, 2) COMMENT '问诊支付成功金额',`consultation_pay_suc_count` BIGINT COMMENT '问诊支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊支付成功最近1日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_pay_suc_1d'TBLPROPERTIES ('orc.compress' = 'snappy');
3.交易域医院患者性别年龄段粒度处方开单最近1日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_1d
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',`prescription_amount` DECIMAL(16, 2) COMMENT '处方开单金额',`prescription_count` BIGINT COMMENT '处方开单次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单最近1日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_1d'TBLPROPERTIES ('orc.compress' = 'snappy');
4.交易域医院患者性别年龄段粒度处方开单支付成功最近1日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_pay_suc_1d
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',`prescription_pay_suc_amount` DECIMAL(16, 2) COMMENT '处方开单支付成功金额',`prescription_pay_suc_count` BIGINT COMMENT '处方开单支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单支付成功最近1日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_pay_suc_1d'TBLPROPERTIES ('orc.compress' = 'snappy');
5.交易域医生粒度问诊最近1日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_doctor_consultation_1d
(`doctor_id` STRING COMMENT '医生ID',`doctor_name` STRING COMMENT '医生姓名',`consultation_count` BIGINT COMMENT '接诊次数'
) COMMENT '交易域医生粒度问诊最近1日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_doctor_consultation_1d'TBLPROPERTIES ('orc.compress' = 'snappy');
6.首日装载脚本
vim ~/bin/medical_dwd_to_dws_1d_init.sh
#!/bin/bashAPP=medicalif [ -n $2 ]
then do_date=$2
elseecho "请传入日期参数!!!"exit
fidws_trade_hospital_gender_age_group_consultation_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_1dpartition (dt)
select hospital_id,hospital_name,gender_code,gender,age_group,sum(consultation_fee) consultation_amount,count(*) consultation_count,dt
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,consultation_fee,dtfrom (select doctor_id,patient_id,consultation_fee,dtfrom ${APP}.dwd_trade_consultation_inc) consulleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group,dt;
"dws_trade_hospital_gender_age_group_consultation_pay_suc_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_1dpartition (dt)
select hospital_id,hospital_name,gender_code,gender,age_group,sum(consultation_fee) consultation_pay_suc_amount,count(*) consultation_pay_suc_count,dt
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,consultation_fee,dtfrom (select doctor_id,patient_id,consultation_fee,dtfrom ${APP}.dwd_trade_consultation_pay_suc_inc) consulleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group,dt;
"dws_trade_hospital_gender_age_group_prescription_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_1dpartition (dt)
select hospital_id,hospital_name,gender_code,gender,age_group,sum(total_amount) prescription_amount,count(*) prescription_count,dt
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,total_amount,dtfrom (select max(doctor_id) doctor_id,max(patient_id) patient_id,max(total_amount) total_amount,max(dt) dtfrom ${APP}.dwd_trade_prescription_incgroup by prescription_id) prescrleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group,dt;
"dws_trade_hospital_gender_age_group_prescription_pay_suc_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_1dpartition (dt)
select hospital_id,hospital_name,gender_code,gender,age_group,sum(total_amount) prescription_pay_suc_amount,count(*) prescription_pay_suc_count,dt
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,total_amount,dtfrom (select max(doctor_id) doctor_id,max(patient_id) patient_id,max(total_amount) total_amount,max(dt) dtfrom ${APP}.dwd_trade_prescription_pay_suc_incgroup by prescription_id) prescrleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group,dt;
"dws_trade_doctor_consultation_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_doctor_consultation_1dpartition (dt)
select doctor_id,name doctor_name,consultation_count,dt
from (select doctor_id,dt,count(*) consultation_countfrom ${APP}.dwd_trade_consultation_incgroup by doctor_id,dt) avgleft join (select id,namefrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon avg.doctor_id = doc.id;
"case $1 indws_trade_hospital_gender_age_group_consultation_1d | dws_trade_hospital_gender_age_group_consultation_pay_suc_1d | dws_trade_hospital_gender_age_group_prescription_1d | dws_trade_hospital_gender_age_group_prescription_pay_suc_1d | dws_trade_doctor_consultation_1d)hive -e "${!1}";;"all")hive -e "$dws_trade_hospital_gender_age_group_consultation_1d$dws_trade_hospital_gender_age_group_consultation_pay_suc_1d$dws_trade_hospital_gender_age_group_prescription_1d$dws_trade_hospital_gender_age_group_prescription_pay_suc_1d$dws_trade_doctor_consultation_1d";;
esac
添加权限
chmod +x ~/bin/medical_dwd_to_dws_1d_init.sh
数据载入
medical_dwd_to_dws_1d_init.sh all 2023-05-09

随便找一个查看一下最后的日期
7.每日数据装载
vim ~/bin/medical_dwd_to_dws_1d.sh
#!/bin/bashAPP=medicalif [ -n $2 ]
then do_date=$2
elseecho "请传入日期参数!!!"exit
fidws_trade_hospital_gender_age_group_consultation_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_1dpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(consultation_fee) consultation_amount,count(*) consultation_count
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,consultation_feefrom (select doctor_id,patient_id,consultation_feefrom ${APP}.dwd_trade_consultation_incwhere dt = '$do_date') consulleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group;"dws_trade_hospital_gender_age_group_consultation_pay_suc_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_1dpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(consultation_fee) consultation_pay_suc_amount,count(*) consultation_pay_suc_count
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,consultation_feefrom (select doctor_id,patient_id,consultation_feefrom ${APP}.dwd_trade_consultation_pay_suc_incwhere dt = '$do_date') consulleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group;"dws_trade_hospital_gender_age_group_prescription_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_1dpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(total_amount) prescription_amount,count(*) prescription_count
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,total_amountfrom (select max(doctor_id) doctor_id,max(patient_id) patient_id,max(total_amount) total_amountfrom ${APP}.dwd_trade_prescription_incwhere dt = '$do_date'group by prescription_id) prescrleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group;"dws_trade_hospital_gender_age_group_prescription_pay_suc_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_1dpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(total_amount) prescription_pay_suc_amount,count(*) prescription_pay_suc_count
from (select hospital_id,hospital_name,gender_code,gender,casewhen age >= 0 and age <= 2 then '婴儿期'when age >= 3 and age <= 5 then '幼儿期'when age >= 6 and age <= 11 then '小学阶段'when age >= 12 and age <= 17 then '青少年期(中学阶段)'when age >= 18 and age <= 29 then '青年期'when age >= 30 and age <= 59 then '中年期'when age >= 60 and age <= 122 then '老年期'else '年龄异常' end age_group,total_amountfrom (select max(doctor_id) doctor_id,max(patient_id) patient_id,max(total_amount) total_amountfrom ${APP}.dwd_trade_prescription_incwhere dt = '$do_date'group by prescription_id) prescrleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon doctor_id = doc.idleft join (select id,name hospital_namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson doc.hospital_id = hos.idleft join(select id,gender_code,gender,year('$do_date') - year(birthday) agefrom ${APP}.dim_patient_fullwhere dt = '$do_date') patienton patient_id = patient.id) with_group
group by hospital_id,hospital_name,gender_code,gender,age_group;"dws_trade_doctor_consultation_1d="
insert overwrite table ${APP}.dws_trade_doctor_consultation_1dpartition (dt = '$do_date')
select doctor_id,name doctor_name,consultation_count
from (select doctor_id,count(*) consultation_countfrom ${APP}.dwd_trade_consultation_incwhere dt = '$do_date'group by doctor_id) avgleft join (select id,namefrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon avg.doctor_id = doc.id;"case $1 indws_trade_hospital_gender_age_group_consultation_1d | dws_trade_hospital_gender_age_group_consultation_pay_suc_1d | dws_trade_hospital_gender_age_group_prescription_1d | dws_trade_hospital_gender_age_group_prescription_pay_suc_1d | dws_trade_doctor_consultation_1d)hive -e "${!1}";;"all")hive -e "$dws_trade_hospital_gender_age_group_consultation_1d$dws_trade_hospital_gender_age_group_consultation_pay_suc_1d$dws_trade_hospital_gender_age_group_prescription_1d$dws_trade_hospital_gender_age_group_prescription_pay_suc_1d$dws_trade_doctor_consultation_1d";;
esac
添加权限
chmod +x ~/bin/medical_dwd_to_dws_1d.sh
2.最近n日汇总表
1.交易域医院患者性别年龄段粒度问诊最近n日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_nd
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-122]老年期',`consultation_amount_7d` DECIMAL(16, 2) COMMENT '最近 7 日问诊金额',`consultation_count_7d` BIGINT COMMENT '最近 7 日问诊次数',`consultation_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日问诊金额',`consultation_count_30d` BIGINT COMMENT '最近 30 日问诊次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊最近n日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_nd'TBLPROPERTIES ('orc.compress' = 'snappy');
2.交易域医院患者性别年龄段粒度问诊支付成功最近n日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_pay_suc_nd
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',`consultation_pay_suc_amount_7d` DECIMAL(16, 2) COMMENT '最近 7 日问诊支付成功金额',`consultation_pay_suc_count_7d` BIGINT COMMENT '最近 7 日问诊支付成功次数',`consultation_pay_suc_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日问诊支付成功金额',`consultation_pay_suc_count_30d` BIGINT COMMENT '最近 30 日问诊支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊支付成功最近n日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_pay_suc_nd'TBLPROPERTIES ('orc.compress' = 'snappy');
3.交易域医院患者性别年龄段粒度处方开单最近n日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_nd
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',`prescription_amount_7d` DECIMAL(16, 2) COMMENT '最近 7 日处方开单金额',`prescription_count_7d` BIGINT COMMENT '最近 7 日处方开单次数',`prescription_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日处方开单金额',`prescription_count_30d` BIGINT COMMENT '最近 30 日处方开单次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单最近n日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_nd'TBLPROPERTIES ('orc.compress' = 'snappy');
4.交易域医院患者性别年龄段粒度处方开单支付成功最近n日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_pay_suc_nd
(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`gender_code` STRING COMMENT '患者性别编码',`gender` STRING COMMENT '患者性别',`age_group` STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',`prescription_pay_suc_amount_7d` DECIMAL(16, 2) COMMENT '最近 7 日处方开单支付成功金额',`prescription_pay_suc_count_7d` BIGINT COMMENT '最近 7 日处方开单支付成功次数',`prescription_pay_suc_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日处方开单支付成功金额',`prescription_pay_suc_count_30d` BIGINT COMMENT '最近 30 日处方开单支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单支付成功最近n日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_pay_suc_nd'TBLPROPERTIES ('orc.compress' = 'snappy');
5.交易域医生粒度问诊最近n日汇总表
建表语句
CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_doctor_consultation_nd
(`doctor_id` STRING COMMENT '医生ID',`doctor_name` STRING COMMENT '医生姓名',`consultation_count_7d` BIGINT COMMENT '最近 7 日接诊次数',`consultation_count_30d` BIGINT COMMENT '最近 30 日接诊次数'
) COMMENT '交易域医生粒度问诊最近n日汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_doctor_consultation_nd'TBLPROPERTIES ('orc.compress' = 'snappy');
6.首日装载脚本
vim ~/bin/medical_dws_1d_to_dws_nd.sh
#!/bin/bashAPP=medicalif [ -n $2 ]
then do_date=$2
elseecho "请传入日期参数!!!"exit
fidws_trade_hospital_gender_age_group_consultation_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_ndpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(if(dt >= date_add('$do_date', -6), consultation_amount, 0)) consultation_amount_7d,sum(if(dt >= date_add('$do_date', -6), consultation_count, 0)) consultation_count_7d,sum(consultation_amount) consultation_amount_30d,sum(consultation_count) consultation_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_consultation_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,hospital_name,gender_code,gender,age_group;
"dws_trade_hospital_gender_age_group_consultation_pay_suc_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_ndpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(if(dt >= date_add('$do_date', -6), consultation_pay_suc_amount, 0)) consultation_pay_suc_amount_7d,sum(if(dt >= date_add('$do_date', -6), consultation_pay_suc_count, 0)) consultation_pay_suc_count_7d,sum(consultation_pay_suc_amount) consultation_pay_suc_amount_30d,sum(consultation_pay_suc_count) consultation_pay_suc_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,hospital_name,gender_code,gender,age_group;
"dws_trade_hospital_gender_age_group_prescription_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_ndpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(if(dt >= date_add('$do_date', -6), prescription_amount, 0)) prescription_amount_7d,sum(if(dt >= date_add('$do_date', -6), prescription_count, 0)) prescription_count_7d,sum(prescription_amount) prescription_amount_30d,sum(prescription_count) prescription_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_prescription_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,hospital_name,gender_code,gender,age_group;
"dws_trade_hospital_gender_age_group_prescription_pay_suc_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_ndpartition (dt = '$do_date')
select hospital_id,hospital_name,gender_code,gender,age_group,sum(if(dt >= date_add('$do_date', -6), prescription_pay_suc_amount, 0)) prescription_pay_suc_amount_7d,sum(if(dt >= date_add('$do_date', -6), prescription_pay_suc_count, 0)) prescription_pay_suc_count_7d,sum(prescription_pay_suc_amount) prescription_pay_suc_amount_30d,sum(prescription_pay_suc_count) prescription_pay_suc_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,hospital_name,gender_code,gender,age_group;
"dws_trade_doctor_consultation_nd="
insert overwrite table ${APP}.dws_trade_doctor_consultation_ndpartition (dt = '$do_date')
select doctor_id,doctor_name,sum(if(dt >= date_add('$do_date', -6), consultation_count, 0)) consultation_count_7d,sum(consultation_count) consultation_count_30d
from ${APP}.dws_trade_doctor_consultation_1d
where dt >= date_add('$do_date', -29)
group by doctor_id,doctor_name;
"case $1 indws_trade_hospital_gender_age_group_consultation_nd | dws_trade_hospital_gender_age_group_consultation_pay_suc_nd | dws_trade_hospital_gender_age_group_prescription_nd | dws_trade_hospital_gender_age_group_prescription_pay_suc_nd | dws_trade_doctor_consultation_nd)hive -e "${!1}";;"all")hive -e "$dws_trade_hospital_gender_age_group_consultation_nd$dws_trade_hospital_gender_age_group_consultation_pay_suc_nd$dws_trade_hospital_gender_age_group_prescription_nd$dws_trade_hospital_gender_age_group_prescription_pay_suc_nd$dws_trade_doctor_consultation_nd";;"*")echo "非法参数!!!";;
esac
添加权限
chmod +x ~/bin/medical_dws_1d_to_dws_nd.sh
数据装载
medical_dws_1d_to_dws_nd.sh all 2023-05-09

3.历史至今汇总表
1.交易域医生粒度问诊历史至今汇总表
建表语句
CREATE TABLE IF NOT EXISTS dws_trade_doctor_consultation_td(`doctor_id` STRING COMMENT '医生ID',`doctor_name` STRING COMMENT '医生姓名',`first_consultation_dt` STRING COMMENT '首次接诊日期'
) COMMENT '交易域医生粒度问诊历史至今汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_trade_doctor_consultation_td'TBLPROPERTIES ('orc.compress' = 'snappy');
2.互动域医院用户粒度用户评价历史至今汇总表
建表语句
CREATE TABLE IF NOT EXISTS dws_interaction_hospital_user_review_td(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`user_id` STRING COMMENT '用户ID',`username` STRING COMMENT '用户姓名',`first_review_dt` STRING COMMENT '首次评价日期'
) COMMENT '互动域医院用户粒度用户评价历史至今汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_interaction_hospital_user_review_td'TBLPROPERTIES ('orc.compress' = 'snappy');
3.互动域医院粒度用户评价历史至今汇总表
建表语句
CREATE TABLE IF NOT EXISTS dws_interaction_hospital_review_td(`hospital_id` STRING COMMENT '医院ID',`hospital_name` STRING COMMENT '医院名称',`review_count` BIGINT COMMENT '评价次数',`good_review_count` BIGINT COMMENT '好评次数'
) COMMENT '互动域医院粒度用户评价历史至今汇总表'PARTITIONED BY (`dt` STRING)STORED AS ORCLOCATION '/warehouse/medical/dws/dws_interaction_hospital_review_td'TBLPROPERTIES ('orc.compress' = 'snappy');
4.首日数据装载
vim ~/bin/medical_dws_1d_to_dws_td_init.sh
#!/bin/bashAPP=medicalif [ -n $2 ]
then do_date=$2
elseecho "请传入日期参数!!!"exit
fidws_trade_doctor_consultation_td="
insert overwrite table ${APP}.dws_trade_doctor_consultation_tdpartition (dt = '$do_date')
select doctor_id,doctor_name,min(dt) first_consultation_dt
from ${APP}.dws_trade_doctor_consultation_1d
group by doctor_id,doctor_name;
"dws_interaction_hospital_user_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_user_review_tdpartition (dt = '$do_date')
select hospital_id,name hospital_name,user_id,username,first_review_dt
from (select hospital_id,user_id,min(review.dt) first_review_dtfrom (select doctor_id,user_id,dtfrom ${APP}.dwd_interaction_review_inc) reviewleft join (select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon review.doctor_id = doc.idgroup by hospital_id,user_id) avgleft join (select id,namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson avg.hospital_id = hos.idleft join (select id,usernamefrom ${APP}.dim_user_fullwhere dt = '$do_date') \`user\`on avg.user_id = \`user\`.id;
"dws_interaction_hospital_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_review_tdpartition (dt = '$do_date')
select hospital_id,name hospital_name,review_count,good_review_count
from (select hospital_id,count(*) review_count,sum(if(rating = 5, 1, 0)) good_review_countfrom (select doctor_id,ratingfrom ${APP}.dwd_interaction_review_inc) reviewleft join(select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docon review.doctor_id = doc.idgroup by hospital_id) avgleft join (select id,namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson hospital_id = hos.id;
"case $1 indws_trade_doctor_consultation_td | dws_interaction_hospital_user_review_td | dws_interaction_hospital_review_td)hive -e "${!1}";;"all")hive -e "$dws_trade_doctor_consultation_td$dws_interaction_hospital_user_review_td$dws_interaction_hospital_review_td";;"*")echo "非法参数!!!";;
esac
添加权限
chmod +x ~/bin/medical_dws_1d_to_dws_td_init.sh
数据装载
medical_dws_1d_to_dws_td_init.sh all 2023-05-09
5.每日数据装载
vim ~/bin/medical_dws_1d_to_dws_td.sh
#!/bin/bashAPP=medicalif [ -n $2 ]
then do_date=$2
elseecho "请传入时间参数!!!"exit
fidws_trade_doctor_consultation_td="
insert overwrite table ${APP}.dws_trade_doctor_consultation_tdpartition (dt = '$do_date')
select nvl(old.doctor_id, new.doctor_id) doctor_id,nvl(old.doctor_name, new.doctor_name) doctor_name,if(old.doctor_id is null, '$do_date', first_consultation_dt) first_consultation_dt
from (select doctor_id,doctor_name,first_consultation_dtfrom ${APP}.dws_trade_doctor_consultation_tdwhere dt = date_add('$do_date', -1)) oldfull outer join(select doctor_id,doctor_namefrom ${APP}.dws_trade_doctor_consultation_1dwhere dt = '$do_date') newon old.doctor_id = new.doctor_idand old.doctor_name = new.doctor_name;
"dws_interaction_hospital_user_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_user_review_tdpartition (dt = '$do_date')
select hospital_id,hospital_name,user_id,username,min(first_review_dt) first_review_dt
from (select hospital_id,hospital_name,user_id,username,first_review_dtfrom ${APP}.dws_interaction_hospital_user_review_tdwhere dt = date_add('$do_date', -1)unionselect hospital_id,name hospital_name,user_id,username,first_reveiw_dtfrom (select hospital_id,user_id,'$do_date' first_reveiw_dtfrom (select doctor_id,user_idfrom ${APP}.dwd_interaction_review_incwhere dt = '$do_date') reivewleft join (select id,hospital_idfrom ${APP}.dim_doctor_full) docon reivew.doctor_id = doc.idgroup by user_id,hospital_id) avgleft join (select id,namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson avg.hospital_id = hos.idleft join (select id,usernamefrom ${APP}.dim_user_fullwhere dt = '$do_date') \`user\`on avg.user_id = \`user\`.id) \`all\`
group by hospital_id,hospital_name,user_id,username;
"dws_interaction_hospital_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_review_tdpartition (dt = '$do_date')
select hospital_id,hospital_name,sum(review_count) review_count,sum(good_review_count) good_review_count
from (select hospital_id,hospital_name,review_count,good_review_countfrom ${APP}.dws_interaction_hospital_review_tdwhere dt = date_add('$do_date', -1)unionselect hospital_id,name hospital_name,review_count,good_review_countfrom (select hospital_id,count(*) review_count,sum(if(rating = 5, 1, 0)) good_review_countfrom (select doctor_id,ratingfrom ${APP}.dwd_interaction_review_incwhere dt = '$do_date') reviewleft join (select id,hospital_idfrom ${APP}.dim_doctor_fullwhere dt = '$do_date') docgroup by hospital_id) avgleft join (select id,namefrom ${APP}.dim_hospital_fullwhere dt = '$do_date') hoson hospital_id = hos.id) \`all\`
group by hospital_id,hospital_name;
"case $1 indws_trade_doctor_consultation_td | dws_interaction_hospital_user_review_td | dws_interaction_hospital_review_td)hive -e "${!1}";;"all")hive -e "$dws_trade_doctor_consultation_td$dws_interaction_hospital_user_review_td$dws_interaction_hospital_review_td";;"*")echo "非法参数!!!";;
esac
添加权限
chmod +x ~/bin/medical_dws_1d_to_dws_td.sh
总结
内容有点多,可能还要一次才能完成。
相关文章:
线上问诊:数仓开发(二)
系列文章目录 线上问诊:业务数据采集 线上问诊:数仓数据同步 线上问诊:数仓开发(一) 线上问诊:数仓开发(二) 文章目录 系列文章目录前言一、DWS1.最近1日汇总表1.交易域医院患者性别年龄段粒度问诊最近1日汇总表2.交易域医院患者…...
Ansible自动化运维工具(三)
目录 Ansible 的脚本 --- playbook 剧本 编辑2.vars模块实战实例 3.指定远程主机sudo切换用户 4.when模块实战实例 5.with_items迭代模块实战实例 6.Templates 模块实战实例 (1)先准备一个以 .j2 为后缀的 template 模板文件,设置引用…...
ChatGPT在创新和创业中的应用如何?
ChatGPT是一种基于大规模预训练的语言模型,它在创新和创业中有着广泛的应用。作为一种具备自然语言处理能力的模型,ChatGPT可以与用户进行对话,并提供相关的信息、建议和创意。以下是ChatGPT在创新和创业中的一些应用: 创意生成和…...
Log4j2 配置日志记录发送到 kafka 中
前言 log4j2 在 2.11.0 之后的版本,已经内置了 KafkaAppender 支持可以将打印的日志直接发送到 kafka 中,在这之前如果想要集中收集应用的日志,就需要自定义一个 Layout 来实现,相对来说还是比较麻烦的。 官网文档:L…...
Linux用户与组管理(03)(八)
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 目录 前言 一、组管理 1、概述 2、用户信息查看 总结 前言 今天是学习用户与组管理的最后一节课,这节课主要是组管理的内容,希望能一起学习ÿ…...
Java自定义异常
Java标准库定义的常用异常包括: 当我们在代码中需要抛出异常时,尽量使用JDK已定义的异常类型。例如,参数检查不合法,应该抛出IllegalArgumentException: static void process1(int age) {if (age < 0) {throw new…...
vscode远程调试php
使用vscode远程调试php的方法 1.安装remote ssh插件 2.连接服务器 可以点击左下角的绿色按钮,或者ctrlshiftp打开命令框输入remote ssh应该也有。 3.在服务器端vscode安装php debug插件 4.安装xdebug xdebug是用来调试php的软件,原本和vscode没什么关…...
C语言:截断+整型提升练习
详情关于整型提升与截断见文章:《C语言:整型提升》 一、代码一 int main() { char a -1; signed char b -1; unsigned char c -1; printf("%d %d %d", a, b, c); return 0; } 求输出结果 解析如下代码: int mai…...
Kubernetes技术--k8s核心技术kubectl命令行工具
(1).概述 kubectl是Kubernetes集群的命令行工具,通过 kubectl 能够对集群本身进行管理,并能够在集群上进行容器化应用的安装部署。 (2).语法 Kubectl [command] [type] [name] [flags] 语法参数说明: command: 指定要对资源执行的操作,例如 create、get、describe 和 delet…...
Element浅尝辄止9:Popover 弹出框组件
Popover 的属性与 Tooltip 很类似,它们都是基于Vue-popper开发的,因此有重复属性 1.如何使用? /*trigger属性用于设置何时触发 Popover,支持四种触发方式: hover,click,focus 和 manual。 对于…...
程序开发:构建功能强大的应用的艺术
程序开发是在今天的数字化时代中扮演重要角色的一项技术。通过编写代码,开发人员能创造出无数不同的应用,从简单的计算器到复杂的社交平台。电子商务应用、在线教育平台、医疗记录系统等,都重视程序开发的重要性,通过这其中的交互…...
(七)k8s实战-高级调度
一、CronJob 定时任务 1、cron 表达式 # ┌───────────── 分钟 (0 - 59) # │ ┌───────────── 小时 (0 - 23) # │ │ ┌───────────── 月的某天 (1 - 31) # │ │ │ ┌───────────── 月份 (1 - 12) # │ │ │ │ ┌…...
HTTP/1.1协议中的八种请求
2023年8月29日,周二晚上 目录 概述八种请求GET请求POST请求PUT请求PATCH请求DELETE请求HEAD请求OPTIONS请求TRACE请求 概述八种请求 HTTP/1.1协议中定义了8种常用的请求方法,分别是:1. GET 用途:请求指定的页面信息,并返回实体主体。例子:获取一个网页、图片等静态…...
面试系列 - JVM内存模型和调优详解
目录 一、JVM内存模型 1. 程序计数器(Program Counter Register): 2.Java虚拟机栈(Java Virtual Machine Stacks): 3. 本地方法栈(Native Method Stack): 5. 方法区…...
JavaScript -【第一周】
文章来源于网上收集和自己原创,若侵害到您的权利,请您及时联系并删除~~~ JavaScript 介绍 变量、常量、数据类型、运算符等基础概念 能够实现数据类型的转换,结合四则运算体会如何编程。 体会现实世界中的事物与计算机的关系理解什么是数据并…...
高性能缓存 Caffeine 原理及实战
Caffeine 是基于Java 8 开发的、提供了近乎最佳命中率的高性能本地缓存组件,Spring5 开始不再支持 Guava Cache,改为使用 Caffeine。 1 算法原理 对于 Java 进程内缓存我们可以通过 HashMap 来实现。不过,Java 进程内存是有限的,…...
【算法】leetcode 105 从前序与中序遍历序列构造二叉树
题目 输入某二叉树的前序遍历和中序遍历的结果,请构建该二叉树并返回其根节点。 假设输入的前序遍历和中序遍历的结果中都不含重复的数字。 示例 1: Input: preorder [3,9,20,15,7], inorder [9,3,15,20,7] Output: [3,9,20,null,null,15,7]示例 2: Input: pr…...
11 | Spark计算数据文件中每行数值的平均值
需求:计算数据文件中的数值的平均值 背景: 你有一个数据文件,其中包含一系列数值,每行一个数值,数值之间用逗号分隔。你想使用Apache Spark分布式计算框架来读取数据文件中的数值并计算它们的平均值。功能要求: 通过Spark配置和上下文初始化Spark应用程序。从数据文件中…...
AI与游戏创新:深度学习的起跑枪声
《AI与游戏创新:深度学习的起跑枪声》 目录 引言AIGC定义与重要性AI在游戏中的应用AI推动游戏创新的可能途径AIGC的挑战与解决方案结论:AI是游戏行业的下一站 引言 AI(人工智能)正在全球范围内改变各个行业,游戏行…...
【GUI开发】用python爬YouTube博主信息,并开发成exe软件
文章目录 一、背景介绍二、代码讲解2.1 爬虫2.2 tkinter界面2.3 存日志 三、软件演示视频四、说明 一、背景介绍 你好,我是马哥python说,一名10年程序猿。 最近我用python开发了一个GUI桌面软件,目的是爬取相关YouTube博主的各种信息&#…...
Prompt Tuning、P-Tuning、Prefix Tuning的区别
一、Prompt Tuning、P-Tuning、Prefix Tuning的区别 1. Prompt Tuning(提示调优) 核心思想:固定预训练模型参数,仅学习额外的连续提示向量(通常是嵌入层的一部分)。实现方式:在输入文本前添加可训练的连续向量(软提示),模型只更新这些提示参数。优势:参数量少(仅提…...
Go 语言接口详解
Go 语言接口详解 核心概念 接口定义 在 Go 语言中,接口是一种抽象类型,它定义了一组方法的集合: // 定义接口 type Shape interface {Area() float64Perimeter() float64 } 接口实现 Go 接口的实现是隐式的: // 矩形结构体…...
为什么需要建设工程项目管理?工程项目管理有哪些亮点功能?
在建筑行业,项目管理的重要性不言而喻。随着工程规模的扩大、技术复杂度的提升,传统的管理模式已经难以满足现代工程的需求。过去,许多企业依赖手工记录、口头沟通和分散的信息管理,导致效率低下、成本失控、风险频发。例如&#…...
STM32F4基本定时器使用和原理详解
STM32F4基本定时器使用和原理详解 前言如何确定定时器挂载在哪条时钟线上配置及使用方法参数配置PrescalerCounter ModeCounter Periodauto-reload preloadTrigger Event Selection 中断配置生成的代码及使用方法初始化代码基本定时器触发DCA或者ADC的代码讲解中断代码定时启动…...
[ICLR 2022]How Much Can CLIP Benefit Vision-and-Language Tasks?
论文网址:pdf 英文是纯手打的!论文原文的summarizing and paraphrasing。可能会出现难以避免的拼写错误和语法错误,若有发现欢迎评论指正!文章偏向于笔记,谨慎食用 目录 1. 心得 2. 论文逐段精读 2.1. Abstract 2…...
使用Matplotlib创建炫酷的3D散点图:数据可视化的新维度
文章目录 基础实现代码代码解析进阶技巧1. 自定义点的大小和颜色2. 添加图例和样式美化3. 真实数据应用示例实用技巧与注意事项完整示例(带样式)应用场景在数据科学和可视化领域,三维图形能为我们提供更丰富的数据洞察。本文将手把手教你如何使用Python的Matplotlib库创建引…...
Spring是如何解决Bean的循环依赖:三级缓存机制
1、什么是 Bean 的循环依赖 在 Spring框架中,Bean 的循环依赖是指多个 Bean 之间互相持有对方引用,形成闭环依赖关系的现象。 多个 Bean 的依赖关系构成环形链路,例如: 双向依赖:Bean A 依赖 Bean B,同时 Bean B 也依赖 Bean A(A↔B)。链条循环: Bean A → Bean…...
Linux 内存管理实战精讲:核心原理与面试常考点全解析
Linux 内存管理实战精讲:核心原理与面试常考点全解析 Linux 内核内存管理是系统设计中最复杂但也最核心的模块之一。它不仅支撑着虚拟内存机制、物理内存分配、进程隔离与资源复用,还直接决定系统运行的性能与稳定性。无论你是嵌入式开发者、内核调试工…...
系统掌握PyTorch:图解张量、Autograd、DataLoader、nn.Module与实战模型
本文较长,建议点赞收藏,以免遗失。更多AI大模型应用开发学习视频及资料,尽在聚客AI学院。 本文通过代码驱动的方式,系统讲解PyTorch核心概念和实战技巧,涵盖张量操作、自动微分、数据加载、模型构建和训练全流程&#…...
在golang中如何将已安装的依赖降级处理,比如:将 go-ansible/v2@v2.2.0 更换为 go-ansible/@v1.1.7
在 Go 项目中降级 go-ansible 从 v2.2.0 到 v1.1.7 具体步骤: 第一步: 修改 go.mod 文件 // 原 v2 版本声明 require github.com/apenella/go-ansible/v2 v2.2.0 替换为: // 改为 v…...
