diff --git a/README.md b/README.md index 8c3359a..3323180 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# 心尺 PsychoScales (Org) +# 心尺 PsychoScales Org -## 什么是PsychoScales +## 关于PsychoScales PsychoScales网站是一个专业的心理学资源平台,旨在为用户提供全面的心理学测量工具和评估资源。我们汇集了各种心理测量工具,涵盖了情绪、人格、认知能力、心理健康等多个领域,帮助用户更好地了解自己的心理特点和状况。 作为PsychoScales网站的用户,您可以通过简单的在线测试,快速获取关于自己心理特征的详细报告和分析。这些测量工具基于权威的心理学理论和研究,确保了测试结果的准确性和可靠性。 -[心尺主站](https://psygscales.com/) +[PsychoScales主站](https://psygscales.com/) -## 什么是PsychoScales Org +## 关于PsychoScales Org 这个一个开源的量表框架,基于Python搭建。 -本项目的量表加载完全基于json,不使用任何数据库。同时也可以通过易于编辑的txt文件制作可以加载的json。 +本项目的量表加载完全基于YAML,不使用任何数据库。在易于编辑和易于加载中间达到了平衡。 [开源地址](https://git.mxr612.io/PsychoScales/PsychoScales) \ No newline at end of file diff --git a/app.py b/app.py index e766dce..d27225f 100644 --- a/app.py +++ b/app.py @@ -17,10 +17,15 @@ def load_all_scales(): scales = {} for filename in os.listdir(scale_folder): if filename.endswith(('.yaml', '.yml')): - with open(os.path.join(scale_folder, filename), 'r', encoding='utf-8') as f: - scale = yaml.safe_load(f) - scale_id = os.path.splitext(filename)[0] # 使用文件名作为标识 - scales[scale_id] = scale + try: + with open(os.path.join(scale_folder, filename), 'r', encoding='utf-8') as f: + scale = yaml.safe_load(f) + scale['instructions']=markdown.markdown(scale['instructions'], extensions=['fenced_code','tables','mdx_math']) + scale['descriptions']=markdown.markdown(scale['descriptions'], extensions=['fenced_code','tables','mdx_math']) + scale_id = os.path.splitext(filename)[0] # 使用文件名作为标识 + scales[scale_id] = scale + except Exception as e: + print(f"Error loading scale {filename}: {e}") return scales @app.get("/", response_class=HTMLResponse) @@ -64,7 +69,6 @@ async def result(request: Request, scale_id: str): responses[subscale] = 0 ranges[subscale] = [len(scale['range'][0]*qids),len(scale['range'][1]*qids)] for qid in qids: - print(qid) if qid<0: responses[subscale] += scale['range'][0] + scale['range'][1] - int(form_data[str(-qid)]) else: diff --git a/requirements.txt b/requirements.txt index 90c3812..187eb52 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/scales/CBF-PI-B.yml b/scales/CBF-PI-B.yml index 72543e2..1066d53 100644 --- a/scales/CBF-PI-B.yml +++ b/scales/CBF-PI-B.yml @@ -1,12 +1,21 @@ title: 中国大五人格问卷(简式版) -instruction: 下面是一些描述人们性格特点的句子,请根据每个句子与您性格相符程度选择相应的数字。1-6分别代表完全不符合、大部分不符合、有点不符合、有点符合、大部分符合、完全符合。 -description: "" +instructions: 下面是一些描述人们性格特点的句子,请根据每个句子与您性格相符程度选择相应的数字。1-6分别代表完全不符合、大部分不符合、有点不符合、有点符合、大部分符合、完全符合。 +descriptions: | + 中国大五人格问卷(CBF-PI)是由王孟成和戴晓阳等编制的,中国拥有其知识产权的人格问卷(相比NEO-PI)。此处是基于其简化的问卷,与完整版问卷的各项相关系数的$r$神经质最小的$0.886$、宜人性最大的$0.922$。 + + 本量表选自戴晓阳《常用心理评估量表(修订版)》,各项描述及常模: + + - 开放性(O):个体对待新事物、新观念和新异刺激的态度和行为差异。男$32.60\pm6.74$女$31.97\pm6.18$ + - 严谨性(C):个体按照社会规范的要求控制冲动的倾向、以任务和目的为导向、延迟满足,以及遵守规范和纪律等方面上的个体差异。男$32.90\pm6.64$女$33.29\pm6.52$ + - 外向性(E):个体神经系统的强弱和动力特征。男$31.09\pm7.27$女$30.76\pm6.94$ + - 宜人性(A):个体对人性及及他人(遭遇)表现出的同情心和人文关怀。男$36.29\pm6.30$女$37.71\pm5.65$ + - 神经质(N):个体情绪稳定性和体验负性情绪上的个体差异。男$24.97\pm7.06$女$26.91\pm7.47$ subscales: - 神经质: [1,6,11,16,21,26,31,-36] - 严谨性: [2,7,12,17,22,27,-32,37] - 宜人性: [3,-8,-13,-18,23,28,33,38] 开放性: [4,9,14,19,24,29,34,39] + 严谨性: [2,7,12,17,22,27,-32,37] 外向性: [-5,10,-15,20,25,30,35,40] + 宜人性: [3,-8,-13,-18,23,28,33,38] + 神经质: [1,6,11,16,21,26,31,-36] range: [1,6] questions: 1: 我常感到害怕 diff --git a/scales/中庸实践思维量表.yml b/scales/中庸实践思维量表.yml index 0e11934..926475e 100644 --- a/scales/中庸实践思维量表.yml +++ b/scales/中庸实践思维量表.yml @@ -1,6 +1,13 @@ title: 中庸实践思维量表 -instruction: 无 -description: 中庸实践思维量表 +instructions: | + 以下题目是对个人思维方式的描述,不需要过多考虑,请根据你平时的真实想法,或者假设遇到所说的情形时,内心里自动出现的想法进行选择,根据符合度进行打分,答案并无对错之分。 + + 如“我习惯从多方面的角度来思考同一件事情”,如果您认为非常符合您的情况,请请选择第四个选项“3”表示打3分;如果这非常不符合您的情况,请选择第一个选项“0”,表示打0分(0--非常不符合 1--基本不符合 2--基本符合 3--非常符合)。 + + 请选填,资料将被严格保密且仅用于研究,无需顾虑。感谢您的支持! +descriptions: | + 中庸实践思维量表(参考戴晓阳《常用心理评估量表(修订版)》)推荐的临界值是32分(小者异常),这一数值是基于普通人与抑郁、强迫患者的对比。 + 中庸实践思维是由杨中芳及其团队在如家“中庸”哲学思想基础上建构的一个具有“中国特色”的心理学理论。 subscales: 恰如其分/不走极端: [-3,-6,-13,-15,-16,-17,-18] 内外和谐: [-2,-4,-7,-9,-11,-14] diff --git a/templates/result.html b/templates/result.html index 0b18e4b..8058ed6 100644 --- a/templates/result.html +++ b/templates/result.html @@ -6,6 +6,13 @@ {{scale_title}} + + + + @@ -15,7 +22,9 @@
  • {{ key }}: 在 {{ranges[key][0]}} 到 {{ranges[key][1]}} 的量表中得分 {{ value }}
  • {% endfor %} -

    {{scale.description}}

    +
    + {{scale.descriptions|safe}} +
    \ No newline at end of file diff --git a/templates/scale.html b/templates/scale.html index cf4c515..04c997d 100644 --- a/templates/scale.html +++ b/templates/scale.html @@ -6,11 +6,20 @@ {{ scale.title }} + + + +

    {{ scale.title }}

    -

    {{ scale.instructions }}

    +
    + {{ scale.instructions|safe }} +
    {% for id, question in scale.questions.items() %}