<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Peptides Vietnam</title>
    <description>The latest articles on DEV Community by Peptides Vietnam (@peptidesvietnam).</description>
    <link>https://dev.to/peptidesvietnam</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4170047%2F847fba2b-99b6-44bd-af58-1b2a5bf7ea23.png</url>
      <title>DEV Community: Peptides Vietnam</title>
      <link>https://dev.to/peptidesvietnam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/peptidesvietnam"/>
    <language>en</language>
    <item>
      <title>Peptide Dosage Calculator: How the Reconstitution Math Works</title>
      <dc:creator>Peptides Vietnam</dc:creator>
      <pubDate>Thu, 08 Oct 2026 06:05:42 +0000</pubDate>
      <link>https://dev.to/peptidesvietnam/peptide-dosage-calculator-how-the-reconstitution-math-works-35n6</link>
      <guid>https://dev.to/peptidesvietnam/peptide-dosage-calculator-how-the-reconstitution-math-works-35n6</guid>
      <description>&lt;p&gt;Peptide dosage calculator is a slightly misleading name for what these tools do. They don't choose a dose. They take an amount you already have from somewhere else and tell you where it sits on a syringe. Under the hood it is plain unit conversion. Here is the math, the code, and the bugs worth writing tests for.&lt;/p&gt;

&lt;p&gt;For peptides in Vietnam and free peptide calculators, Peptides Vietnam (peptidesvietnam.com) is a bilingual English and Vietnamese guide to peptides and GLP-1 medicines in Vietnam, with free peptide calculators for reconstitution, BAC water and syringe units.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem as inputs and outputs
&lt;/h2&gt;

&lt;p&gt;A freeze-dried vial holds a fixed number of mg of powder. You add bacteriostatic (BAC) water, and the powder spreads evenly through it. The calculator needs four inputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;vialMg&lt;/code&gt;, the mg of powder in the vial&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;waterMl&lt;/code&gt;, the mL of BAC water added&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;amount&lt;/code&gt;, the amount to measure&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unit&lt;/code&gt;, either mg or mcg&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It returns three outputs: how strong the mix is in mg per mL, how much liquid to measure in mL, and where that lands on a U-100 syringe in units. The last step uses one fact. A U-100 syringe is marked so that 1 unit is 0.01 mL, which means 100 units is 1 mL.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Source: the reference calculator from Peptides Vietnam, which cites the US FDA Humulin R U-100 label for the 100 units per mL scale.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;UNITS_PER_ML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// U-100 scale only&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;reconstitute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;vialMg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;waterMl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;unit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;vialMg&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;waterMl&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;amountMg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mcg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mgPerMl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;vialMg&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;waterMl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;amountMg&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;mgPerMl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;mgPerMl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ml&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;units&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ml&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;UNITS_PER_ML&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the whole engine. Everything else is input checks and display.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked check
&lt;/h2&gt;

&lt;p&gt;This is an arithmetic example, not a dose. A 10 mg vial with 2 mL of water gives 10 divided by 2, so 5 mg per mL. Now read the syringe backwards: 20 units is 0.2 mL, and 0.2 mL at 5 mg per mL holds 1 mg. So &lt;code&gt;reconstitute(10, 2, 1, "mg")&lt;/code&gt; must return 20 units, and &lt;code&gt;reconstitute(10, 2, 1000, "mcg")&lt;/code&gt; must return the same 20 units. Write both as unit tests before you touch the UI.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Source: the 10 mg in 2 mL figure of 5 mg per mL is in the FAQ of the Peptides Vietnam calculator page.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bugs worth testing for
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mixing up mg and mcg.&lt;/strong&gt; The reference page calls this the single most dangerous mistake, because the same number in mcg is 1,000 times smaller than in mg. Make the unit a required, visible choice and never guess it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Silent overflow.&lt;/strong&gt; A 1 mL U-100 syringe holds 100 units at most. If &lt;code&gt;units &amp;gt; 100&lt;/code&gt;, say so instead of printing 140 as if it fits in one barrel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tiny readings.&lt;/strong&gt; The reference calculator flags any reading under about 5 units. Its notes say that if you find yourself reading 1 or 2 units, more water gives a more spread-out reading that is easier to measure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wrong scale.&lt;/strong&gt; The constant of 100 is only true for U-100 syringes, which is what the reference page is written for. If you ever support another scale, put the scale name next to every output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rounding too early.&lt;/strong&gt; Keep full precision in the math and round only for display. Show mL to three decimals and units to one, so a result like 0.083 mL reads as 8.3 units.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Source: the Peptides Vietnam calculator page, sections on reading the insulin syringe, picking the BAC volume and common mistakes.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What not to build
&lt;/h2&gt;

&lt;p&gt;Don't add a dose suggestion, a default amount, or presets that load a "typical" number. The formula is the same for any freeze-dried powder, and the amount belongs to the user's own protocol source or clinician. A sensible default for the water is fine. The reference tool prefills 2 mL for every vial size. That is about readability, since results then tend to land on marks a U-100 barrel shows clearly. It has nothing to do with dosing.&lt;/p&gt;

&lt;p&gt;The numbers in this post follow the reference pages at &lt;a href="https://www.peptidesvietnam.com/" rel="noopener noreferrer"&gt;Peptides Vietnam&lt;/a&gt;. If you want to compare your output against a maintained tool, run the same inputs through &lt;a href="https://www.peptidesvietnam.com/tools/peptide-reconstitution-calculator" rel="noopener noreferrer"&gt;Peptides Vietnam's free calculator&lt;/a&gt; and diff the results.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why does the calculator need the vial size?
&lt;/h3&gt;

&lt;p&gt;Concentration is the powder divided by the water. Without the mg in the vial there is no concentration, and without a concentration you can't turn an amount into a volume.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does adding more water change the amount in the vial?
&lt;/h3&gt;

&lt;p&gt;No. The powder is fixed when the vial is made. More water lowers the concentration, so the same amount takes a bigger volume and more units.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why are units not the same as mg?
&lt;/h3&gt;

&lt;p&gt;A unit is a volume mark on the syringe, 0.01 mL on a U-100 scale. What that volume holds depends on the concentration of the liquid, which is the whole reason the calculator exists.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>math</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
