💖💖作者:计算机毕业设计小途 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
@TOC
儿童出生体重和妊娠期数据可视化分析系统介绍
基于大数据的儿童出生体重和妊娠期数据可视化分析系统是一个集大数据处理、统计分析与可视化展示于一体的综合性健康数据分析平台。该系统采用Hadoop+Spark大数据框架作为核心技术架构,充分发挥分布式计算的优势处理海量妊娠期健康数据,通过HDFS分布式文件系统确保数据存储的可靠性和扩展性,利用Spark SQL进行高效的数据查询和分析操作。系统后端基于Django框架构建,结合MySQL数据库实现数据的持久化存储和管理,前端采用Vue+ElementUI+Echarts技术栈打造现代化的用户界面,通过丰富的图表组件实现数据的直观可视化展示。系统功能涵盖儿童出生体重和妊娠期数据的全生命周期管理,包括数据录入、存储、清洗、分析和展示等环节,提供孕期体重关联分析、健康习惯影响分析、母亲特征影响分析、多因素综合分析以及核心指标分布分析等多维度的数据挖掘功能,通过大屏展示模块实现数据的实时监控和动态呈现。系统还配备完善的用户管理体系和系统公告功能,确保平台的安全性和易用性,为医疗健康领域的数据分析研究提供了强有力的技术支撑和应用平台。
儿童出生体重和妊娠期数据可视化分析系统演示视频
儿童出生体重和妊娠期数据可视化分析系统演示图片
儿童出生体重和妊娠期数据可视化分析系统代码展示
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
from pyspark.sql.types import *
import pandas as pd
import numpy as np
from django.http import JsonResponse
from django.views import View
import json
spark = SparkSession.builder.appName("ChildBirthWeightAnalysis").config("spark.some.config.option", "some-value").getOrCreate()
class PregnancyWeightAnalysisView(View):
def post(self, request):
data = json.loads(request.body)
start_date = data.get('start_date')
end_date = data.get('end_date')
df = spark.sql(f"SELECT * FROM pregnancy_data WHERE record_date BETWEEN '{start_date}' AND '{end_date}'")
weight_correlation_df = df.select("mother_id", "pregnancy_week", "mother_weight", "birth_weight").filter(col("pregnancy_week").isNotNull())
weight_stats = weight_correlation_df.groupBy("pregnancy_week").agg(
avg("mother_weight").alias("avg_mother_weight"),
avg("birth_weight").alias("avg_birth_weight"),
stddev("mother_weight").alias("std_mother_weight"),
stddev("birth_weight").alias("std_birth_weight"),
count("*").alias("sample_count")
).orderBy("pregnancy_week")
correlation_analysis = weight_correlation_df.stat.corr("mother_weight", "birth_weight")
weight_gain_df = weight_correlation_df.withColumn("weight_gain_rate",
(col("mother_weight") - lag("mother_weight").over(Window.partitionBy("mother_id").orderBy("pregnancy_week"))) /
(col("pregnancy_week") - lag("pregnancy_week").over(Window.partitionBy("mother_id").orderBy("pregnancy_week"))))
risk_analysis = weight_gain_df.withColumn("risk_level",
when(col("weight_gain_rate") > 0.5, "high_risk")
.when(col("weight_gain_rate") < 0.1, "low_risk")
.otherwise("normal_risk"))
risk_distribution = risk_analysis.groupBy("risk_level").count().collect()
weight_ranges = weight_correlation_df.withColumn("weight_range",
when(col("birth_weight") < 2500, "low_weight")
.when(col("birth_weight") > 4000, "high_weight")
.otherwise("normal_weight"))
range_stats = weight_ranges.groupBy("weight_range").agg(
count("*").alias("count"),
avg("mother_weight").alias("avg_mother_weight")
).collect()
result_data = {
'correlation_coefficient': correlation_analysis,
'weekly_stats': [row.asDict() for row in weight_stats.collect()],
'risk_distribution': [{'risk_level': row['risk_level'], 'count': row['count']} for row in risk_distribution],
'weight_range_stats': [row.asDict() for row in range_stats]
}
return JsonResponse(result_data)
class HealthHabitsAnalysisView(View):
def post(self, request):
data = json.loads(request.body)
analysis_type = data.get('analysis_type', 'comprehensive')
habits_df = spark.sql("SELECT * FROM health_habits_data WHERE habit_type IS NOT NULL")
smoking_analysis = habits_df.filter(col("smoking_status").isNotNull()).groupBy("smoking_status").agg(
avg("birth_weight").alias("avg_birth_weight"),
count("*").alias("sample_count"),
stddev("birth_weight").alias("weight_std")
)
exercise_analysis = habits_df.filter(col("exercise_frequency").isNotNull()).groupBy("exercise_frequency").agg(
avg("birth_weight").alias("avg_birth_weight"),
avg("pregnancy_duration").alias("avg_pregnancy_duration"),
count("*").alias("sample_count")
)
nutrition_df = habits_df.filter(col("nutrition_score").isNotNull())
nutrition_correlation = nutrition_df.stat.corr("nutrition_score", "birth_weight")
nutrition_ranges = nutrition_df.withColumn("nutrition_level",
when(col("nutrition_score") >= 80, "excellent")
.when(col("nutrition_score") >= 60, "good")
.when(col("nutrition_score") >= 40, "fair")
.otherwise("poor"))
nutrition_impact = nutrition_ranges.groupBy("nutrition_level").agg(
avg("birth_weight").alias("avg_birth_weight"),
avg("mother_health_score").alias("avg_health_score"),
count("*").alias("count")
).orderBy(desc("avg_birth_weight"))
sleep_analysis = habits_df.filter(col("sleep_hours").isNotNull()).withColumn("sleep_category",
when(col("sleep_hours") >= 8, "sufficient")
.when(col("sleep_hours") >= 6, "moderate")
.otherwise("insufficient"))
sleep_impact = sleep_analysis.groupBy("sleep_category").agg(
avg("birth_weight").alias("avg_birth_weight"),
avg("stress_level").alias("avg_stress_level"),
count("*").alias("sample_count")
)
combined_habits = habits_df.withColumn("habit_score",
when(col("smoking_status") == "never", 25).otherwise(0) +
when(col("exercise_frequency") == "regular", 25).otherwise(
when(col("exercise_frequency") == "occasional", 15).otherwise(0)) +
(col("nutrition_score") * 0.3) +
when(col("sleep_hours") >= 7, 20).otherwise(col("sleep_hours") * 2.5))
habit_categories = combined_habits.withColumn("overall_habit_level",
when(col("habit_score") >= 80, "excellent")
.when(col("habit_score") >= 60, "good")
.otherwise("needs_improvement"))
final_analysis = habit_categories.groupBy("overall_habit_level").agg(
avg("birth_weight").alias("avg_birth_weight"),
avg("pregnancy_complications").alias("avg_complications"),
count("*").alias("sample_count")
)
analysis_results = {
'smoking_impact': [row.asDict() for row in smoking_analysis.collect()],
'exercise_impact': [row.asDict() for row in exercise_analysis.collect()],
'nutrition_correlation': nutrition_correlation,
'nutrition_impact': [row.asDict() for row in nutrition_impact.collect()],
'sleep_impact': [row.asDict() for row in sleep_impact.collect()],
'overall_habit_analysis': [row.asDict() for row in final_analysis.collect()]
}
return JsonResponse(analysis_results)
class MultiFactorAnalysisView(View):
def post(self, request):
data = json.loads(request.body)
factor_list = data.get('factors', ['mother_age', 'mother_height', 'pre_pregnancy_weight', 'education_level'])
comprehensive_df = spark.sql("""
SELECT m.*, h.*, p.* FROM mother_characteristics m
JOIN health_habits_data h ON m.mother_id = h.mother_id
JOIN pregnancy_data p ON m.mother_id = p.mother_id
""")
age_groups = comprehensive_df.withColumn("age_group",
when(col("mother_age") < 20, "teen")
.when(col("mother_age") < 25, "young_adult")
.when(col("mother_age") < 30, "adult")
.when(col("mother_age") < 35, "mature_adult")
.otherwise("advanced_age"))
bmi_analysis = comprehensive_df.withColumn("pre_pregnancy_bmi",
col("pre_pregnancy_weight") / pow(col("mother_height") / 100, 2))
bmi_categories = bmi_analysis.withColumn("bmi_category",
when(col("pre_pregnancy_bmi") < 18.5, "underweight")
.when(col("pre_pregnancy_bmi") < 24.9, "normal")
.when(col("pre_pregnancy_bmi") < 29.9, "overweight")
.otherwise("obese"))
education_impact = comprehensive_df.groupBy("education_level").agg(
avg("birth_weight").alias("avg_birth_weight"),
avg("prenatal_visits").alias("avg_prenatal_visits"),
count("*").alias("sample_count")
).orderBy(desc("avg_birth_weight"))
multi_factor_analysis = comprehensive_df.groupBy("age_group", "bmi_category", "education_level").agg(
avg("birth_weight").alias("avg_birth_weight"),
avg("pregnancy_duration").alias("avg_duration"),
count("*").alias("sample_count")
).filter(col("sample_count") >= 5)
risk_scoring = comprehensive_df.withColumn("risk_score",
when(col("mother_age") > 35, 15).otherwise(0) +
when(col("pre_pregnancy_bmi") > 30, 20).otherwise(
when(col("pre_pregnancy_bmi") < 18.5, 10).otherwise(0)) +
when(col("smoking_status") == "current", 25).otherwise(0) +
when(col("chronic_conditions") > 0, 20).otherwise(0) +
when(col("previous_complications") == "yes", 15).otherwise(0))
risk_categories = risk_scoring.withColumn("overall_risk",
when(col("risk_score") >= 60, "high_risk")
.when(col("risk_score") >= 30, "moderate_risk")
.otherwise("low_risk"))
risk_outcomes = risk_categories.groupBy("overall_risk").agg(
avg("birth_weight").alias("avg_birth_weight"),
avg("pregnancy_duration").alias("avg_duration"),
sum(when(col("birth_weight") < 2500, 1).otherwise(0)).alias("low_weight_cases"),
count("*").alias("total_cases")
)
factor_correlations = {}
numeric_factors = ["mother_age", "mother_height", "pre_pregnancy_weight", "nutrition_score", "exercise_frequency_numeric"]
for factor in numeric_factors:
if factor in [col.name for col in comprehensive_df.columns]:
correlation = comprehensive_df.stat.corr(factor, "birth_weight")
factor_correlations[factor] = correlation
predictive_model_data = comprehensive_df.select(
"mother_age", "pre_pregnancy_bmi", "nutrition_score", "exercise_frequency_numeric",
"prenatal_visits", "birth_weight"
).na.drop()
feature_importance = predictive_model_data.stat.corr("birth_weight", "mother_age")
comprehensive_results = {
'age_group_analysis': [row.asDict() for row in age_groups.groupBy("age_group").agg(avg("birth_weight").alias("avg_birth_weight"), count("*").alias("count")).collect()],
'bmi_impact': [row.asDict() for row in bmi_categories.groupBy("bmi_category").agg(avg("birth_weight").alias("avg_birth_weight"), count("*").alias("count")).collect()],
'education_impact': [row.asDict() for row in education_impact.collect()],
'multi_factor_combinations': [row.asDict() for row in multi_factor_analysis.collect()],
'risk_assessment': [row.asDict() for row in risk_outcomes.collect()],
'factor_correlations': factor_correlations,
'total_samples_analyzed': comprehensive_df.count()
}
return JsonResponse(comprehensive_results)
儿童出生体重和妊娠期数据可视化分析系统文档展示
💖💖作者:计算机毕业设计小途 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目