Incident_Report_Generator
A Python program built using the Pandas library to transform a comma-delimited CSV file to an Excel spreadsheet with charts and tables.
incident.csv
Export a CSV file of incidents assigned to the appropriate assignment group from the ticket tracking system. The more data (timeframe), the better. It is best to do a whole calendar year. Required headers (order not relevant): - "number" (ticket number) - "location" (location reporting incident) - "state" (open, closed, etc.) - "ci" (configuration issue) - "priority" (severity of the incident) - "short_description" - "description" - "assignment_group" - "assigned_to" - "sys_created_on" (datetime created) - "resolved_at" (datetime resolved) Ensure the file is named "incident.csv". Place the file to the same directory as transform.py (This one by default).
./configs/new_activations.json
This file will hold a JSON object with the initial keys being location IDs and a nested JSON object consisting of the install date in YYYY-MM-DD format and the product(s) being installed. See example below.
{
"examplesville": {
"date": "YYYY-MM-DD",
"product": ["KPS", "POS_Android"]
}
}
./configs/ci_dict.json
This file should hold a JSON object where the keys are the products and the value an an array of known Configuration Items (CIs) that correspond to that product.
{
"KSP": ["Printer"]
}
As new CIs are created, they can be added to the dictionary to keep the pie charts accurate.
Non-edited files
This includes: csv_transformer.py pandas_helper.py transform.py
Mac Instructions
1) Create Virtual Environment
Open a terminal window in the current directory and run the following command. NOTE: You will only need to run one of these commands depending on your PATH variable.
python3 -m venv ./venv
OR
python -m venv ./venv
2) Activate Virtual Environment
source ./venv/bin/activate
Afterwords, you should see (venv) at the beginning of your new line in the terminal window. This means you've done it right!
3) Install required items
pip install -r requirements.txt
After a bit of time, you should get a success message.
4.1) Ensure you have all the required files
Well... do you?
4.2) Run the script
python transform.py
The output file should appear in the outputs directory.
5) Deactivate Virtual Environment
deactivate
Steps 1 and 3 are only needed the first time this is ran.