Challenge 003 · Software Engineering

Decode the Telemetry

Write the limit check at the heart of a ground system. Implement a JavaScript function that picks out the telemetry readings outside their operating limits, then run it against test cases.

Difficulty
Easy
Type
Executable coding challenge
Estimated time
About 20 min
Reputation
Up to 50 REP
Experience
50 XP on first completion

Mission briefing

Curlew-2 is a small Earth observation satellite. Every second it reports on its own health: the battery voltage, the battery temperature, how fast its reaction wheels are turning, the pressure in its propellant tank. During each pass over a ground station that housekeeping telemetry comes down to the ground system, which is where your code runs.

By the time a reading reaches you, the ground system has unpacked its packet, converted the raw counts to engineering units and looked up the limits for that sensor in the mission database. One step is missing: the check itself. You are the ground software engineer. Write the function that goes through a batch of readings and reports the ones outside their limits, so that the operators see them.

Implement findOutOfLimit(records) in the editor. Each record holds a timestamp, a sensorId, the measured value, a lowLimit and a highLimit. Return a list with one entry for every reading that is out of limits, in the order the readings were given. Each entry carries the reading's timestamp, sensorId and value, and a limit of "low" or "high" to say which limit was broken. The objectives below state the rules exactly, and the visible test cases in the workspace show them at work.

Background

Show

Limit checking is the first line of spacecraft health monitoring. For every telemetry parameter the mission database records the range its engineers consider safe, and the ground system compares each incoming value with that range. A value outside it raises an alarm on the operators' displays, often well before anything has failed.

Operational systems refine the idea. Many parameters have two ranges: a yellow one that asks for attention and a red one that demands action. Limits can change with the spacecraft's mode, and a monitor usually waits for several consecutive samples before raising an alarm, so that one noisy reading does not wake the on-call engineer. This challenge keeps the core: one range for each reading, checked one sample at a time.

Telemetry does not always arrive in time order. A pass usually delivers live readings mixed with recorded ones played back from earlier in the orbit. A limit checker reports what it finds in the order it was given and leaves sorting to the displays.

Objectives

  1. Report every reading whose value is below its lower limit or above its upper limit, with limit set to "low" or "high" to say which.

  2. Treat a value exactly equal to a limit as within limits, and leave it out.

  3. Keep the results in the order the readings were given, and report every out-of-limit reading, including repeats from one sensor and readings that share a timestamp.

  4. Give each result exactly four properties: timestamp, sensorId and value, copied unchanged from the reading, and limit.

  5. Return an empty list when the input is empty or every reading is within limits.

  6. Treat the input as read-only. Do not change the list or the records in it; build new objects for the results.

Workspace

Loading the workspace…

Practice attempts

Kept in this browser only, the latest few. Practice results are unverified and are not part of your training record.

Constraints

Show
  • Write JavaScript, and declare findOutOfLimit as a function at the top level of your code, as the starter does. Helper functions are welcome.
  • Your code runs on its own. There are no imports, no network access, no files and no page to touch. console.log works, and what it prints is shown with the results.
  • All test cases together must finish within 2 seconds, and a solution may be at most 20,000 characters long.
  • Run code checks the visible cases only, in an isolated sandbox in your browser. A ranked submission is judged on the Academy's server against the visible cases and 14 private ones, and every case must pass.

What this model leaves out

Show

Every model simplifies. These are the simplifications this one makes.

  • Every record has all five properties with the types shown in the starter code. Values and limits are finite numbers and can be negative, zero or fractional.
  • A reading's lower limit is never greater than its upper limit. The two can be equal, and then only that exact value is within limits.
  • Numbers are compared exactly as given, with no rounding and no tolerance. Operational monitors often add a deadband or wait for a reading to persist; this one does not.
  • Each reading carries a single pair of limits. Yellow and red alarm levels, limits that depend on the spacecraft's mode and checks that compare one sensor with another are left out.
  • Timestamps are ISO 8601 text in UTC. They are labels to copy; the function never needs to parse or compare them.
  • A batch holds at most a few thousand readings.

Hints

There are 5 hints, from a nudge to a strong lead. Using them costs nothing.

    Related lessons and guides

    Mission patches

    A validated result on this challenge counts toward these patches.

    • Code Flight

      Wrote code that decoded a spacecraft's telemetry.

    • First Mission

      Completed a first challenge with a validated result.