djledda.de main
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

184 行
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: 'Natural Dessicated Thyroid ("Armour")',
  18. mpg: 60,
  19. unit: "mg",
  20. },
  21. {
  22. name: 'Liothyronine (T3 - "Cytomel/Cynomel")',
  23. mpg: MPG_T3_SYN,
  24. unit: "mcg",
  25. },
  26. {
  27. name: "Levothyroxine (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}{_.unit && (', ' + _.unit)}
  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 = val / _.mpg;
  76. }
  77. }}
  78. min="0"
  79. step={_.step ?? 1}
  80. type="number"
  81. />
  82. </div>
  83. </td>
  84. </tr>
  85. ))}
  86. <tr>
  87. <td colspan="2">
  88. <strong>Compounded (T3 and T4 - "Cynoplus")</strong>
  89. </td>
  90. </tr>
  91. <tr class="ratios">
  92. <td>
  93. Desired Ratio (T3:T4)
  94. </td>
  95. <td class="right ratio">
  96. <div>
  97. <input
  98. value={t3Ratio.value}
  99. onInput={(e) => {
  100. t3Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  101. }}
  102. min="0"
  103. step="1"
  104. type="number"
  105. />
  106. </div>
  107. <span class="separator"/>
  108. <div>
  109. <input
  110. value={t4Ratio.value}
  111. onInput={(e) => {
  112. t4Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  113. }}
  114. min="0"
  115. step="1"
  116. type="number"
  117. />
  118. </div>
  119. </td>
  120. </tr>
  121. <tr class="synthetic">
  122. <td>
  123. T3 mcg : T4 mcg
  124. </td>
  125. <td class="right ratio">
  126. <div>
  127. <input
  128. value={compounded.value.t3Syn}
  129. onInput={(e) => {
  130. t4Ratio.value = compounded.value.t4Syn;
  131. t3Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  132. numGrains.value = t3Ratio.value / MPG_T3_SYN +
  133. t4Ratio.value / MPG_T4_SYN;
  134. }}
  135. min="0"
  136. step="1"
  137. type="number"
  138. />
  139. </div>
  140. <span class="separator"/>
  141. <div>
  142. <input
  143. value={compounded.value.t4Syn}
  144. onInput={(e) => {
  145. t3Ratio.value = compounded.value.t3Syn;
  146. t4Ratio.value = (e.currentTarget as HTMLInputElement).valueAsNumber;
  147. numGrains.value = t3Ratio.value / MPG_T3_SYN +
  148. t4Ratio.value / MPG_T4_SYN;
  149. }}
  150. min="0"
  151. step="1"
  152. type="number"
  153. />
  154. </div>
  155. </td>
  156. </tr>
  157. </tbody>
  158. </table>
  159. </div>
  160. <div class="text-slab">
  161. <strong>Changelog:</strong>
  162. <p>
  163. <ul>
  164. <li>
  165. 1st November 2024: Migrated to new web framework and fixed some buggy input/ugly styling.
  166. </li>
  167. <li>
  168. 13th March 2024: Removed the synthetic/pure distinction as it was confusing and
  169. unnecessary bloat.
  170. </li>
  171. </ul>
  172. </p>
  173. </div>
  174. </>
  175. );
  176. },
  177. });