Quick-start: price share of each lot's scored weight (GitHub e7f3154)
Browse filesFiles changed (2)
- CHANGELOG.md+4
- README.md+26-12
12 unmodified lines13141516171812 unmodified lines`unnamed_pct` column, so the four sum to 100 per lot, and drops lots with nothing toclassify. The data is unchanged; only the example was wrong.- The card asks users to say what they use the dataset for, in a discussion or an issue.## v2026.1012 unmodified lines1314151617181920212212 unmodified lines`unnamed_pct` column, so the four sum to 100 per lot, and drops lots with nothing toclassify. The data is unchanged; only the example was wrong.- The card asks users to say what they use the dataset for, in a discussion or an issue.- **The card's quick-start query now reports the same metric as query 1**: price share ofeach lot's scored weight, averaged per authority. It used to average the weight of everyprice criterion, including the 0% `Price` line a portal template carries beside itsplaceholder slots, so authorities using that template read close to 0% price.## v2026.10
93 unmodified lines94959697989910010110210310410510610710810911011193 unmodified linesimport duckdbcon = duckdb.connect()# Mean weight of price criteria, per UK authority (UK-native feeds only, see caveats)con.sql("""SELECT b.canonical_name,round(avg(c.weight_pct) FILTER (WHERE r.role = 'price'), 1) AS mean_price_weight_pct,count(DISTINCT c.notice_id) AS noticesFROM 'hf://datasets/NodeNovaOrg/bidlens-open-data/data/criteria/*.parquet' cJOIN 'hf://datasets/NodeNovaOrg/bidlens-open-data/data/buyers/*.parquet' bON b.buyer_name = c.buyer_name AND b.buyer_id IS NOT NULLLEFT JOIN 'hf://datasets/NodeNovaOrg/bidlens-open-data/data/criterion_roles/*.parquet' rON r.name = c.nameWHERE c.source IN ('fts_bulk_xml', 'fts_api') AND c.weight_pct IS NOT NULLGROUP BY b.buyer_id, b.canonical_name HAVING notices >= 10 ORDER BY notices DESC LIMIT 20""").show()```93 unmodified lines94959697989910010110210310410510610710810911011111211311411511611711811912012112212312412593 unmodified linesimport duckdbcon = duckdb.connect()HF = "hf://datasets/NodeNovaOrg/bidlens-open-data/data"# Price share of each lot's scored weight, averaged per UK authority (UK-native feeds only).# Lots that were not competed, and lots made only of portal placeholder slots, have no split.con.sql(f"""WITH c AS (SELECT c.source, c.notice_id, c.lot_id, c.buyer_name, c.weight_pct,CASE WHEN r.role IS NOT NULL AND r.role <> 'unknown' THEN r.roleWHEN c.criterion_type IN ('price', 'quality') THEN c.criterion_typeELSE 'unknown' END AS roleFROM '{HF}/criteria/*.parquet' cLEFT JOIN '{HF}/criterion_roles/*.parquet' r ON r.name = c.nameWHERE c.source IN ('fts_bulk_xml', 'fts_api') AND c.weight_pct IS NOT NULL), lots AS (SELECT source, notice_id, lot_id, min(buyer_name) AS buyer_name,sum(CASE WHEN role = 'price' THEN weight_pct ELSE 0 END) AS price,sum(CASE WHEN role IN ('quality', 'social_value') THEN weight_pct ELSE 0 END) AS other,sum(CASE WHEN role IN ('unknown', 'template_slot') THEN weight_pct ELSE 0 END) AS unnamed,bool_or(role IN ('not_competed', 'undisclosed', 'unsplit') AND weight_pct > 0) AS no_contestFROM c GROUP BY source, notice_id, lot_id)SELECT b.canonical_name, count(*) AS lots,round(avg(100 * price / (price + other + unnamed)), 1) AS price_share_pctFROM lots JOIN '{HF}/buyers/*.parquet' bON b.buyer_name = lots.buyer_name AND b.buyer_id IS NOT NULLWHERE NOT no_contest AND price + other > 0GROUP BY b.buyer_id, b.canonical_name HAVING lots >= 10 ORDER BY lots DESC LIMIT 20""").show()```
CHANGELOG.md+4
README.md+26-12