Download index.html from testme7/mydose: direct link, hf CLI and curl.
- Browser
- Download file 31.7 kB
-
https://huggingface.co/spaces/testme7/mydose/resolve/main/index.html
- Command line
-
hf download hf://spaces/testme7/mydose/index.html
-
curl -L -o index.html https://huggingface.co/spaces/testme7/mydose/resolve/main/index.html
31.7 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>MyDose - Antibiotic Dosage Calculator</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: { | |
| 50: '#f0f9ff', | |
| 100: '#e0f2fe', | |
| 200: '#bae6fd', | |
| 300: '#7dd3fc', | |
| 400: '#38bdf8', | |
| 500: '#0ea5e9', | |
| 600: '#0284c7', | |
| 700: '#0369a1', | |
| 800: '#075985', | |
| 900: '#0c4a6e', | |
| }, | |
| secondary: { | |
| 50: '#f8fafc', | |
| 100: '#f1f5f9', | |
| 200: '#e2e8f0', | |
| 300: '#cbd5e1', | |
| 400: '#94a3b8', | |
| 500: '#64748b', | |
| 600: '#475569', | |
| 700: '#334155', | |
| 800: '#1e293b', | |
| 900: '#0f172a', | |
| } | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| * { | |
| font-family: 'Inter', sans-serif; | |
| } | |
| .custom-ring { | |
| box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); | |
| } | |
| .custom-ring-error { | |
| box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.5); | |
| } | |
| .hidden-banner { | |
| transform: translateY(-100%); | |
| } | |
| .slide-in-banner { | |
| animation: slideInDown 0.3s forwards; | |
| } | |
| @keyframes slideInDown { | |
| from { transform: translateY(-100%); } | |
| to { transform: translateY(0); } | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen bg-gray-50"> | |
| <div id="warningModal" class="fixed top-0 left-0 w-full z-50 custom-ring-error hidden-banner bg-red-600 text-white transition-all duration-300"> | |
| <div class="container mx-auto py-3 px-4 flex justify-between items-center"> | |
| <div class="flex items-center"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /> | |
| </svg> | |
| <span id="warningMessage"></span> | |
| </div> | |
| <button onclick="closeWarning()" class="text-white hover:text-gray-200"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> | |
| <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" /> | |
| </svg> | |
| </button> | |
| </div> | |
| </div> | |
| <div class="max-w-4xl mx-auto px-4 py-8"> | |
| <header class="text-center mb-10"> | |
| <h1 class="text-4xl font-bold text-primary-700 mb-3">MyDose</h1> | |
| <p class="text-secondary-600">Antibiotic Dosage Calculator</p> | |
| <div class="w-24 h-1 bg-primary-500 mx-auto mt-4 rounded"></div> | |
| </header> | |
| <!-- Mode Selection --> | |
| <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8"> | |
| <div class="flex border-b"> | |
| <button id="childModeBtn" class="flex-1 py-4 font-medium text-lg focus:outline-none transition-colors duration-200 border-b-2 border-primary-500 text-primary-600 bg-primary-50">Children Dosage</button> | |
| <button id="adultModeBtn" class="flex-1 py-4 font-medium text-lg focus:outline-none transition-colors duration-200 border-b-2 border-transparent text-secondary-500 hover:text-secondary-700">Adult Dosage</button> | |
| </div> | |
| <!-- Children Dosage Form --> | |
| <div id="childForm" class="p-6"> | |
| <div class="mb-10 text-center"> | |
| <div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-primary-100 mb-4"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-primary-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" /> | |
| </svg> | |
| </div> | |
| <h2 class="text-xl font-semibold text-secondary-800 mb-2">Child Dosage Calculation</h2> | |
| <p class="text-secondary-500">Calculate dosage based on weight and medication concentration</p> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> | |
| <div> | |
| <label class="block text-sm font-medium text-secondary-700 mb-1">Child's Weight (kg)</label> | |
| <div class="relative"> | |
| <input id="childWeight" type="number" step="0.1" class="w-full px-4 py-3 rounded-lg border border-secondary-300 text-secondary-700 focus:outline-none focus:border-primary-500 custom-ring transition" placeholder="Enter weight" min="0"> | |
| <div class="absolute inset-y-0 right-0 flex items-center pr-3 text-secondary-400">kg</div> | |
| </div> | |
| <div id="weightError" class="text-sm text-red-500 mt-1 h-5"></div> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-secondary-700 mb-1">Antibiotic</label> | |
| <select id="antibioticSelect" class="w-full px-4 py-3 rounded-lg border border-secondary-300 text-secondary-700 focus:outline-none focus:border-primary-500 custom-ring transition"> | |
| <option value="">Select an antibiotic</option> | |
| <!-- Populated by JavaScript --> | |
| </select> | |
| </div> | |
| <div> | |
| <div class="flex items-center justify-between"> | |
| <label class="block text-sm font-medium text-secondary-700 mb-1">Available Concentration</label> | |
| <button type="button" onclick="showHelpInfo()" class="text-xs text-primary-600 hover:text-primary-800 flex items-center"> | |
| How to find? | |
| </button> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <select id="concentrationDropdown" class="flex-grow px-4 py-3 rounded-lg border border-secondary-300 text-secondary-700 focus:outline-none focus:border-primary-500 custom-ring transition"> | |
| <option value="">Select concentration</option> | |
| </select> | |
| </div> | |
| <div id="concentrationError" class="text-sm text-red-500 mt-1 h-5"></div> | |
| <div id="customConcentration" class="mt-4 hidden"> | |
| <label class="block text-sm font-medium text-secondary-700 mb-1">Or enter custom concentration</label> | |
| <input id="manualConcentration" type="text" class="w-full px-4 py-3 rounded-lg border border-secondary-300 text-secondary-700 focus:outline-none focus:border-primary-500 custom-ring transition" placeholder="e.g. 250mg/5ml"> | |
| </div> | |
| </div> | |
| <div class="md:col-span-2"> | |
| <div id="childSafetyBox" class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-4 hidden"> | |
| <div class="flex items-start"> | |
| <svg class="h-6 w-6 text-yellow-600 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /> | |
| </svg> | |
| <div> | |
| <p class="text-yellow-800" id="safetyWarning"></p> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="childResults" class="bg-green-50 border-l-4 border-green-500 p-4 hidden"> | |
| <h3 class="font-medium text-green-800 text-lg mb-2">Dosage Recommendation</h3> | |
| <div id="dosageOutput"></div> | |
| </div> | |
| <button id="calculateChild" class="mt-6 w-full bg-primary-600 text-white py-3 px-6 rounded-lg shadow-sm hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 transition duration-200 flex items-center justify-center space-x-2"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z" /> | |
| </svg> | |
| <span>Calculate Dosage</span> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Adult Dosage Form --> | |
| <div id="adultForm" class="p-6 hidden"> | |
| <div class="mb-10 text-center"> | |
| <div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-primary-100 mb-4"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-primary-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" /> | |
| </svg> | |
| </div> | |
| <h2 class="text-xl font-semibold text-secondary-800 mb-2">Adult Dosage Recommendation</h2> | |
| <p class="text-secondary-500">Standard dosage information for adult patients</p> | |
| </div> | |
| <div class="grid grid-cols-1 gap-6"> | |
| <div> | |
| <label class="block text-sm font-medium text-secondary-700 mb-1">Antibiotic</label> | |
| <select id="antibioticSelectAdult" class="w-full px-4 py-3 rounded-lg border border-secondary-300 text-secondary-700 focus:outline-none focus:border-primary-500 custom-ring transition"> | |
| <option value="">Select an antibiotic</option> | |
| <!-- Populated by JavaScript --> | |
| </select> | |
| </div> | |
| <div id="adultResults" class="bg-green-50 border-l-4 border-green-500 p-4 hidden"> | |
| <h3 class="font-medium text-green-800 text-lg mb-2">Dosage Recommendation</h3> | |
| <div id="adultOutput"></div> | |
| </div> | |
| <button id="calculateAdult" class="w-full bg-primary-600 text-white py-3 px-6 rounded-lg shadow-sm hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 transition duration-200 flex items-center justify-center space-x-2"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z" /> | |
| </svg> | |
| <span>Show Dosage Recommendation</span> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-blue-50 border border-blue-200 rounded-lg p-4 mt-8"> | |
| <h3 class="font-semibold text-blue-800 mb-2">Important Information</h3> | |
| <p class="text-blue-700 text-sm"> | |
| MyDose is a reference tool only. This calculator does not replace professional medical advice. | |
| Always consult a healthcare provider before administering any medication. Dosages may vary | |
| based on individual health factors. Verify dosage calculations independently before use. | |
| </p> | |
| </div> | |
| <footer class="mt-12 text-center text-secondary-500 text-sm"> | |
| <div class="flex items-center justify-center space-x-1"> | |
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-4 w-4 text-primary-500"> | |
| <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /> | |
| </svg> | |
| <span>Powered by medical dosing guidelines</span> | |
| </div> | |
| <div class="mt-2">© 2023 MyDose Calculator</div> | |
| </footer> | |
| </div> | |
| <script> | |
| // Antibiotic data | |
| const antibiotics = [ | |
| { | |
| id: 1, | |
| name: "Amoxicillin", | |
| childDosePerKg: 25, | |
| childFrequency: "every 8 hours", | |
| childDuration: "7-10 days", | |
| adultStandardDose: "500mg", | |
| adultFrequency: "every 8 hours", | |
| adultDuration: "7 days", | |
| commonConcentrations: ["125mg/5ml", "250mg/5ml"], | |
| maxDailyDoseChild: 1500, | |
| maxDailyDoseAdult: 4000 | |
| }, | |
| { | |
| id: 2, | |
| name: "Azithromycin", | |
| childDosePerKg: 10, | |
| childFrequency: "once daily", | |
| childDuration: "3-5 days", | |
| adultStandardDose: "500mg", | |
| adultFrequency: "once daily", | |
| adultDuration: "3 days", | |
| commonConcentrations: ["100mg/5ml", "200mg/5ml"], | |
| maxDailyDoseChild: 500, | |
| maxDailyDoseAdult: 2000 | |
| }, | |
| { | |
| id: 3, | |
| name: "Cefalexin", | |
| childDosePerKg: 25, | |
| childFrequency: "every 6 hours", | |
| childDuration: "7-14 days", | |
| adultStandardDose: "500mg", | |
| adultFrequency: "every 6 hours", | |
| adultDuration: "7-10 days", | |
| commonConcentrations: ["125mg/5ml", "250mg/5ml"], | |
| maxDailyDoseChild: 2000, | |
| maxDailyDoseAdult: 4000 | |
| }, | |
| { | |
| id: 4, | |
| name: "Metronidazole", | |
| childDosePerKg: 7.5, | |
| childFrequency: "every 8 hours", | |
| childDuration: "7 days", | |
| adultStandardDose: "400mg", | |
| adultFrequency: "every 8 hours", | |
| adultDuration: "7 days", | |
| commonConcentrations: ["200mg/5ml"], | |
| maxDailyDoseChild: 1200, | |
| maxDailyDoseAdult: 2000 | |
| }, | |
| { | |
| id: 5, | |
| name: "Co-amoxiclav", | |
| childDosePerKg: 15, | |
| childFrequency: "every 8 hours", | |
| childDuration: "7-10 days", | |
| adultStandardDose: "500/125mg", | |
| adultFrequency: "every 8 hours", | |
| adultDuration: "7 days", | |
| commonConcentrations: ["125/31.25mg/5ml", "250/62.5mg/5ml"], | |
| maxDailyDoseChild: 1000, | |
| maxDailyDoseAdult: 2000 | |
| } | |
| ]; | |
| // Elements | |
| const childModeBtn = document.getElementById('childModeBtn'); | |
| const adultModeBtn = document.getElementById('adultModeBtn'); | |
| const childForm = document.getElementById('childForm'); | |
| const adultForm = document.getElementById('adultForm'); | |
| const antibioticSelect = document.getElementById('antibioticSelect'); | |
| const antibioticSelectAdult = document.getElementById('antibioticSelectAdult'); | |
| const concentrationDropdown = document.getElementById('concentrationDropdown'); | |
| const warningModal = document.getElementById('warningModal'); | |
| const warningMessage = document.getElementById('warningMessage'); | |
| // Initialize on page load | |
| document.addEventListener('DOMContentLoaded', function() { | |
| populateAntibiotics(); | |
| setupEventListeners(); | |
| }); | |
| // Functions | |
| function populateAntibiotics() { | |
| antibiotics.forEach(antibiotic => { | |
| // Child selection | |
| const option = document.createElement('option'); | |
| option.value = antibiotic.id; | |
| option.textContent = antibiotic.name; | |
| antibioticSelect.appendChild(option); | |
| // Adult selection | |
| const optionAdult = document.createElement('option'); | |
| optionAdult.value = antibiotic.id; | |
| optionAdult.textContent = antibiotic.name; | |
| antibioticSelectAdult.appendChild(optionAdult); | |
| }); | |
| } | |
| function setupEventListeners() { | |
| // Tabs | |
| childModeBtn.addEventListener('click', () => switchMode('child')); | |
| adultModeBtn.addEventListener('click', () => switchMode('adult')); | |
| // Antibiotic selection for children | |
| antibioticSelect.addEventListener('change', updateConcentrationOptions); | |
| // Concentration Dropdown change | |
| concentrationDropdown.addEventListener('change', function() { | |
| const customContainer = document.getElementById('customConcentration'); | |
| if (this.value === 'other') { | |
| customContainer.classList.remove('hidden'); | |
| } else { | |
| customContainer.classList.add('hidden'); | |
| } | |
| }); | |
| // Calculate buttons | |
| document.getElementById('calculateChild').addEventListener('click', calculateChildDosage); | |
| document.getElementById('calculateAdult').addEventListener('click', showAdultDosage); | |
| } | |
| function switchMode(mode) { | |
| if (mode === 'child') { | |
| childModeBtn.classList.add('border-primary-500', 'text-primary-600', 'bg-primary-50'); | |
| childModeBtn.classList.remove('border-transparent', 'text-secondary-500', 'hover:text-secondary-700'); | |
| adultModeBtn.classList.remove('border-primary-500', 'text-primary-600', 'bg-primary-50'); | |
| adultModeBtn.classList.add('border-transparent', 'text-secondary-500', 'hover:text-secondary-700'); | |
| childForm.classList.remove('hidden'); | |
| adultForm.classList.add('hidden'); | |
| } else { | |
| adultModeBtn.classList.add('border-primary-500', 'text-primary-600', 'bg-primary-50'); | |
| adultModeBtn.classList.remove('border-transparent', 'text-secondary-500', 'hover:text-secondary-700'); | |
| childModeBtn.classList.remove('border-primary-500', 'text-primary-600', 'bg-primary-50'); | |
| childModeBtn.classList.add('border-transparent', 'text-secondary-500', 'hover:text-secondary-700'); | |
| adultForm.classList.remove('hidden'); | |
| childForm.classList.add('hidden'); | |
| } | |
| // Reset results | |
| resetResults(); | |
| } | |
| function updateConcentrationOptions() { | |
| // Clear existing options except first | |
| concentrationDropdown.innerHTML = '<option value="">Select concentration</option><option value="other">Other...</option>'; | |
| const antibioticId = antibioticSelect.value; | |
| if (!antibioticId) return; | |
| const antibiotic = antibiotics.find(a => a.id.toString() === antibioticId); | |
| // Add common concentrations | |
| antibiotic.commonConcentrations.forEach(conc => { | |
| const option = document.createElement('option'); | |
| option.value = conc; | |
| option.textContent = conc; | |
| concentrationDropdown.appendChild(option); | |
| }); | |
| } | |
| function calculateChildDosage() { | |
| // Reset validation | |
| resetValidation(); | |
| // Get values | |
| const weight = parseFloat(document.getElementById('childWeight').value); | |
| const antibioticId = antibioticSelect.value; | |
| const concDropdownValue = concentrationDropdown.value; | |
| let concentration = ''; | |
| if (concDropdownValue === 'other') { | |
| concentration = document.getElementById('manualConcentration').value.trim(); | |
| } else { | |
| concentration = concDropdownValue; | |
| } | |
| // Validation | |
| let valid = true; | |
| if (!weight || weight <= 0) { | |
| document.getElementById('weightError').textContent = "Please enter a valid weight"; | |
| valid = false; | |
| } | |
| if (!antibioticId) { | |
| valid = false; | |
| showWarning('Please select an antibiotic'); | |
| } | |
| if (!concentration) { | |
| document.getElementById('concentrationError').textContent = "Please select or enter concentration"; | |
| valid = false; | |
| } | |
| if (!valid) return; | |
| // Find antibiotic | |
| const antibiotic = antibiotics.find(a => a.id.toString() === antibioticId); | |
| // Calculate dosage | |
| const totalDailyDoseMg = weight * antibiotic.childDosePerKg; | |
| const dosesPerDay = antibiotic.childFrequency.includes('8 hours') ? 3 : | |
| antibiotic.childFrequency.includes('6 hours') ? 4 : | |
| antibiotic.childFrequency.includes('12 hours') ? 2 : | |
| antibiotic.childFrequency.includes('once') ? 1 : 3; | |
| const perDoseMg = totalDailyDoseMg / dosesPerDay; | |
| // Parse concentration | |
| const matches = concentration.match(/\d+/g); | |
| if (!matches || matches.length < 2) { | |
| showWarning('Invalid concentration format. Use pattern like "250mg/5ml"'); | |
| return; | |
| } | |
| const mgAmount = parseInt(matches[0]); | |
| const mlVolume = parseInt(matches[1]); | |
| const mgPerMl = mgAmount / mlVolume; | |
| const perDoseMl = perDoseMg * mlVolume / mgAmount; | |
| // Safety check | |
| const childSafetyBox = document.getElementById('childSafetyBox'); | |
| const safetyWarning = document.getElementById('safetyWarning'); | |
| if (totalDailyDoseMg > antibiotic.maxDailyDoseChild) { | |
| safetyWarning.textContent = `Daily dose of ${totalDailyDoseMg.toFixed(1)}mg exceeds maximum recommended ${antibiotic.maxDailyDoseChild}mg. Consult doctor.`; | |
| childSafetyBox.classList.remove('hidden'); | |
| } else { | |
| childSafetyBox.classList.add('hidden'); | |
| } | |
| // Display results | |
| const resultsDiv = document.getElementById('childResults'); | |
| const dosageOutput = document.getElementById('dosageOutput'); | |
| dosageOutput.innerHTML = ` | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-2"> | |
| <div class="bg-blue-50 p-4 rounded text-center"> | |
| <div class="text-xl font-bold text-blue-700">${perDoseMl.toFixed(1)} ml</div> | |
| <div class="text-xs text-blue-600">Per dose</div> | |
| </div> | |
| <div class="bg-blue-50 p-4 rounded text-center"> | |
| <div class="text-xl font-bold text-blue-700">${perDoseMg.toFixed(0)} mg</div> | |
| <div class="text-xs text-blue-600">Per dose</div> | |
| </div> | |
| <div class="bg-blue-50 p-4 rounded text-center"> | |
| <div class="text-xl font-bold text-blue-700">${totalDailyDoseMg.toFixed(0)} mg</div> | |
| <div class="text-xs text-blue-600">Daily total</div> | |
| </div> | |
| </div> | |
| <div class="mt-4"> | |
| <div class="flex items-center"> | |
| <svg class="h-5 w-5 text-green-500 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" /> | |
| </svg> | |
| <span class="font-medium text-secondary-700">Frequency:</span> | |
| <span class="ml-2 text-secondary-700">${antibiotic.childFrequency}</span> | |
| </div> | |
| <div class="flex items-center mt-2"> | |
| <svg class="h-5 w-5 text-green-500 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" /> | |
| </svg> | |
| <span class="font-medium text-secondary-700">Duration:</span> | |
| <span class="ml-2 text-secondary-700">${antibiotic.childDuration}</span> | |
| </div> | |
| </div> | |
| `; | |
| resultsDiv.classList.remove('hidden'); | |
| } | |
| function showAdultDosage() { | |
| const antibioticId = antibioticSelectAdult.value; | |
| if (!antibioticId) { | |
| showWarning('Please select an antibiotic'); | |
| return; | |
| } | |
| // Find antibiotic | |
| const antibiotic = antibiotics.find(a => a.id.toString() === antibioticId); | |
| // Display results | |
| document.getElementById('adultResults').classList.remove('hidden'); | |
| document.getElementById('adultOutput').innerHTML = ` | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-2"> | |
| <div class="bg-blue-50 p-4 rounded text-center"> | |
| <div class="text-xl font-bold text-blue-700">${antibiotic.adultStandardDose}</div> | |
| <div class="text-xs text-blue-600">Per dose</div> | |
| </div> | |
| <div class="bg-blue-50 p-4 rounded text-center"> | |
| <div class="text-xl font-bold text-blue-700">${antibiotic.adultFrequency.replace('every ', '')}</div> | |
| <div class="text-xs text-blue-600">Interval</div> | |
| </div> | |
| <div class="bg-blue-50 p-4 rounded text-center"> | |
| <div class="text-xl font-bold text-blue-700">${antibiotic.adultDuration}</div> | |
| <div class="text-xs text-blue-600">Duration</div> | |
| </div> | |
| </div> | |
| <div class="mt-4"> | |
| <div class="flex items-center"> | |
| <svg class="h-5 w-5 text-green-500 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" /> | |
| </svg> | |
| <span class="font-medium text-secondary-700">Full instruction:</span> | |
| </div> | |
| <p class="mt-2 bg-white p-3 rounded-lg border border-secondary-200"> | |
| <span class="font-medium">${antibiotic.name}:</span> | |
| ${antibiotic.adultStandardDose} ${antibiotic.adultFrequency} for ${antibiotic.adultDuration} | |
| </p> | |
| </div> | |
| `; | |
| } | |
| function showWarning(message) { | |
| warningMessage.textContent = message; | |
| warningModal.classList.remove('hidden-banner'); | |
| warningModal.classList.add('slide-in-banner'); | |
| // Auto-hide after 5 seconds | |
| setTimeout(() => { | |
| closeWarning(); | |
| }, 5000); | |
| } | |
| function closeWarning() { | |
| warningModal.classList.remove('slide-in-banner'); | |
| warningModal.classList.add('hidden-banner'); | |
| } | |
| function resetValidation() { | |
| document.getElementById('weightError').textContent = ''; | |
| document.getElementById('concentrationError').textContent = ''; | |
| } | |
| function resetResults() { | |
| document.getElementById('childResults').classList.add('hidden'); | |
| document.getElementById('adultResults').classList.add('hidden'); | |
| document.getElementById('childSafetyBox').classList.add('hidden'); | |
| } | |
| function showHelpInfo() { | |
| showWarning('Concentration information is printed on medication packaging. Look for labeling such as "500mg per 5ml" or similar notation.'); | |
| } | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=testme7/mydose" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |