Omid - Challenge 334

data-challenges
advanced-exercises
🔰 From the Question Table, extract the issue IDs whose latest status is not Closed.
Published

March 24, 2026

Illustration for Omid - Challenge 334

Challenge Description

🔰 From the Question Table, extract the issue IDs whose latest status is not Closed.

Solutions

library(tidyverse)
library(readxl)

path <- "300-399/334/CH-334 Custom Condition.xlsx"
input <- read_excel(path, range = "B2:D11")
test <- read_excel(path, range = "H2:H5")

result = input %>%
  arrange(Date) %>%
  slice_tail(n = 1, by = `Issue ID`) %>%
  filter(Status != "Close") %>%
  pull(`Issue ID`)

# Solution provided not correct
  • Logic:

    • Reads the workbook ranges needed for the challenge
  • Strengths:

    • The R solution stays close to the workbook rule and keeps the transformation compact.
  • Areas for Improvement:

    • The code assumes the sheet structure and source ranges remain stable.
  • Gem:

    • The strongest part of the solution is choosing the right intermediate representation before shaping the final output.
import pandas as pd

input = pd.read_excel("300-399/334/CH-334 Custom Condition.xlsx", usecols="B:D", skiprows=1, nrows=10)
test = pd.read_excel("300-399/334/CH-334 Custom Condition.xlsx", usecols="H", skiprows=1, nrows=3).iloc[:, 0].tolist()
result = (
    input.sort_values("Date")
    .groupby("Issue ID", as_index=False)
    .tail(1)
    .query('Status != "Close"')["Issue ID"]
    .tolist()
)

# Solution provided not correct.
  • Logic:

    • Reads the workbook ranges needed for the challenge

    • Aggregates or ranks values at the relevant grouping level

  • Strengths:

    • The Python version follows the same rule in a direct dataframe-oriented implementation.
  • Areas for Improvement:

    • The code assumes the workbook layout remains stable, so any sheet redesign would require small adjustments.
  • Gem:

    • The implementation stays close to the original workbook rule instead of adding unnecessary abstraction.

Difficulty Level

This task is moderate:

  • The business rule is readable, but the workbook still requires careful implementation to reach the expected layout.