The Near Perfect Diet is a series of blog posts, and eventually also a book, proposing a diet that is near perfect, based on current medical studies on nutrition and disease.
Why onions should be a major component of a near perfect diet
Studies show a substantial reduction in risk of disease and mortality with a regular (daily or near daily) consumption of onions.
* Risk Reduction (RR) for >=7 portions per week onions
Reduction in Cancer Risk for certain sites 
-84% Oral cavity and pharynx
-71% Prostate [borderline p=0.05]
-56% Large bowel
* Allium Foods and Stomach Cancer Risk 
-30% high intake of allium foods vs. stomach cancer incidence
Allium foods: onion, garlic, scallion
* Brain Cancer Risk 
-90% moderate consumption of onions vs. brain cancer
A very high reduction in risk of brain cancer was observed for moderate consumption of onions.
* Cardiovascular Disease CVD
-64% Allium vegetables intake vs. CVD
-32% Allium vegetables intake vs. Chronic Kidney Disease
-26% Allium vegetables intake vs. Hypertension development
“A higher habitual intake of allium vegetables was associated with a 64% reduced risk of CVD outcomes (hazard ratio = 0.36, 95% confidence interval, CI = 0.18–0.71; P for trend = 0.011), 32% lower incidence of CKD (hazard ratio = 0.69, 95% CI = 0.46–0.98; P for trend = 0.11), and 26% decreased HTN development (hazard ratio = 0.74, 95% CI = 0.54–1.00; P for trend = 0.06).”
* Lung Cancer 
-50% high intake of onions vs. lung cancer
“The lung cancer OR for the highest compared with the lowest quartile of intake was 0.5 (95% CI = 0.3-0.9) for onions (P for trend = .001)”
Cooked or Raw?
Boiling onions or any other vegetable or fruit reduces the flavonoid content as the flavonoids are partially lost to the boiling water (except when it is consumed, as is the case for soup) and the heat destroys a portion of the flavonoids as well. Quercetin is not destroy and may be increased by baking or sautéing. Onions are a major source of quercetin in the diet.
85 grams (3.0 oz) of yellow onions, or 50 grams (1.8 oz) of red onions, or 70 grams (2.5 oz) of mixed yellow and red onions, per day. The onions may be cooked or raw. It would probably be best to sometimes eat them raw and other times cooked.
 Galeone, Carlotta, et al. “Onion and garlic use and human cancer.” The American journal of clinical nutrition 84.5 (2006): 1027-1032.
 Nan et al., Kimchi and soybean pastes are risk factors of gastric cancer; World Journal of Gastroenterology. 2005;11(21):3175-3181. http://www.researchgate.net/publication/7813289_Kimchi_and_soybean_pastes_are_risk_factors_of_gastric_cancer/file/e0b49515d875cf0063.pdf
 Hu et al., Diet and brain cancer in adults: A case-control study in Northeast China; International Journal of Cancer. Volume 81, Issue 1, pages 20-23, 31 March 1999. http://onlinelibrary.wiley.com/doi/10.1002/%28SICI%291097-0215%2819990331%2981:1%3C20::AID-IJC4%3E3.0.CO;2-2/full
 Bahadoran, Zahra, et al. “Allium vegetable intakes and the incidence of cardiovascular disease, hypertension, chronic kidney disease, and type 2 diabetes in adults: A longitudinal follow-up study.” Journal of hypertension 35.9 (2017): 1909-1916.
 Le Marchand, Loïc, et al. “Intake of flavonoids and lung cancer.” Journal of the National Cancer Institute 92.2 (2000): 154-160.