DMB Calculator Program Build - Hedgehog Central Hedgehog pet care & owner forum
Hedgehog Central GalleryForum Archives Facebook Link

Like Tree7Likes
Reply
 
LinkBack Thread Tools
Old 07-02-2016, 09:14 PM   #1 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default DMB Calculator Program Build

This thread is for the DMB calculator I'm working on. It will contain build notes, how it works, and each finished rendition of the executable file. I managed to dig up my old copy of Visual Basic, so I'll actually be making an executable program that will (hopefully!) do all of the math. It will basically look like a huge version of the standard Microsoft calculator, with more specific labels.

Assuming I still know what I'm doing, the calculator will ultimately be able to take your data for whatever food you want from the numbers available on this website: https://ndb.nal.usda.gov/ndb/foods?f...t=0&order=desc and turn it into the dry matter basis, so that all foods you want to put in a mix are being considered equally. For example, comparing celery to freeze dried quail, the celery will be almost 100% water, while the quail will be almost 0% water. The calculator will balance out the water content of anything entered, which will then give you comparable stats for protein, fat, fiber, and sugar.

If that goes well, the next step is to make the calculator take everything you've entered for meats, veggies, and fruits, and tell you the ratio you want to use. This will take into account a total from the results you entered in step 1. I'm not sure if I'll have a separate calculator for this or if I'll add it as a side feature, but either way you'll likely have to do basic math to get your total fat/protein/fiber/sugar contents for each section. If I'm really clever I can make the program do it, but it means if you decide not to use a food you have to start over.

And if that somehow works out, I'll add a feature that tells you how much calcium supplement still needs to be added to the final mix to balance out the calciumhosphorous ratio.

I'm also going to include a spreadsheet of commonly used items and their DMB values so you don't have to keep entering chicken and broccoli over and over.

It sounds complicated now, but trust me, if it works it will make raw diets so much easier to calculate!

Here is the raw data file Kelsey and I have compiled our information into so far. Feel free to have a look, but please don't edit it without switching into suggestion mode, because I'm using it to build the calculator: https://docs.google.com/document/d/1...it?usp=sharing

I should have a prototype for everyone to play with by the end of next week. I'll keep updating here as it grows and becomes functional.
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
Sponsored Links
Advertisement
 
Old 07-02-2016, 09:32 PM   #2 (permalink)
Member
 
twobytwopets's Avatar
 
Join Date: Feb 2014
Posts: 2,553
Default

This will be so great for us non-math people. The scariest thing about any diet is the thought that "I have to math, I don't math"
I joked in college that my math classes should have started out with crayons and flashcards with just numbers!
Lilysmommy and FinnickHog like this.
twobytwopets is offline   Reply With Quote Quick reply to this message
Old 07-02-2016, 10:25 PM   #3 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default

I was never any good with math, really. But for some reason when I'm entering it as an equation into a program it works fine. Unfortunately I just had to test my equation to make sure it was working, and that took 45 minutes . I've got it, though, I think!

The first rendition will only work if a total weight of 100 grams is set, but the accompanying website has that in the first column all ready to go. So it's not a huge deal yet, I just don't want to have to do any more algebra until I'm sure my totals out of 100g is working. That said, here's my current formula on its own, not in code yet:

total weight (grams) = g
water (g) = w


protein (g) = p
fat (g) = fa
fiber (g) = fi
sugar (g) = s
(protein, fat, fiber, sugar all work with the same equation, so they have been labeled i for input)

t-w = d (DMB% of dry matter). t minus w equals d.
ix100/d = result. i multiplied by 100 divided by d equals result.

So if we test it, and please do, because I might be completely wrong, this happens:

https://ndb.nal.usda.gov/ndb/foods/show/112?manu=&fgcd=
Egg, Whole, Raw, Fresh

t = 100g
w = 76.15
p = 12.56
fa = 9.51
fi = 0
s = 0.37

t-w = d gives me 100-76.15 = 23.85
ix100/d = result gives me (for protein (p)) 12.56x100/23.85 = 52.66% DMB for protein.

I've tested it a few times and it seems to be working. I've just asked a very mathy friend to play with it a bit and he should be able to give us a conclusive answer as to whether or not it works pretty quickly. And then it's coding time! I'm working on the layout in the meantime and it should look pretty good.
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
 
Old 07-02-2016, 11:29 PM   #4 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default

I just got the all clear on the formula, so on to phase 2.

It doesn't do anything yet, but it sure is pretty!



Taking a dinner break and then going through some tutorials to remind myself how to actually code the button at the bottom to do something. This is the part that will take time .
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
Old 07-03-2016, 09:21 PM   #5 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default

Well it came back to me a lot faster than I thought it would. Right now the program can only handle total weights of 100 grams, so be sure to use the first column in the nutritional information website.

The website again is: https://ndb.nal.usda.gov/ndb/foods?f...t=0&order=desc

The formula should be accurate and the numbers in the grey boxes on the right will be your DMB% of each protein, fat, fiber, and sugar. Feel free to leave sugar or fiber blank if you're not worried about them right now. It will only crash if you blank out the 0s completely .

If anyone wants to try inputting numbers from the website or off the top of your heads and then doing the math longhand using the equation above it would really be appreciated. Once my math guy gets home I'll have him mess with it as well.

But basically, this version works!

To use it, input your desired food's total weight (100 grams!), the water weight, and then the protein, fat, fiber, and sugar weights. It will output into a percentage. Write this percentage down in columns of protein, fat, fiber, and sugar, and move on to the next food. Once you have a full list, add your total protein percentages together and divide by the number of foods on the list to get the total percentage of protein in your mix. Do the same for fat, fiber, and sugar, as needed, and then compare this to the data in the nutrition stickies. I'm hoping to make a calculator for this as well, but it's not in there yet.


Bugs/fixes:
- If protein, fat, fiber, or sugar are blanked out the program will crash.
- If protein, fat, fiber, or sugar are inputted as higher than the total dry matter percentage, they will still attempt to display and will give you over 100%
-Only accepts 100g total weight right now, because math is hard and I am lazy

-Will be rounding outputs to 00.00 digits and adding a % sign.
-Will eventually allow for total weights other than 100g, in case someone wants the DMB of a single egg, for example.
-Needs more work with debugging and error messages.


It's zipped, so you'll have to extract it and then run the .exe. I made it myself, but if you're nervous, virus scan it as soon as you extract it.

Please post here with any questions or concerns!
Attached Files
File Type: zip DMB mk1 compile3.zip (5.2 KB, 5 views)
Draenog likes this.
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
Old 07-09-2016, 06:29 AM   #6 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default

Just wanted to bump this in case anyone didn't see the original update. The file attached to the post above is a working DMB calculator.

I'm in the process of figuring out how to get it to output the total diet's DMB so you can tell if the meal you've developed is within the appropriate ranges or not without having to do it manually. I'll hopefully have that done soon.
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
Old 07-18-2016, 10:54 PM   #7 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default

Ooookay. So the program now has 3 sections. Section 1 will take one ingredient's data from the website above (or insect spreadsheet once it's done) and convert it into DMB %. You then take those outputted numbers and put them into the corresponding boxes (insects, meat, veggies, fruit, then protein, fat, or fiber) in Section 2 and do your next ingredient until you're done.

Once Section 2 is completed, it will calculate your protein, fat, and fiber contents for each type (insects, meat, veg, fruit).

Section 3 has adjustable ratio boxes so you can decide how much of each ingredient type you want to have in your final mix, and then that section will tell you if your completed mix is within the parameters I've set.

Those parameters are:
Protein: 20%-35%
Fat: 10%-17%
Fiber: 5%-15%

These are just based on the average hedgehog and obviously won't apply to every single hedgie, so some people will have to use higher or lower fat content goals. It will still work outside these parameters so that's not a problem.

Section 2 is still throwing a few temper tantrums. Right now, if your food has a value of 0 for protein, fat, or fiber, the Section 2 program can't read it as a number, so you need to put "0.01"

If you don't use all of the boxes in Section 2, fill any unused ones with 0s so that the program doesn't have a hissy fit. I'm still debugging this, so it *will* work properly eventually.

(for coders: it doesn't recognize an empty box as an empty box and I can't remember the command to tell it to safely ignore empty boxes, so 0 is set as my null value)

Other than that, it should be working as intended! Please view the readme for more in depth info!

I'm going to make an insect DMB value spreadsheet next so there's a reliable source for that data available, but for now use the website in my first post for meat, veg, and fruit data.

Once I'm done all the spreadsheets and if I can get it working, the calcium calculator, I'll post a new thread that will hopefully be sticky-worthy.
Attached Files
File Type: zip mark4.zip (18.6 KB, 2 views)
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
Old 07-19-2016, 06:19 PM   #8 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default

It has come to my attention that not everyone has a custom built superbeast of a PC. So. The width of this massive program is about 1600 pixels wide, and if your resolution is lower than that it'll dangle off the edge or crop short.

I'm working on how to scale it by dragging the lower right corner, but in the meantime, you can drag THIS VERSION (not the last version) off your screen to the left or right and then resize the window by dragging it wider to see the part that's off your screen. You can also hit the maximize button and that might help, but I don't know because my resolution is so insane I can't drop it low enough to have a problem.

First world debugging problems.

I've also modified section 1 to take different weights other than 100 grams so you can do a single egg now, or one mealworm if you really want, or whatever else your weight is. Outputted numbers now format to have 2 decimal places instead of however many there are, so that repeating numbers like 3.333333333333333333etc now crop to 3.33 and 6.666666666 now crops to 6.67.

Section 2 is still huffy, so make sure you add those 0s in empty slots!
Attached Files
File Type: zip mk4 Betterish.zip (19.4 KB, 0 views)
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
Old 07-19-2016, 06:59 PM   #9 (permalink)
Member
 
Draenog's Avatar
 
Join Date: Feb 2012
Location: Europe
Posts: 2,289
Default

Great idea! Will check it out somewhere this week when I have time
FinnickHog likes this.
__________________
Hedgehogs of Asgard Hedgehog care, info & pics! Promoting a more natural way of keeping hedgehogs < bioactive // naturalistic >
Looking for more info? Join Bioactive and Naturalistic Mammal Setups Hedgehog Diet and Nutrition (Natural and Raw Feeding Community)

Draenog is offline   Reply With Quote Quick reply to this message
Old 07-19-2016, 07:56 PM   #10 (permalink)
Member
 
FinnickHog's Avatar
 
Join Date: Dec 2014
Location: Calgary, Alberta
Posts: 1,041
Default

Thanks much!
__________________
~Ashley
FinnickHog is offline   Reply With Quote Quick reply to this message
Reply

Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the Hedgehog Central Hedgehog pet care & owner forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in




Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DMB vs As is Basis DSPO631 Diet and Nutrition 1 12-05-2014 10:25 AM
We need help with a weight loss program. CritterKeeper Health 15 09-17-2013 08:54 PM
Computer Calendar program Breeding & Babies Help 5 05-08-2012 12:50 AM
weight loss program questions newfie_nurse Diet and Nutrition 8 11-18-2011 12:03 PM


All times are GMT -4. The time now is 07:46 PM.



Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1
vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
PetGuide.com
Basset Hound Forum Doberman Forum Golden Retriever Forum Beagle Forum
Boxer Forum Dog Forum Pit Bull Forum Poodle Forum
Bulldog Forum Fish Forum Havanese Forum Maltese Forum
Cat Forum German Shepherd Forum Labradoodle Forum Yorkie Forum Hedgehog Forum
Chihuahua Forum Cichlid Forum Dart Frog Forum Mice Breeder Forum