💖💖作者:计算机毕业设计小途 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
@TOC
分化型甲状腺癌复发数据可视化分析系统介绍
《基于大数据的分化型甲状腺癌复发数据可视化分析系统》是一个运用先进大数据技术构建的医疗数据智能分析平台,该系统以Hadoop分布式存储和Spark大数据处理引擎为核心技术架构,通过HDFS分布式文件系统实现海量甲状腺癌患者数据的高效存储管理,结合Spark SQL进行复杂数据查询和Pandas、NumPy进行深度数据分析处理。系统采用Python语言开发,基于Django Web框架构建稳定的后端服务,前端运用Vue.js结合ElementUI组件库和Echarts可视化图表库,打造直观友好的用户交互界面。系统核心功能涵盖甲状腺数据管理、患者人口特征分析、多维因素关联分析、临床病理特征分析、甲状腺功能指标分析和患者治疗效果分析等六大分析模块,通过大数据算法深度挖掘分化型甲状腺癌患者的复发规律和相关因素。系统特别设计了大屏可视化功能,以图表形式直观展示数据分析结果,帮助医疗工作者快速理解患者病情发展趋势和复发风险评估。同时系统具备完善的用户管理体系,包括用户中心、个人信息管理、密码修改等基础功能,以及系统公告管理等辅助功能,确保系统的实用性和可维护性,为医疗机构提供了一套完整的甲状腺癌复发数据分析解决方案。
分化型甲状腺癌复发数据可视化分析系统演示视频
分化型甲状腺癌复发数据可视化分析系统演示图片
分化型甲状腺癌复发数据可视化分析系统代码展示
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, count, avg, sum, when, desc, asc
from pyspark.ml.feature import VectorAssembler
from pyspark.ml.stat import Correlation
import pandas as pd
import numpy as np
from datetime import datetime
spark = SparkSession.builder.appName("ThyroidCancerAnalysis").config("spark.sql.adaptive.enabled", "true").config("spark.sql.adaptive.coalescePartitions.enabled", "true").getOrCreate()
def patients_demographic_analysis(request):
thyroid_df = spark.read.jdbc(url="jdbc:mysql://localhost:3306/thyroid_db", table="thyroid_data", properties={"user": "root", "password": "password", "driver": "com.mysql.cj.jdbc.Driver"})
age_groups = thyroid_df.withColumn("age_group", when(col("age") < 30, "青年组").when(col("age") < 50, "中年组").otherwise("老年组"))
gender_distribution = age_groups.groupBy("gender", "age_group").agg(count("patient_id").alias("patient_count"), avg("recurrence_risk").alias("avg_risk")).orderBy("gender", "age_group")
recurrence_by_demo = age_groups.groupBy("age_group", "gender").agg(sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("recurrence_count"), count("patient_id").alias("total_count")).withColumn("recurrence_rate", col("recurrence_count") / col("total_count") * 100)
region_analysis = thyroid_df.groupBy("region").agg(count("patient_id").alias("patient_count"), avg("tumor_size").alias("avg_tumor_size"), sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("recurrence_cases"))
occupation_risk = thyroid_df.groupBy("occupation").agg(count("patient_id").alias("total_patients"), avg("recurrence_risk").alias("occupation_risk_score")).filter(col("total_patients") >= 10).orderBy(desc("occupation_risk_score"))
bmi_analysis = thyroid_df.withColumn("bmi_category", when(col("bmi") < 18.5, "偏瘦").when(col("bmi") < 24, "正常").when(col("bmi") < 28, "超重").otherwise("肥胖")).groupBy("bmi_category").agg(count("patient_id").alias("count"), avg("recurrence_risk").alias("risk_level"))
family_history_impact = thyroid_df.groupBy("family_history").agg(count("patient_id").alias("patient_count"), sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("recurrence_count")).withColumn("family_risk_rate", col("recurrence_count") / col("patient_count") * 100)
smoking_drinking_analysis = thyroid_df.groupBy("smoking_status", "drinking_status").agg(count("patient_id").alias("lifestyle_count"), avg("recurrence_risk").alias("lifestyle_risk"))
education_correlation = thyroid_df.groupBy("education_level").agg(count("patient_id").alias("edu_count"), avg("treatment_compliance").alias("compliance_rate"), avg("recurrence_risk").alias("edu_risk"))
marriage_status_effect = thyroid_df.groupBy("marriage_status").agg(count("patient_id").alias("marriage_count"), avg("psychological_score").alias("mental_health"), avg("recurrence_risk").alias("marriage_risk"))
income_level_analysis = thyroid_df.groupBy("income_level").agg(count("patient_id").alias("income_count"), avg("treatment_delay_days").alias("delay_days"), sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("income_recurrence"))
comprehensive_demo_risk = thyroid_df.groupBy("age_group", "gender", "region").agg(count("patient_id").alias("group_count"), avg("recurrence_risk").alias("comprehensive_risk")).filter(col("group_count") >= 5)
monthly_trend = thyroid_df.groupBy("diagnosis_month").agg(count("patient_id").alias("monthly_cases"), avg("recurrence_risk").alias("monthly_risk")).orderBy("diagnosis_month")
result_data = {"gender_distribution": gender_distribution.collect(), "recurrence_by_demo": recurrence_by_demo.collect(), "region_analysis": region_analysis.collect(), "occupation_risk": occupation_risk.collect(), "bmi_analysis": bmi_analysis.collect()}
return JsonResponse({"status": "success", "demographic_analysis": result_data})
def multidimensional_correlation_analysis(request):
thyroid_spark_df = spark.read.jdbc(url="jdbc:mysql://localhost:3306/thyroid_db", table="thyroid_data", properties={"user": "root", "password": "password", "driver": "com.mysql.cj.jdbc.Driver"})
numeric_features = ["age", "tumor_size", "tsh_level", "t3_level", "t4_level", "lymph_node_count", "bmi", "treatment_duration"]
feature_assembler = VectorAssembler(inputCols=numeric_features, outputCol="correlation_features")
correlation_data = feature_assembler.transform(thyroid_spark_df).select("correlation_features")
correlation_matrix = Correlation.corr(correlation_data, "correlation_features").head()[0]
correlation_array = correlation_matrix.toArray()
age_tumor_correlation = thyroid_spark_df.stat.corr("age", "tumor_size")
hormone_correlation = thyroid_spark_df.select("tsh_level", "t3_level", "t4_level", "recurrence_risk").toPandas().corr()
treatment_outcome_relation = thyroid_spark_df.groupBy("treatment_type").agg(avg("treatment_duration").alias("avg_duration"), avg("recurrence_risk").alias("treatment_risk"), count("patient_id").alias("treatment_count"))
stage_size_analysis = thyroid_spark_df.groupBy("tumor_stage").agg(avg("tumor_size").alias("stage_avg_size"), avg("lymph_node_count").alias("stage_lymph_nodes"), sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("stage_recurrence"))
multi_factor_risk = thyroid_spark_df.withColumn("high_risk_factors", when(col("age") > 55, 1).otherwise(0) + when(col("tumor_size") > 4, 1).otherwise(0) + when(col("lymph_node_count") > 5, 1).otherwise(0) + when(col("family_history") == 1, 1).otherwise(0))
risk_factor_groups = multi_factor_risk.groupBy("high_risk_factors").agg(count("patient_id").alias("factor_count"), avg("recurrence_risk").alias("combined_risk"), sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("actual_recurrence"))
hormone_threshold_analysis = thyroid_spark_df.withColumn("tsh_abnormal", when(col("tsh_level") > 4.5, 1).when(col("tsh_level") < 0.4, 1).otherwise(0)).groupBy("tsh_abnormal").agg(count("patient_id").alias("tsh_group_count"), avg("recurrence_risk").alias("tsh_risk"))
gender_age_interaction = thyroid_spark_df.groupBy("gender").agg(avg(when(col("age") > 50, col("recurrence_risk")).otherwise(0)).alias("older_risk"), avg(when(col("age") <= 50, col("recurrence_risk")).otherwise(0)).alias("younger_risk"))
treatment_timing_effect = thyroid_spark_df.withColumn("treatment_delay", when(col("days_to_treatment") > 30, "延迟治疗").otherwise("及时治疗")).groupBy("treatment_delay", "tumor_stage").agg(count("patient_id").alias("timing_count"), avg("recurrence_risk").alias("timing_risk"))
seasonal_correlation = thyroid_spark_df.withColumn("diagnosis_season", when(col("diagnosis_month").isin([12, 1, 2]), "冬季").when(col("diagnosis_month").isin([3, 4, 5]), "春季").when(col("diagnosis_month").isin([6, 7, 8]), "夏季").otherwise("秋季"))
season_hormone_analysis = seasonal_correlation.groupBy("diagnosis_season").agg(avg("tsh_level").alias("season_tsh"), avg("t3_level").alias("season_t3"), avg("recurrence_risk").alias("season_risk"))
geographic_treatment_correlation = thyroid_spark_df.groupBy("region", "hospital_level").agg(count("patient_id").alias("geo_count"), avg("treatment_success_rate").alias("regional_success"), avg("recurrence_risk").alias("geo_risk"))
comorbidity_impact = thyroid_spark_df.groupBy("diabetes_status", "hypertension_status").agg(count("patient_id").alias("comorbid_count"), avg("recurrence_risk").alias("comorbid_risk"), avg("treatment_complications").alias("complication_rate"))
correlation_results = {"correlation_matrix": correlation_array.tolist(), "age_tumor_corr": age_tumor_correlation, "hormone_correlations": hormone_correlation.to_dict(), "treatment_outcomes": treatment_outcome_relation.collect(), "multi_factor_analysis": risk_factor_groups.collect()}
return JsonResponse({"status": "success", "correlation_analysis": correlation_results})
def treatment_effectiveness_analysis(request):
treatment_spark_df = spark.read.jdbc(url="jdbc:mysql://localhost:3306/thyroid_db", table="thyroid_data", properties={"user": "root", "password": "password", "driver": "com.mysql.cj.jdbc.Driver"})
treatment_type_effectiveness = treatment_spark_df.groupBy("treatment_type").agg(count("patient_id").alias("treatment_cases"), avg("treatment_success_rate").alias("success_rate"), avg("recurrence_risk").alias("post_treatment_risk"), avg("treatment_duration").alias("avg_treatment_days"))
surgery_outcome_analysis = treatment_spark_df.filter(col("treatment_type").contains("手术")).groupBy("surgery_type").agg(count("patient_id").alias("surgery_count"), avg("post_surgery_complications").alias("complication_rate"), sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("surgery_recurrence"))
medication_response = treatment_spark_df.filter(col("treatment_type").contains("药物")).groupBy("medication_type").agg(count("patient_id").alias("med_count"), avg("hormone_normalization_time").alias("normalization_days"), avg("side_effect_severity").alias("side_effects"))
radiotherapy_effectiveness = treatment_spark_df.filter(col("treatment_type").contains("放疗")).groupBy("radiation_dose_level").agg(count("patient_id").alias("radiation_count"), avg("tumor_shrinkage_rate").alias("shrinkage_percent"), avg("recurrence_risk").alias("radiation_recurrence_risk"))
combination_therapy_results = treatment_spark_df.filter(col("combination_therapy") == 1).groupBy("primary_treatment", "secondary_treatment").agg(count("patient_id").alias("combo_count"), avg("overall_effectiveness").alias("combo_effectiveness"))
treatment_timeline_analysis = treatment_spark_df.withColumn("treatment_phase", when(col("treatment_day") <= 30, "初期治疗").when(col("treatment_day") <= 180, "中期治疗").otherwise("长期治疗")).groupBy("treatment_phase").agg(avg("patient_satisfaction").alias("phase_satisfaction"), avg("symptom_improvement").alias("improvement_score"))
hospital_level_outcomes = treatment_spark_df.groupBy("hospital_level").agg(count("patient_id").alias("hospital_cases"), avg("treatment_success_rate").alias("hospital_success"), avg("treatment_cost").alias("avg_cost"), avg("patient_satisfaction").alias("hospital_satisfaction"))
age_treatment_response = treatment_spark_df.withColumn("age_category", when(col("age") < 40, "青年患者").when(col("age") < 60, "中年患者").otherwise("老年患者")).groupBy("age_category", "treatment_type").agg(count("patient_id").alias("age_treatment_count"), avg("treatment_tolerance").alias("tolerance_score"))
gender_treatment_difference = treatment_spark_df.groupBy("gender", "treatment_type").agg(count("patient_id").alias("gender_treatment_count"), avg("recovery_time").alias("gender_recovery_days"), avg("treatment_effectiveness").alias("gender_effectiveness"))
followup_compliance_impact = treatment_spark_df.groupBy("followup_compliance_level").agg(count("patient_id").alias("compliance_count"), avg("long_term_success_rate").alias("compliance_success"), sum(when(col("is_recurrence") == 1, 1).otherwise(0)).alias("compliance_recurrence"))
treatment_cost_effectiveness = treatment_spark_df.groupBy("treatment_type").agg(avg("total_treatment_cost").alias("avg_cost"), avg("treatment_success_rate").alias("success_rate")).withColumn("cost_effectiveness_ratio", col("avg_cost") / col("success_rate"))
adverse_event_analysis = treatment_spark_df.groupBy("treatment_type").agg(count("patient_id").alias("total_treated"), sum(when(col("severe_adverse_events") > 0, 1).otherwise(0)).alias("adverse_cases")).withColumn("adverse_event_rate", col("adverse_cases") / col("total_treated") * 100)
quality_of_life_improvement = treatment_spark_df.groupBy("treatment_type").agg(avg("pre_treatment_qol_score").alias("pre_qol"), avg("post_treatment_qol_score").alias("post_qol")).withColumn("qol_improvement", col("post_qol") - col("pre_qol"))
treatment_timing_optimization = treatment_spark_df.withColumn("optimal_timing", when(col("days_from_diagnosis_to_treatment") <= 14, "最佳时机").when(col("days_from_diagnosis_to_treatment") <= 30, "适宜时机").otherwise("延迟治疗")).groupBy("optimal_timing").agg(count("patient_id").alias("timing_count"), avg("treatment_outcome_score").alias("timing_outcome"))
effectiveness_results = {"treatment_effectiveness": treatment_type_effectiveness.collect(), "surgery_outcomes": surgery_outcome_analysis.collect(), "medication_response": medication_response.collect(), "combination_therapy": combination_therapy_results.collect(), "hospital_performance": hospital_level_outcomes.collect()}
return JsonResponse({"status": "success", "treatment_analysis": effectiveness_results})
分化型甲状腺癌复发数据可视化分析系统文档展示
💖💖作者:计算机毕业设计小途 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目