b021eabdab
Refactored `script.py` by adding detailed docstrings and organizing functions. Created `.idea` configuration files and `gotodashboard.js` for `sisa_crawl` project. Added `readme.md` files with usage instructions and context for multiple scripts, and set up `package.json` for `sisa_crawl` dependencies.
105 lines
3.5 KiB
Markdown
105 lines
3.5 KiB
Markdown
# Project Name: Examination Data Processing
|
|
|
|
## Overview
|
|
This project is designed to process examination data from an Excel file and generate filtered output and communication messages for teaching staff. It's developed using Python and pandas, and it provides functionalities such as filtering records, converting time formats, and generating message columns.
|
|
|
|
## Features
|
|
- **Read Excel File**: Reads examination data from an Excel file into a Pandas DataFrame.
|
|
- **Filter Data**: Filters records based on specific criteria in 'Studiegidsnummer' and 'Opmerkingen' columns.
|
|
- **Convert Time Format**: Converts time columns to 'HH:MM' format.
|
|
- **Generate Messages**: Creates message and subject columns for email communication.
|
|
- **Save to Excel**: Saves the processed data to a new Excel file.
|
|
|
|
## Prerequisites
|
|
- Python 3.12.5
|
|
- Pandas
|
|
- openpyxl
|
|
|
|
## Installation
|
|
1. **Clone the repository**:
|
|
```sh
|
|
git clone https://github.com/username/examination-data-processing.git
|
|
cd examination-data-processing
|
|
```
|
|
2. **Install the required Python packages**:
|
|
```sh
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
Ensure the `requirements.txt` file should contain:
|
|
```text
|
|
pandas
|
|
openpyxl
|
|
```
|
|
|
|
## Usage
|
|
1. **Place the input Excel file**: Ensure that the Excel file (`examengegevens2425.xlsx`) is placed in the root directory of the project.
|
|
|
|
2. **Run the script**:
|
|
```sh
|
|
python script.py
|
|
```
|
|
|
|
3. **Output**: The filtered and processed data will be saved in an output Excel file (`filtered_examengegevens2425.xlsx`).
|
|
|
|
## Functions
|
|
|
|
### `read_excel_file(file_path)`
|
|
- **Parameters**: `file_path` (str) - Path to the Excel file.
|
|
- **Returns**: DataFrame or None
|
|
|
|
### `filter_studiegidsnummer(df)`
|
|
- **Parameters**: `df` (DataFrame) - Input DataFrame.
|
|
- **Returns**: Filtered DataFrame or empty DataFrame
|
|
|
|
### `filter_opmerkingen(df)`
|
|
- **Parameters**: `df` (DataFrame) - Input DataFrame.
|
|
- **Returns**: Filtered DataFrame or empty DataFrame
|
|
|
|
### `create_message_column(df)`
|
|
- **Parameters**: `df` (DataFrame) - Input DataFrame.
|
|
- **Returns**: DataFrame with 'Message' and 'subject' columns
|
|
|
|
### `save_to_excel(df, output_file_path)`
|
|
- **Parameters**:
|
|
- `df` (DataFrame) - DataFrame to save.
|
|
- `output_file_path` (str) - Path to save the Excel file.
|
|
- **Returns**: None
|
|
|
|
### `convert_time_format(time_str)`
|
|
- **Parameters**: `time_str` (str) - Time string to convert.
|
|
- **Returns**: Formatted time string
|
|
|
|
### `apply_time_format_conversion(df, columns)`
|
|
- **Parameters**:
|
|
- `df` (DataFrame) - DataFrame with time columns.
|
|
- `columns` (list of str) - List of column names to format.
|
|
- **Returns**: DataFrame with formatted time columns
|
|
|
|
### `main()`
|
|
- Main function to execute the entire process: reading the Excel file, filtering data, converting time formats, creating message columns, and saving to Excel.
|
|
|
|
## Example
|
|
```python
|
|
if __name__ == "__main__":
|
|
main()
|
|
```
|
|
|
|
## Contributing
|
|
1. Fork the repository.
|
|
2. Create a new branch: `git checkout -b feature-branch`.
|
|
3. Make your changes and commit: `git commit -m 'Add new feature'`.
|
|
4. Push to the branch: `git push origin feature-branch`.
|
|
5. Submit a pull request.
|
|
|
|
## License
|
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
|
|
|
|
## Acknowledgements
|
|
- [Pandas Documentation](https://pandas.pydata.org/pandas-docs/stable/)
|
|
- [Openpyxl Documentation](https://openpyxl.readthedocs.io/en/stable/)
|
|
|
|
## Author
|
|
- AI Assistant (Your Name or Contributors)
|
|
|
|
> For additional information or support, please contact `your-email@example.com`. |