Bird
Raised Fist0
SCADA systemsdevops~30 mins

Data quality flags in SCADA systems - Mini Project: Build & Apply

Choose your learning style10 modes available
Data Quality Flags in SCADA Systems
📖 Scenario: You work with a SCADA system that collects sensor readings from a factory. Each reading has a value and a quality flag that tells if the data is good or has issues.Quality flags help operators know if sensor data is reliable or needs attention.
🎯 Goal: Create a program that stores sensor readings with their quality flags, sets a threshold for acceptable quality, filters out bad data, and shows only good readings.
📋 What You'll Learn
Create a dictionary called sensor_readings with exact keys and values
Add a variable called quality_threshold with the exact value 2
Use a dictionary comprehension to create good_readings with readings having quality flags less than quality_threshold
Print the good_readings dictionary
💡 Why This Matters
🌍 Real World
SCADA systems monitor industrial sensors and use quality flags to ensure operators trust the data before making decisions.
💼 Career
Understanding how to handle data quality flags is important for roles in industrial automation, process control, and data engineering.
Progress0 / 4 steps
1
Create sensor readings dictionary
Create a dictionary called sensor_readings with these exact entries: 'temp_sensor': (22.5, 1), 'pressure_sensor': (101.3, 3), 'humidity_sensor': (45.0, 2), 'flow_sensor': (5.5, 1)
SCADA systems
Hint

Use curly braces {} to create a dictionary. Each key is a sensor name string, and each value is a tuple with a float and an integer.

2
Set quality threshold
Add a variable called quality_threshold and set it to the integer 2
SCADA systems
Hint

Just assign the number 2 to the variable quality_threshold.

3
Filter good quality readings
Use a dictionary comprehension to create a dictionary called good_readings that includes only entries from sensor_readings where the quality flag (second item in the tuple) is less than quality_threshold
SCADA systems
Hint

Use {key: value for key, value in dict.items() if condition} syntax. Check if the second item in the tuple is less than quality_threshold.

4
Display good readings
Write a print statement to display the good_readings dictionary
SCADA systems
Hint

Use print(good_readings) to show the filtered dictionary.

Practice

(1/5)
1. What does a GOOD data quality flag indicate in a SCADA system?
easy
A. The sensor is offline and not sending data.
B. The sensor data is missing or unavailable.
C. The sensor data is suspected to be incorrect.
D. The sensor data is reliable and accurate.

Solution

  1. Step 1: Understand the meaning of data quality flags

    Data quality flags classify sensor data status to help users trust or ignore readings.
  2. Step 2: Identify the meaning of the GOOD flag

    The GOOD flag means the data is reliable and accurate, suitable for use in decisions.
  3. Final Answer:

    The sensor data is reliable and accurate. -> Option D
  4. Quick Check:

    GOOD flag = reliable data [OK]
Hint: GOOD means data is trustworthy and accurate [OK]
Common Mistakes:
  • Confusing GOOD with MISSING or BAD flags
  • Assuming GOOD means sensor is offline
  • Mixing SUSPECT with GOOD data
2. Which of the following is the correct way to represent a BAD data quality flag in a SCADA system configuration file?
easy
A. flag = "BAD"
B. flag = BAD
C. flag = 'bad'
D. flag = bad

Solution

  1. Step 1: Review syntax for string assignment in configuration

    Flags are usually strings and must be enclosed in quotes to be valid.
  2. Step 2: Identify correct string syntax for BAD flag

    Using double quotes around "BAD" is correct; unquoted or lowercase without quotes is invalid.
  3. Final Answer:

    flag = "BAD" -> Option A
  4. Quick Check:

    String flags need quotes [OK]
Hint: Use quotes around string flags in configs [OK]
Common Mistakes:
  • Omitting quotes around string values
  • Using lowercase without quotes
  • Confusing variable names with string literals
3. Given the following SCADA data quality flag array: flags = ["GOOD", "SUSPECT", "BAD", "GOOD", "MISSING"], which flags indicate data that should be excluded from analysis?
medium
A. ["BAD", "MISSING"]
B. ["SUSPECT", "GOOD"]
C. ["GOOD", "SUSPECT"]
D. ["GOOD", "MISSING"]

Solution

  1. Step 1: Identify flags that mark unreliable data

    BAD and MISSING flags indicate data that is incorrect or unavailable and should be excluded.
  2. Step 2: Match these flags to the options

    ["BAD", "MISSING"] correctly lists BAD and MISSING as flags to exclude from analysis.
  3. Final Answer:

    ["BAD", "MISSING"] -> Option A
  4. Quick Check:

    Exclude BAD and MISSING data [OK]
Hint: Exclude BAD and MISSING flags from analysis [OK]
Common Mistakes:
  • Including GOOD or SUSPECT data for exclusion
  • Confusing SUSPECT as always bad
  • Ignoring MISSING data in filtering
4. You have a SCADA script that filters out BAD data using:
filtered = [d for d in data if d.flag != "BAD"]
but it still includes some BAD data. What is the likely cause?
medium
A. The data list is empty, so filtering does nothing.
B. The list comprehension syntax is incorrect and causes errors.
C. The flag comparison is case-sensitive and some flags are lowercase "bad".
D. The filter should use == instead of != to exclude BAD data.

Solution

  1. Step 1: Analyze the filtering condition

    The condition excludes items where flag equals "BAD" exactly, case-sensitive.
  2. Step 2: Identify case sensitivity issue

    If some flags are lowercase "bad", they won't match "BAD" and won't be excluded.
  3. Final Answer:

    The flag comparison is case-sensitive and some flags are lowercase "bad". -> Option C
  4. Quick Check:

    Case sensitivity causes filtering errors [OK]
Hint: Check case sensitivity in string comparisons [OK]
Common Mistakes:
  • Assuming != excludes all BAD flags regardless of case
  • Thinking list comprehension syntax is wrong
  • Using wrong comparison operator
5. You want to create a SCADA alert that triggers only when sensor data is either BAD or MISSING. Which logical condition correctly implements this?
hard
A. if flag == "BAD" and flag == "MISSING":
B. if flag == "BAD" or flag == "MISSING":
C. if flag != "BAD" or flag != "MISSING":
D. if flag == "GOOD" or flag == "SUSPECT":

Solution

  1. Step 1: Understand alert condition requirements

    The alert should trigger if the flag is BAD or MISSING, meaning either condition is true.
  2. Step 2: Choose correct logical operator

    Using 'or' checks if flag equals BAD or equals MISSING, which matches the requirement.
  3. Final Answer:

    if flag == "BAD" or flag == "MISSING": -> Option B
  4. Quick Check:

    Use 'or' to combine conditions for alert [OK]
Hint: Use 'or' to check multiple flag conditions [OK]
Common Mistakes:
  • Using 'and' which requires both flags simultaneously
  • Using negation incorrectly
  • Checking for GOOD or SUSPECT instead
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard