Record structure and inventory
See original GitHub issueI must say I don’t like the way BeerXML 2.0.1 defines the ingredient records by including the inventory in the record and the amount inside the inventory. Beerjson is currently following this format. (BeerXML 1.0 had “amount” separately, and “inventory” was an extension).
In the hop record, for instance, the inventory is further divided into the fields “leaf”, “pellet”, and “plug”, each of them with their own dictionary (object in JS) with the keys (names) “units” and “mass”. My first complaint is that, a given hop variety, even from the same season and vendor, will have different alpha-acid contents depending on whether being a leaf, a pellet, or a plug. So it makes no sense to allow for more than one type in the same record. Besides, there are many other forms of hops, nowadays.
Thus, even with just one type/form of hop it would make more sense to have
"use" : "aroma",
"type": "leaf",
"amount" : {
"units": "oz",
"mass": 2.0
}
}
instead of
"type" : "aroma",
"inventory": {
"leaf": {
"units": "oz",
"mass": 2.0
}
}
If you prefer to keep the key/name “type” for “aroma”, etc; we can use {“form” : "leaf}, for instance. That is not the main point, although I prefer “use” for “aroma”/“flavor”/etc. And “type” is usually reserved for something more significant than that, which are not well defined characteristics of a hop addition. So, on a second thought, maybe { “use” : “aroma”, “form” : “pellet”} might be best.
From a practical point of view, it makes it easier to write a software if all “amounts” have the same key “amount”, instead of varying according to the type.
My other complain, again from the point of view of developing a software, at least this is the way I see it, is that we would have an “Inventory” object and a “Recipe” object, containing all hops, fermentables, etc., and each record will say the amount in the inventory or in the recipe. Not the other way around.
So, my suggestion is to drop the field “inventory” from all the records, create an “amount” field for the amount, creat a “form” field when appropriate, and change “type” to “use” regarding “aroma”, “flavor”, etc… And then “Inventory” could be a Record Set.
I wish I could implement this, if you agree, and submit a PR, but JS is not my thing at all. I hope you don’t mind me making suggestions I find relevant.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (8 by maintainers)
Top GitHub Comments
I think not including inventory is a good idea. It doesn’t really make much sense if we are (say) copying recipes about. What’s in my inventory certainly isn’t in yours. And I think that should apply to almost any thing.
One small suggestion. Consider having just one “amount” object, and then having a “type” of “mass”, “volume” or “unit” (for use with whirfloc tablets or a vial of clarityfirm). If you decide against it, then consider having a “amount_as_mass” and “amount_as_volume”. I really prefer explicit declarations over inferences.
Inventory schema and the possibility to validate it is good for software where you store lists of your ingredients, but there is no place for it in data interchange format. Will close this issue.