General Category > BeerXML Standard Document
Units in BeerXML 2.0
(1/1)
GregR:
I haven't been following the progress of BeerXML 2.0 for a while, but just regained an interest as I'm currently working on related things...so forgive me if this seems like a belated comment...
Looking through the BeerXML v2.01 document, I notice that units seem to be dealt with a bit inconsistently.... For example, looking at how styles are stored:
--- Code: --- <final_gravity>
<minimum density="sg">1.013</minimum>
<maximum density="sg">1.017</maximum>
</final_gravity>
<international_bitterness_units>
<minimum>35.0</minimum>
<maximum>45.0</maximum>
</international_bitterness_units>
<color>
<minimum scale="SRM">3.0</minimum>
<maximum scale="SRM">5.0</maximum>
</color>
--- End code ---
It seems that it would make more sense to just designate a "units" attribute for each tag, instead of using "density" and "scale". And then for bitterness, the units value is implicit in the element and not an attribute. Wouldn't it be more consistent to use:
--- Code: --- <final_gravity>
<minimum unit="sg">1.013</minimum>
<maximum unit="sg">1.017</maximum>
</final_gravity>
<bitterness>
<minimum unit="ibu">35.0</minimum>
<maximum unit="ibu">45.0</maximum>
</bitterness>
<color>
<minimum unit="srm">3.0</minimum>
<maximum unit="srm">5.0</maximum>
</color>
--- End code ---
This way, units are dealt with in a very consistent way, bitterness can now be stored as ibu, or ebu, etc (yes, I know ibu == ebu, but flexibility is always good) and srm is not needlessly capitalized.
Is there an advantage to not using the same attribute name (i.e. "unit") across several elements? I'm not an XML whiz, so...
AntonW:
Hi Greg,
That's a great catch for the styles IBU unit type! Currently within a recipe the bitterness is specified as something like:
<ibu_estimate method="Tinseth">blah</ibu_estimate>
As bitterness is generally estimated for recipes instead of measured by laboratory method in the finished beer quantitatively. We could definitely mark up the bitterness data to be something like:
<bitterness>
<minimum unit="ibu">35.0</minimum>
<maximum unit="ibu">35.0</maximum>
</bitterness>
where unit can be either 'ibu' or 'ebu'. The reason why some general term was not used across several elements stems from minimizing the available choices for the attribute of a given element. In the example of fg you've provided:
<final_gravity>
<minimum density="sg">1.013</minimum>
<maximum density="sg">1.017</maximum>
</final_gravity>
Every valid BeerXML 2.0x file exchanged can only have 'sg' or 'plato' density units associated with them. If we created a single term containing all units, then you could potentially set fg <minimum unit="SRM">3.14159</minimum> and have to check for those errors in a later step programmatically (instead of catching it earlier at validation with XSDs).
Also, SRM can be easily changed to lowercase if that is the convention.
-Anton
AntonW:
Hi D.Neelm,
I believe the documentation states that the International System of Units is the preferred set of units for BeerXML, but this should be more of a configurable setting in your specific brewing program. The best approach is to record the value to BeerXML in the units of the device performing the measurement (as this will allow for the greatest amount of accuracy in further computations).
Within the brewing program, the user should be able to change configuration settings so the units are displayed in ISU-based units (even if they were recorded in US units) or vice versa. And within the program, any type of units that you like may be used to perform the internal calculations required. The only requirement is to convert those internal units to units supported by BeerXML when saving BeerXML output files (if they are not already supported).
Does that sound reasonable?
-Anton
Navigation
[0] Message Index
Go to full version