Katkat

Implement classes within an abstract Python framework

BloombergData Engineer · Technical Screen

Last updated

This question evaluates a candidate's skills in object-oriented design, implementing concrete classes from abstract interfaces, file I/O and streaming data transformations, error handling, and integration with a registry and CLI within a Python codebase.

You are given an existing Python codebase (~200 lines shown) that defines an abstract base class DataProcessor with abstract methods load(self), transform(self, record), and save(self, records); a registry/factory that instantiates processors by name; and a CLI that wires them together. Without editing the abstractions, implement a concrete CsvToJsonProcessor that: (

  1. reads CSV files in chunks; (
  2. transforms each row to a normalized JSON object; (
  3. writes line-delimited JSON to an output path; (
  4. handles bad rows with a retry/logging policy; and (
  5. integrates with the registry so the CLI can invoke it by the name 'csv_to_json'. Provide the class implementation outline and explain the control flow through the existing template methods.