Problem Definition and Input-Output Mapping Profiles

🏷️ Final Capstone Engineer Script project / Planning an Automation Script

🧭 Context Introduction

Before writing a single line of code, every successful automation script starts with a clear understanding of what problem we are solving and what data flows in and out. This planning phase saves hours of debugging and rework later. Think of it as drawing a blueprint before building a houseβ€”you need to know where the doors, windows, and pipes go before you start hammering nails.


πŸ•΅οΈ What is Problem Definition?

Problem definition is simply writing down what your script needs to accomplish in plain language. It answers three core questions:

  • What is the current manual process? (e.g., "We manually check 50 server logs every morning")
  • What pain point exists? (e.g., "It takes 2 hours and we often miss critical errors")
  • What does success look like? (e.g., "A script that scans all logs in 5 minutes and emails a summary")

A well-defined problem statement acts as your north star throughout development. It keeps you focused and prevents "scope creep"β€”when your script tries to do too many things and ends up doing none of them well.


πŸ“Š Input-Output Mapping Profiles Explained

Every script has inputs (what goes in) and outputs (what comes out). Mapping these before coding is like knowing your ingredients and your final dish before you start cooking.

Common input types you will encounter: - Command-line arguments – values passed when running the script (e.g., a filename or server IP) - Configuration files – settings stored in YAML, JSON, or INI format - Environment variables – system-level values like API keys or paths - User prompts – interactive questions asked during script execution - File reads – data pulled from CSV, log files, or databases

Common output types you will produce: - Console messages – text printed to the terminal for real-time feedback - Report files – structured outputs like CSV summaries or HTML dashboards - Log files – timestamped records of what the script did - API responses – data sent to other systems or services - Status codes – simple success/failure indicators


βš™οΈ The Input-Output Mapping Table

A simple table helps you visualize the data flow before writing any code. Here is an example for a script that checks disk space across multiple servers:

Input Source Format Output Destination
Server list Command-line argument Comma-separated IPs Disk usage per server Console output
Threshold value Environment variable Integer (percentage) Alert if threshold exceeded Log file
SSH credentials Config file (YAML) Username/password Connection status Console message
Timestamp System clock ISO format Report header CSV report file

This table forces you to think about where data comes from, what shape it is in, and where it needs to go. It also reveals missing pieces earlyβ€”like realizing you forgot to plan for error messages.


πŸ› οΈ Step-by-Step Approach to Problem Definition

Follow these steps for every script you plan:

Step 1 – Write the problem in one sentence Keep it tight. Example: "Automate the daily backup verification report for 200 virtual machines."

Step 2 – List all inputs you can think of Brainstorm everything the script might need. Start broad, then refine. Include edge cases like "what if the input file is empty?"

Step 3 – Define all expected outputs Be specific about format, location, and content. "A CSV file with three columns: VM name, backup status, timestamp."

Step 4 – Identify failure scenarios What happens when an input is missing? When a server is unreachable? When the output directory doesn't exist? Document these now.

Step 5 – Create your input-output mapping table Use the format shown above. This becomes your reference document during coding.


πŸ“‹ Real-World Example: Log Parser Script

Let's walk through a concrete example to tie everything together.

Problem Statement: "Our team manually searches through 20 application log files each morning to find ERROR and CRITICAL entries. This takes 45 minutes and we sometimes miss entries. We need a script that scans all logs, extracts high-severity entries, and produces a summary report."

Inputs identified: - Directory path containing log files (command-line argument) - Log file name pattern (hardcoded or configurable) - Severity levels to search for (config file) - Date range filter (optional, command-line argument)

Outputs identified: - Summary report printed to console with count of errors found - Detailed CSV file with timestamp, severity, source file, and message - Log file of script execution (start time, files scanned, errors encountered)

Input-Output Mapping Table:

Input Source Format Output Destination
Log directory path Command-line argument String path File list summary Console
Severity levels Config file (JSON) List of strings Filtered entries CSV report
Date range Command-line argument YYYY-MM-DD format Execution log Log file
Log file contents File system Plain text Error count Console

βœ… Key Takeaways for Your Script Planning

  • Start with the problem, not the code. A clear problem statement prevents wasted effort.
  • Map inputs and outputs before writing anything. This reveals hidden requirements and edge cases.
  • Use a mapping table as your blueprint. It is simple, visual, and catches gaps early.
  • Plan for failures, not just happy paths. Robust scripts handle missing files, bad data, and network issues gracefully.
  • Keep your mapping document updated. As requirements change, update your table before changing your code.

πŸ”„ Next Steps

With your problem defined and input-output mapping complete, you are ready to move into script structure designβ€”deciding how to organize your code into functions, where to place error handling, and how to make the script reusable across different environments. A solid plan now means smoother coding later.


This section shows how to define what a script must do by mapping its inputs to expected outputs before writing the full solution.


πŸ”§ Example 1: Single input, single output β€” temperature conversion

This example maps one Celsius input to one Fahrenheit output.

celsius_input = 25
fahrenheit_output = (celsius_input * 9/5) + 32

πŸ“€ Output: 77.0


πŸ”§ Example 2: Two inputs, one output β€” pipe flow rate

This example maps pipe diameter and velocity to a flow rate result.

diameter_m = 0.1
velocity_m_per_s = 2.5
area_m2 = 3.14159 * (diameter_m / 2) ** 2
flow_rate_m3_per_s = area_m2 * velocity_m_per_s

πŸ“€ Output: 0.0196349375


πŸ”§ Example 3: One input, multiple outputs β€” beam stress analysis

This example maps a single load value to both bending moment and shear force.

load_N = 5000
beam_length_m = 3.0
bending_moment_Nm = (load_N * beam_length_m) / 4
shear_force_N = load_N / 2

πŸ“€ Output: bending_moment_Nm = 3750.0, shear_force_N = 2500.0


πŸ”§ Example 4: Multiple inputs, conditional output β€” pressure vessel check

This example maps pressure and radius to a safety status based on a threshold.

internal_pressure_Pa = 150000
vessel_radius_m = 0.5
wall_thickness_m = 0.01
stress_Pa = (internal_pressure_Pa * vessel_radius_m) / wall_thickness_m
max_allowed_stress_Pa = 7500000
is_safe = stress_Pa <= max_allowed_stress_Pa

πŸ“€ Output: True


πŸ”§ Example 5: File-based input mapping β€” reading sensor data

This example maps a CSV file of sensor readings to a summary output.

sensor_readings = [23.5, 24.1, 22.8, 25.0, 23.9]
average_temperature = sum(sensor_readings) / len(sensor_readings)
max_temperature = max(sensor_readings)
min_temperature = min(sensor_readings)

πŸ“€ Output: average_temperature = 23.86, max_temperature = 25.0, min_temperature = 22.8


πŸ“Š Comparison Table: Input-Output Profiles

Profile Type Number of Inputs Number of Outputs Example Use Case
One-to-One 1 1 Unit conversion
Many-to-One 2+ 1 Flow rate calculation
One-to-Many 1 2+ Beam stress analysis
Conditional 2+ 1 (boolean) Safety check
Summary Many 3+ Sensor data analysis

🧭 Context Introduction

Before writing a single line of code, every successful automation script starts with a clear understanding of what problem we are solving and what data flows in and out. This planning phase saves hours of debugging and rework later. Think of it as drawing a blueprint before building a houseβ€”you need to know where the doors, windows, and pipes go before you start hammering nails.


πŸ•΅οΈ What is Problem Definition?

Problem definition is simply writing down what your script needs to accomplish in plain language. It answers three core questions:

  • What is the current manual process? (e.g., "We manually check 50 server logs every morning")
  • What pain point exists? (e.g., "It takes 2 hours and we often miss critical errors")
  • What does success look like? (e.g., "A script that scans all logs in 5 minutes and emails a summary")

A well-defined problem statement acts as your north star throughout development. It keeps you focused and prevents "scope creep"β€”when your script tries to do too many things and ends up doing none of them well.


πŸ“Š Input-Output Mapping Profiles Explained

Every script has inputs (what goes in) and outputs (what comes out). Mapping these before coding is like knowing your ingredients and your final dish before you start cooking.

Common input types you will encounter: - Command-line arguments – values passed when running the script (e.g., a filename or server IP) - Configuration files – settings stored in YAML, JSON, or INI format - Environment variables – system-level values like API keys or paths - User prompts – interactive questions asked during script execution - File reads – data pulled from CSV, log files, or databases

Common output types you will produce: - Console messages – text printed to the terminal for real-time feedback - Report files – structured outputs like CSV summaries or HTML dashboards - Log files – timestamped records of what the script did - API responses – data sent to other systems or services - Status codes – simple success/failure indicators


βš™οΈ The Input-Output Mapping Table

A simple table helps you visualize the data flow before writing any code. Here is an example for a script that checks disk space across multiple servers:

Input Source Format Output Destination
Server list Command-line argument Comma-separated IPs Disk usage per server Console output
Threshold value Environment variable Integer (percentage) Alert if threshold exceeded Log file
SSH credentials Config file (YAML) Username/password Connection status Console message
Timestamp System clock ISO format Report header CSV report file

This table forces you to think about where data comes from, what shape it is in, and where it needs to go. It also reveals missing pieces earlyβ€”like realizing you forgot to plan for error messages.


πŸ› οΈ Step-by-Step Approach to Problem Definition

Follow these steps for every script you plan:

Step 1 – Write the problem in one sentence Keep it tight. Example: "Automate the daily backup verification report for 200 virtual machines."

Step 2 – List all inputs you can think of Brainstorm everything the script might need. Start broad, then refine. Include edge cases like "what if the input file is empty?"

Step 3 – Define all expected outputs Be specific about format, location, and content. "A CSV file with three columns: VM name, backup status, timestamp."

Step 4 – Identify failure scenarios What happens when an input is missing? When a server is unreachable? When the output directory doesn't exist? Document these now.

Step 5 – Create your input-output mapping table Use the format shown above. This becomes your reference document during coding.


πŸ“‹ Real-World Example: Log Parser Script

Let's walk through a concrete example to tie everything together.

Problem Statement: "Our team manually searches through 20 application log files each morning to find ERROR and CRITICAL entries. This takes 45 minutes and we sometimes miss entries. We need a script that scans all logs, extracts high-severity entries, and produces a summary report."

Inputs identified: - Directory path containing log files (command-line argument) - Log file name pattern (hardcoded or configurable) - Severity levels to search for (config file) - Date range filter (optional, command-line argument)

Outputs identified: - Summary report printed to console with count of errors found - Detailed CSV file with timestamp, severity, source file, and message - Log file of script execution (start time, files scanned, errors encountered)

Input-Output Mapping Table:

Input Source Format Output Destination
Log directory path Command-line argument String path File list summary Console
Severity levels Config file (JSON) List of strings Filtered entries CSV report
Date range Command-line argument YYYY-MM-DD format Execution log Log file
Log file contents File system Plain text Error count Console

βœ… Key Takeaways for Your Script Planning

  • Start with the problem, not the code. A clear problem statement prevents wasted effort.
  • Map inputs and outputs before writing anything. This reveals hidden requirements and edge cases.
  • Use a mapping table as your blueprint. It is simple, visual, and catches gaps early.
  • Plan for failures, not just happy paths. Robust scripts handle missing files, bad data, and network issues gracefully.
  • Keep your mapping document updated. As requirements change, update your table before changing your code.

πŸ”„ Next Steps

With your problem defined and input-output mapping complete, you are ready to move into script structure designβ€”deciding how to organize your code into functions, where to place error handling, and how to make the script reusable across different environments. A solid plan now means smoother coding later.

Interactive Views

You are currently in πŸ“š All-in-One mode. Use the tabs at the top to switch to πŸ“– Theory Only or πŸ’» Code Only views.

This section shows how to define what a script must do by mapping its inputs to expected outputs before writing the full solution.


πŸ”§ Example 1: Single input, single output β€” temperature conversion

This example maps one Celsius input to one Fahrenheit output.

celsius_input = 25
fahrenheit_output = (celsius_input * 9/5) + 32

πŸ“€ Output: 77.0


πŸ”§ Example 2: Two inputs, one output β€” pipe flow rate

This example maps pipe diameter and velocity to a flow rate result.

diameter_m = 0.1
velocity_m_per_s = 2.5
area_m2 = 3.14159 * (diameter_m / 2) ** 2
flow_rate_m3_per_s = area_m2 * velocity_m_per_s

πŸ“€ Output: 0.0196349375


πŸ”§ Example 3: One input, multiple outputs β€” beam stress analysis

This example maps a single load value to both bending moment and shear force.

load_N = 5000
beam_length_m = 3.0
bending_moment_Nm = (load_N * beam_length_m) / 4
shear_force_N = load_N / 2

πŸ“€ Output: bending_moment_Nm = 3750.0, shear_force_N = 2500.0


πŸ”§ Example 4: Multiple inputs, conditional output β€” pressure vessel check

This example maps pressure and radius to a safety status based on a threshold.

internal_pressure_Pa = 150000
vessel_radius_m = 0.5
wall_thickness_m = 0.01
stress_Pa = (internal_pressure_Pa * vessel_radius_m) / wall_thickness_m
max_allowed_stress_Pa = 7500000
is_safe = stress_Pa <= max_allowed_stress_Pa

πŸ“€ Output: True


πŸ”§ Example 5: File-based input mapping β€” reading sensor data

This example maps a CSV file of sensor readings to a summary output.

sensor_readings = [23.5, 24.1, 22.8, 25.0, 23.9]
average_temperature = sum(sensor_readings) / len(sensor_readings)
max_temperature = max(sensor_readings)
min_temperature = min(sensor_readings)

πŸ“€ Output: average_temperature = 23.86, max_temperature = 25.0, min_temperature = 22.8


πŸ“Š Comparison Table: Input-Output Profiles

Profile Type Number of Inputs Number of Outputs Example Use Case
One-to-One 1 1 Unit conversion
Many-to-One 2+ 1 Flow rate calculation
One-to-Many 1 2+ Beam stress analysis
Conditional 2+ 1 (boolean) Safety check
Summary Many 3+ Sensor data analysis