djledda.de main
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

185 Zeilen
8.5 KiB

  1. import { computed, defineComponent, ref } from "vue";
  2. export default defineComponent({
  3. name: "ge-calculator",
  4. setup() {
  5. const t3Ratio = ref(1);
  6. const t4Ratio = ref(4);
  7. const MPG_T3_SYN = 25;
  8. const MPG_T4_SYN = 100;
  9. const inputDefs = [
  10. {
  11. name: "Grains",
  12. mpg: 1,
  13. unit: "",
  14. step: 0.1,
  15. },
  16. {
  17. name: "Armour, Natural Dessicated Thyroid",
  18. mpg: 60,
  19. unit: "mg",
  20. },
  21. {
  22. name: 'Liothyronine (Triiodothyronine, "Cytomel/Cynomel", T3)',
  23. mpg: MPG_T3_SYN,
  24. unit: "mcg",
  25. },
  26. {
  27. name: "Levothyroxine (Thyroxine, T4)",
  28. mpg: MPG_T4_SYN,
  29. unit: "mcg",
  30. },
  31. ];
  32. const numGrains = ref(2);
  33. const compounded = computed(() => {
  34. const total = t3Ratio.value + t4Ratio.value;
  35. const t3Proportion = t3Ratio.value / total;
  36. const t4Proportion = t4Ratio.value / total;
  37. const grainsSyn = t3Proportion / MPG_T3_SYN + t4Proportion / MPG_T4_SYN;
  38. const multiplierSyn = numGrains.value / grainsSyn;
  39. return {
  40. t3Syn: t3Proportion * multiplierSyn,
  41. t4Syn: t4Proportion * multiplierSyn,
  42. };
  43. });
  44. return () => (
  45. <>
  46. <header>
  47. <h1>Thyroid Calculator</h1>
  48. </header>
  49. <div class="text-slab">
  50. <p>
  51. Use this calculator to convert between different forms and units of thyroid hormone. Common
  52. synthetic, pure and natural dessicated forms are listed. The last section of the table provides
  53. input fields for a specified ratio of T3 to T4, and will give the dosages required for both the
  54. synthetic and pure forms. All dosages given are based on the "Grains" field at the beginning of
  55. the table, but editing any field will automatically update the rest to keep them in sync.
  56. </p>
  57. </div>
  58. <div class="text-slab ge-calculator">
  59. <table>
  60. <tbody>
  61. {inputDefs.map((_) => (
  62. <tr key={_.name}>
  63. <td>
  64. {_.name}
  65. </td>
  66. <td class="right">
  67. <div style="display: inline-block;">
  68. <input
  69. value={_.name === "Grains" ? numGrains.value : _.mpg * numGrains.value}
  70. onInput={(e) => {
  71. const val = (e.target as HTMLInputElement).valueAsNumber;
  72. if (_.name === "Grains") {
  73. numGrains.value = val;
  74. } else {
  75. numGrains.value = _.mpg / val;
  76. }
  77. }}
  78. min="0"
  79. step={_.step ?? 1}
  80. type="number"
  81. />
  82. </div>
  83. <span class="breathe">{_.unit}</span>
  84. </td>
  85. </tr>
  86. ))}
  87. <tr>
  88. <td colspan="2">
  89. <strong>Compounded (T3 and T4, "Cynoplus")</strong>
  90. </td>
  91. </tr>
  92. <tr class="ratios">
  93. <td>
  94. Desired Ratio (T3:T4)
  95. </td>
  96. <td class="right">
  97. <div>
  98. <input
  99. value={t3Ratio.value}
  100. onInput={(e) => {
  101. t3Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  102. }}
  103. min="0"
  104. step="1"
  105. type="number"
  106. />
  107. </div>{" "}
  108. :{" "}
  109. <div>
  110. <input
  111. value={t4Ratio.value}
  112. onInput={(e) => {
  113. t4Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  114. }}
  115. min="0"
  116. step="1"
  117. type="number"
  118. />
  119. </div>
  120. </td>
  121. </tr>
  122. <tr class="synthetic">
  123. <td>
  124. Synthetic T3/T4 Combo
  125. </td>
  126. <td class="right">
  127. <div>
  128. <input
  129. value={compounded.value.t3Syn}
  130. onInput={(e) => {
  131. t4Ratio.value = compounded.value.t4Syn;
  132. t3Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  133. numGrains.value = t3Ratio.value / MPG_T3_SYN +
  134. t4Ratio.value / MPG_T4_SYN;
  135. }}
  136. min="0"
  137. step="1"
  138. type="number"
  139. />
  140. </div>{" "}
  141. :{" "}
  142. <div>
  143. <input
  144. value={compounded.value.t4Syn}
  145. onInput={(e) => {
  146. t3Ratio.value = compounded.value.t3Syn;
  147. t4Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  148. numGrains.value = t3Ratio.value / MPG_T3_SYN +
  149. t4Ratio.value / MPG_T4_SYN;
  150. }}
  151. min="0"
  152. step="1"
  153. type="number"
  154. />
  155. </div>
  156. </td>
  157. </tr>
  158. </tbody>
  159. </table>
  160. </div>
  161. <div class="text-slab">
  162. <strong>Changelog:</strong>
  163. <p>
  164. <ul>
  165. <li>
  166. November 2024: Migrated to new web framework and fixed some buggy input.
  167. </li>
  168. <li>
  169. 13th March 2024: Removed the synthetic/pure distinction as it was confusing and
  170. unnecessary bloat.
  171. </li>
  172. </ul>
  173. </p>
  174. </div>
  175. </>
  176. );
  177. },
  178. });