67 Commits

Author SHA1 Message Date
cfb7ddedd3 feat: implement user identity middleware for session management
- Added UserIdentityMiddleware to manage user sessions by generating a unique user ID stored in a cookie.
- Implemented logic to update the last seen timestamp for existing users in the database.
- Enhanced ScaleResult model to associate responses with users, improving data tracking and user experience.
2025-06-17 15:44:10 +08:00
27f2479108 feat: enhance language handling in middleware
- Updated LanguageMiddleware in app.py to retrieve the user's language preference from cookies if not provided in query parameters.
- Added logic to set a cookie for the language, ensuring consistent language detection and user experience across sessions.
2025-06-17 14:01:48 +08:00
d9d6dfcdc0 refactor: streamline load_all_scales calls in scale endpoints
- Updated scale and result endpoints in app.py to consistently call load_all_scales with the language parameter, improving code clarity and maintaining uniformity in scale data retrieval.
2025-06-17 08:42:00 +08:00
0f2416089c refactor: simplify load_all_scales calls in scale endpoints
- Updated scale and result endpoints in app.py to call load_all_scales without the language parameter, streamlining the function usage.
- This change enhances code clarity and maintains consistency in scale data retrieval.
2025-06-17 08:33:47 +08:00
6c905dc3ce feat: implement dynamic README loading based on user language
- Updated app.py to load the README content from language-specific markdown files located in the templates directory.
- Added new index.md files for English and Chinese, providing localized information about PsychoScales.Org and its resources.
2025-06-17 08:27:01 +08:00
e46d17eaf2 feat: enhance load_all_scales function for language support
- Updated load_all_scales to accept an optional language parameter, allowing for the loading of scales based on the specified language.
- Modified calls to load_all_scales in various endpoints to pass the user's detected language, ensuring consistent language handling across the application.
2025-06-17 08:23:10 +08:00
27794895c9 feat: implement multilingual template support
- Updated app.py to dynamically load Jinja2 templates based on the detected language.
- Created new template files for English and Chinese, including base, index, list, scale, and result pages.
- Modified template rendering logic to utilize the appropriate language-specific templates based on user preferences.
2025-06-17 08:08:18 +08:00
8f202262ee feat: add language detection middleware for request handling
- Implemented LanguageMiddleware to determine the user's language based on query parameters, Accept-Language header, or IP address.
- Updated the FastAPI app to include the middleware and pass the detected language to templates.
- Modified base.html to dynamically set the HTML language attribute based on the detected language.
2025-06-17 07:48:38 +08:00
eb4d670ee0 fix: update sitemap URLs to use the www subdomain
- Modified the sitemap generation logic in app.py to prepend 'www.' to the base URL for static routes, tag routes, and scale routes.
- This change ensures consistency in URL formatting and improves SEO by standardizing the domain used in the sitemap.
2025-06-16 17:53:22 +08:00
f7895dc2fe fix: update scale ID check in download_scale_results endpoint
- Changed the scale ID check in the download_scale_results function from "database" to "psychoscales.db" for improved clarity and accuracy in file retrieval.
- This adjustment ensures the correct database file is accessed when downloading scale results.
2025-06-16 10:26:49 +08:00
e50dc7a9d4 fix: remove token parameter from download_scale_results endpoint
- Updated the download_scale_results function to eliminate the token parameter, simplifying the endpoint's signature.
- This change enhances clarity and aligns with the current requirements for accessing scale results.
2025-06-16 10:23:44 +08:00
319844e55c feat: add CSV download endpoint for scale results
- Implemented a new endpoint to download scale results as a CSV file.
- The endpoint retrieves responses based on the scale ID and formats the data, including question IDs and subscale scores, into a CSV format.
- Updated database URL to remove the public directory reference for better file access.
2025-06-16 10:19:52 +08:00
d99d7f7c12 fix: correct public file path handling in get_public_file function
- Moved the public_path assignment to ensure it is set before checking for the file's existence.
- This change resolves potential issues when accessing files in the public directory.
2025-06-16 09:32:23 +08:00
fc9d439cf9 feat: add created_at timestamp to ScaleResult model and response handling
- Introduced created_at field in the ScaleResult model to track response creation time.
- Updated result handling logic in app.py to populate created_at with the current UTC time when saving responses.
2025-06-16 09:08:21 +08:00
90720b3cec refactor: rename RawResponse to ScaleResult for improved clarity
- Updated the database model from RawResponse to ScaleResult to better reflect its purpose.
- Adjusted the result handling logic in app.py to utilize the new ScaleResult model for storing user responses.
2025-06-16 06:50:25 +08:00
ce020a5674 refactor: update response model and location handling
- Renamed RawResponse model to Response for clarity.
- Changed location field type from String to JSON in the Response model.
- Updated result handling logic to store location as a JSON object instead of a string.
2025-06-16 06:47:40 +08:00
7cb36eb1af fix: update database URL to point to public directory
- Changed the SQLALCHEMY_DATABASE_URL to use the public directory for the SQLite database file, ensuring proper access and organization of database resources.
2025-06-16 06:39:49 +08:00
e3b3b5a1f6 feat: 添加异常处理以增强数据库保存逻辑
- 在结果处理逻辑中添加try-except块,以捕获保存用户响应到数据库时的异常
- 确保在发生错误时能够打印异常信息,提升系统的稳定性和可调试性
2025-06-16 06:29:46 +08:00
ee9e6a5cca feat: 增强IP地址记录功能以支持地理位置获取
- 在app.py中新增GeoIP2数据库支持,获取用户IP的地理位置信息
- 更新RawResponse模型,新增location、raw_response、sum_response和avg_response字段以存储更多用户响应数据
- 修改结果处理逻辑,保存用户的地理位置信息和响应数据
- 更新.gitignore以排除GeoLite2-City.mmdb文件
2025-06-16 06:13:11 +08:00
e08909eacd feat: 更新IP地址记录逻辑以支持代理头
- 修改结果处理逻辑以获取真实IP地址,考虑代理头的影响
- 更新RawResponse模型中的ip_address字段以保存用户的真实IP
2025-06-16 05:33:40 +08:00
ff44ce6264 feat: 增加IP地址记录功能以保存用户响应
- 在RawResponse模型中新增ip_address字段
- 更新结果处理逻辑以记录用户的IP地址
2025-06-16 05:27:45 +08:00
7989c8ed4e feat: 添加数据库支持以保存问卷响应
- 新增数据库模型和连接配置,使用SQLite存储问卷响应
- 更新结果处理逻辑,将用户响应保存到数据库
- 更新.gitignore以排除数据库文件和缓存目录
2025-06-16 05:17:49 +08:00
8117d7e669 docs: 更新开源地址链接以反映新的项目位置 2025-06-16 04:30:40 +08:00
133dfc3fca fix: update robots.txt to include sitemap directive 2025-06-16 04:24:35 +08:00
6e49fadbab feat: 添加网站地图生成功能并优化公共文件访问
- 新增生成sitemap.xml的功能,包含静态和动态路由
- 优化公共文件访问接口,支持直接返回sitemap.xml
2025-06-16 04:15:44 +08:00
345c571dda feat: 增加公共文件访问功能并添加favicon和robots.txt
- 新增公共文件访问接口,允许从public目录获取文件
- 添加favicon.ico以改善网站标识
- 新增robots.txt以指导搜索引擎爬虫行为
2025-06-16 03:50:28 +08:00
73f419f1aa Delete scales/English/Symptom Checklist-90 (SCL90).yml 2025-06-15 19:24:18 +00:00
df77a10735 添加均分计算 2025-05-17 20:03:45 +08:00
0d62ef66e6 Ignore scale path 2025-05-17 19:16:29 +08:00
mxr612
ca37b9758b docs: 更新页面标题以反映品牌名称和动态内容
更新了 `index.html` 中的标题为 "心尺.Org",以更准确地反映品牌名称。同时,将 `list.html` 中的标题改为动态显示 `{{ tag }}`,以便根据页面内容动态调整标题。
2025-04-26 21:44:04 +08:00
mxr612
88d046d9cc docs: 将“心尺”统一更新为“心尺.Org”
将README.md和base.html中的“心尺”统一更新为“心尺.Org”,以确保品牌名称的一致性。
2025-04-26 21:31:57 +08:00
mxr612
0a6e38b7e3 docs: 更新页面标题为“心尺”
将页面标题从“心尺 PsychoScales”简化为“心尺”,以保持简洁性和一致性。
2025-04-26 21:21:30 +08:00
mxr612
6b41b8e096 refactor: 重构标签处理和界面文本
- 删除tagmap.yml文件,简化标签处理逻辑
- 将标签存储方式从字典改为列表,减少复杂性
- 更新界面文本,将"PsychoScales"替换为"心尺"
- 修改README.md中的项目描述,使其更简洁清晰
2025-04-26 20:44:29 +08:00
mxr612
72db5c8b83 feat: 新增中庸实践思维量表和SCL90量表
新增中文版中庸实践思维量表和英文版SCL90量表,用于心理评估。同时优化了加载问卷数据的逻辑,支持递归遍历文件夹以加载所有问卷文件。
2025-04-22 21:19:22 +08:00
mxr612
c4efd778a9 style: 调整CSS样式和HTML模板格式
- 修改`styles.css`中的`input[type="submit"]`样式,增加宽度并调整边距
- 修复`scale.html`中的拼写错误,将`lable`改为`label`
- 更新`base.html`的meta描述和关键词,优化SEO
- 调整HTML模板中的格式和缩进,提高代码可读性
2025-04-22 21:09:49 +08:00
mxr612
74931a5161 更新了base中的js放置和meta信息 2025-03-15 21:37:54 +08:00
mxr612
7fe421368e 说明、样式和一点优化 2025-03-15 20:35:33 +08:00
mxr612
74546fc2fb 更改了两处量表配置命名,优化了一处css 2025-03-14 23:52:54 +08:00
mxr612
4fc9660f8b 修复了量表计算逻辑,修复了量表required提示 2025-03-10 12:48:42 +00:00
mxr612
7e85847a41 更改了item range的标注方式,为PSAI作准备。 2025-03-10 06:37:20 +00:00
mxr612
a6e1b4bee8 优化了提交按钮样式 2025-03-09 14:36:22 +00:00
mxr612
5c12a8e885 优化了移动端样式和提交按钮 2025-03-09 14:22:01 +00:00
mxr612
e90daedb48 修复了list页html safe 2025-03-09 10:43:52 +00:00
mxr612
f817765913 优化了list页面样式 2025-03-09 10:38:10 +00:00
mxr612
e2199cfe5a 导航栏适配了移动设备 2025-03-09 09:53:06 +00:00
mxr612
fa2c0af4ec 优化了提交按钮样式,修复了结果页标题 2025-03-09 03:39:10 +00:00
mxr612
dafb591001 优化了量表按钮的样式 2025-03-09 02:10:23 +00:00
mxr612
b835237787 改善了量表按钮的弹性 2025-03-08 15:47:57 +00:00
mxr612
4a99a7b9d1 将tag目录置为/tag/{tag},避免与其他目录冲突。 2025-03-08 07:55:25 +00:00
mxr612
441768dab0 使用了html模板;增加了导航栏;将lang改为看起来更加通用的tag 2025-03-07 12:47:41 +00:00