- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.