The algorithms I use in the Healthy Body Calculator® are proprietary, but the program is available for license on intranets or other websites if you are interested. My calculator is written in PHP.
Nutrition is not an exact science and a lot of nutrition is subjective which doesn’t blend well with computer logic – lots of variables among people. Yes, some nutrients in excess to a point could be healthier but could also be toxic. Canada has similar nutritional guidelines like the U.S.
I have been designing nutrition software since 1989 and I would highly recommend you work with a registered dietitian so you use valid algorithms. Would also recommend you work with a dietitian who is technologically savvy.