Skip to content

评估 API

评估接口支撑建档后的 G1-M3 安全检查、R1-R11 完整评估提交和最近评估读取。主要写入 user_health_profilesuser_profiles.assessment_context

Endpoint 索引

MethodPath鉴权用途
POST/api/assessment/safety_checkBearer JWT执行 G1-M3 运动安全检查。
GET/api/assessment/symptoms按癌种读取症状标签。
POST/api/assessment/submitBearer JWT提交 R1-R11 完整评估。
GET/api/assessment/lastBearer JWT读取最近一次完整评估。

Endpoint 契约

POST /api/assessment/safety_check

内容
RequestG1-M3 安全检查字段
Responseassessment_idrisk_levelwarningstriggered_rulesaction_requiredvalid_until
Errors401422 参数;持久化失败不阻断主响应
ConsumerAssessmentApiClient.performSafetyCheck
Handlerassessment.perform_safety_check -> PerformSafetyCheckUseCase
DB Touchpointsuser_health_profiles.safety_check_datarisk_level
Teststests/use_cases/test_perform_safety_check_use_case.py

GET /api/assessment/symptoms

内容
Requestquery cancer_type,默认 breast
Responsesymptom string list
Errors500 极少见
ConsumerAssessmentApiClient.getSymptoms
Handlerassessment.get_dynamic_symptoms
DB Touchpoints当前静态 map,不读 DB
Testssource inspection

POST /api/assessment/submit

内容
RequestR1-R11 完整评估字段
ResponseAssessmentResponse
Errors401422500
ConsumerAssessmentApiClient.submitFullAssessment、DetailedAssessmentBloc
Handlerassessment.submit_full_assessment -> SubmitFullAssessmentUseCase
DB Touchpoints更新 user_profiles.assessment_context;写 user_health_profiles.assessment_data
Teststests/use_cases/test_submit_full_assessment_use_case.pytests/api/test_assessment_payload_normalization.py

GET /api/assessment/last

内容
Request
Response最近 FullAssessmentRequestnull
Errors401500
ConsumerAssessmentApiClient.getLastAssessment
Handlerassessment.get_last_assessment
DB Touchpointsuser_profiles.assessment_context
TestsFlutter detailed assessment tests

Safety Check 请求字段

FieldAliasTypeDefaultValues
has_feverg1_feverstringnonoyesunsure
acute_conditiong2_acutestringnonoyesunsure
chest_symptomsg3_cheststringnonoyesunsure
severe_side_effectsg4_seffectstringnonoyesunsure
extreme_fatigueg5_fatiguestringnonoyesunsure
doctor_prohibitedg6_docstringnonoyesunsure
wound_issuem1_woundstringno前端可选
fall_riskm2_fallstringno前端可选
hemoglobinm3_hbnumbernull血红蛋白值
anemia_unsurem3_unsurebooleanfalse是否不确定贫血状态

Full Assessment 数据

完整评估 request 使用 R1-R11 结构,后端会补齐 user_idagegendercancer_typetreatment_stage 等上下文字段,并将 JSON-compatible payload 存入 user_profiles.assessment_context

FieldDescription
symptom_top3symptom_data症状与疼痛等结构化数据。
comorbidities合并症列表。
weekly_exercise_daysdaily_activity_level当前活动频率和活动水平。
preferred_exercisesaccess_sceneequipment偏好、环境和器械。
expected_durationexpected_frequency单次时长与每周频率目标。

来源锚点

  • Router: apps/backend_service/app/api/assessment.py
  • Schemas: apps/backend_service/app/schemas/assessment.py
  • Use cases: apps/backend_service/app/use_cases/assessment/
  • Flutter: apps/flutter_app/lib/api/assessment_api_client.dart
  • Tests: apps/backend_service/tests/api/test_assessment_payload_normalization.pyapps/flutter_app/test/bloc/detailed_assessment/detailed_assessment_bloc_test.dart