procedure type kibs text class n tenders n with bids n single bidder pct single bidder avg bids
Atklāts konkurss
non_kibs
219
218
50
22.9
4.72
Atklāts konkurss
possible_kibs
59
58
15
25.9
3.33
Atklāts konkurss
strict_kibs
112
111
20
18
4.79
Atklāts konkurss
weak_signal
129
119
40
33.6
3.5
Mazie iepirkumi
non_kibs
179
144
48
33.3
3.33
Mazie iepirkumi
possible_kibs
33
31
13
41.9
2.1
Mazie iepirkumi
strict_kibs
135
116
26
22.4
3.56
Mazie iepirkumi
weak_signal
47
44
22
50
2.93
WITH bids AS (
  SELECT a_identifiers AS tender_id, count(*) AS bid_rows
  FROM xlsx_gold_standard_v12_b56445cb_1
  GROUP BY 1
)
SELECT
  p.proceduras_veids AS procedure_type,
  p.kibs_text_class,
  count(*) AS n_tenders,
  count(b.tender_id) AS n_with_bids,
  sum(case when b.bid_rows = 1 then 1 else 0 end) AS n_single_bidder,
  round(100.0 * sum(case when b.bid_rows = 1 then 1 else 0 end)
        / nullif(count(b.tender_id), 0), 1) AS pct_single_bidder,
  round(avg(b.bid_rows), 2) AS avg_bids
FROM xlsx_gold_standard_v12_b56445cb_4 p
LEFT JOIN bids b ON b.tender_id = p.iepirkuma_id
GROUP BY 1, 2
ORDER BY procedure_type, kibs_text_class