Repository challenges
Build a reproducible conversion metric
Feature · Intermediate · Data analytics · 35 minutes
Engineering ticket
Implement daily(events). Each valid event contains date (YYYY-MM-DD), user (string), and converted (boolean). Count each user once per date. A user converts if any event for that user on that date has converted=True. Return rows [date, unique_users, converted_users, rate] sorted by date. Round rate to six decimal places. Empty input returns []. Explain why counting events instead of users changes the metric.
Review rubric
- Correctness on documented inputs
- Tests and edge cases
- Clear explanation of trade-offs
Reading the ticket and starter files is public. Sign in to save edits, run tests and submit evidence. Code-review quality requires human review.
Starter repository
README.md
# InferenceAI engineering lab Read the ticket, inspect the files, reproduce the issue and implement the contract. Run visible tests while working. Submit checks protected cases. Explain your changes and limitations.
metrics.py
def daily(events):
return []
tests/test_metrics.py
import unittest
from metrics import *
class ContractTest(unittest.TestCase):
def test_example(self):
self.assertEqual(daily([{"date":"2026-01-01","user":"a","converted":False},{"date":"2026-01-01","user":"a","converted":True}]), [["2026-01-01",1,1,1.0]])