Week 4: The Interface

←

Week 4: The Interface

datadriven·

A hospital's lab results arrive as HL7 messages, a text format older than the web. The quality team needs 1 clean row per result.

The brief is at https://datadriven.io/community/week-4. Ask about the brief, the rules, the schema. Talk about what you are seeing in the sample.

The results are in. This thread is now the place for approaches, write-ups, and what beat you.

78

10 comments

Kobe_Bryant·· edited

hello DD, could you check and explain why my code score 0 ?

my code when I run on sample

  • Elapsed time: 1m 15s / 10m
  • Estimated full-stream duration at the current pace: 10 minutes
  • Peak memory usage: 19 / 512 MB
  • Rows matching schema: 300 / 300
  • Records produced: 300 / 300 (1 row per record)
  • Rows with unique keys: 300 / 300
20
datadrivenop·· edited

Your run scored 0 because it ran out of memory. Your handler kept the candidate for every key, + a fingerprint of every line, and builds its rows at the end in finalize(). Over 1,000,000 lines that grows to about 1.2 GB against the 512 MB limit. The run was stopped after reading every record but before finalize() returned any rows, so nothing was scored. The sample couldn't show you this. "Peak memory 19/512 MB" measured 300 lines, which is mostly Python itself. That figure now projects onto the full stream, and your code reads about 1,238/512 MB there. Your result also said "timeout"; it now says memory.

On cost, you're right: your work per record was close to the winner's, 1.77× the median against their 1.71×. But cost counts how much your code does per record, not how much it keeps. Your run read all 1,000,000 records in under 2 minutes. The winning run did similar work per line but held far less, so it finished. Your logic is strong. Scored offline on the same stream, your rows come to 0.7883, which would have been second. Next time, keep only the current winner for each key, store small tuples instead of dicts, and drop the line fingerprints if you can, and you'll be well under the limit!

18

Is there any way to get more visibility into a run while it’s happening live memory/record progress rather than just a final summary once it’s killed or times out?
Would love a similar challenge but for Pyspark!

12

Thank you so much as usual DD,
I will check my architecture carefully before I submit next time :(

10

Thanks for the clarification!

19

Great! With around 3 keys from the JSON logs, the output has 7 columns. This week's challenge is amazing!

14
datadrivenop·· edited

We're counting on you to grab the #1 slot this week!

8

The sanity check reports rows: "Records produced 1 row" as 0.0 / 300.0 for my submission, even though schema: "Rows matching schema" is 300/300 and keys: "Rows with an unrepeated key" is also 300/300, with overall sanity_status: "ok". what does that exactly mean?

14

The check was counting rows per record as they came out of process(). Your handler holds rows and emits them from finalize(), which is a perfectly good way to solve this one, so every record looked like it produced nothing even though all 300 rows were there and correct. That's why schema and keys read 300/300 and the status was ok: those are measured on the rows you actually emitted, and they were fine. Your score was never affected. The tester only ever looked at the rows, not at which method returned them.
finalize() rows now count toward the records that produced them. Your submission reads 300/300 under the fix. The figure will show correctly on your next submission.

19

I also have the same confusion like @pranav_sarwe also :)))
Let me try a different approach in this week competition :)

16