I want to build an app for ease while prescribing medicines & need your help so badly

Chat bots sound like they know AI2, but they don't.

You need to learn lists, tables, and how to do lookups for the front end of the project and the middle.

But that would be wasted effort if you could not establish the necessary step of getting text from your app to a printer.

How far have you gotten to prove that you can get text from your phone to a printer?

I'm actually not worried about that, because i just want to take a screenshot once the app generate a prescription, and the screenshot i can directly sent for print in printer, so i don't have that kind of issue, actually i build header and footer, and tested the app, took screenshot and printed, it worked fine for me.

1 Like

Prescription Later Sample.pdf (448.6 KB)


see the pdf, this is how my end product of prescription should be, i can easily take screenshot and print it. And the screenshot i shared here is from app which i'm building, i've only placed the header and footer, built the apk file installed in my tablet and took a screenshot within the app i build, just to show you, i'll take screenshot like this at the end, once prescription is generated. See the screenshot, i've successfully managed to hide notification bar at top & home button and back button at the bottom. Can you please go through this pdf and screenshot, to understand my point please.

Prescription.aia (118.8 KB)
I've added "+" button & "Generate" button, too. I've shared .aia file here to check. Is it good?

Now we have confidence to proceed with the code, having passed the feasibility test stage.

I open this thread up for the users who have not just fallen out of bed, to give you a head start.

P.S. see
https://community.appinventor.mi...t.edu/t/button-custom-icon-radius-border-color-gradient-html-text-text-alignment/128126/51?u=abg for all the HTML code you need for this app.

Okay, so I've seen your sample outputs, and they are very helpful.
Your Project has no blocks yet.

Further questions:

Your sample prescription had 4 items.

How big is your pharmacy (collection of possible medicines and dosages and instruction combinations?)

For particular medicines, what kind of variations in how and when to take that medicine can exist?

Are there variations in dosage and timing for age and weight of patient?

Will the app have access to patient name, or would that be left for after printing, on the paper?

Note that AI2 has a Clock component, so it can add the date by itself to the form, with its boiler plate.

Are you considering keeping track of prescriptions issued, by patient name and date, for legal or re-prescribing purposes?

Do you have access to Google Sheets, to facilitate keeping your pharmacy options current and backed up? If not Google Sheets, how about any common desktop spreadsheet program that can export a CSV (Comma Separated Values) file?
(This is insurance against loss of tablet and its data.)

1 Like

Hello, I've made it a complete app on replit yesterday, and it's working fine, shared the link, please check, i've included everything what i want. The only problem is, it's web based, not on android, and it'll be taken down in 7 days. So this is exactly i want to build on android. (Prescription - Replit)

1 Like

I grabbed your medicines from replit:

[
  {
    "id": 17,
    "name": "Augmentin Duo",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 18,
    "name": "Azithral 250",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 19,
    "name": "Brufen 600",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 20,
    "name": "DAN-P / Dynapar",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 21,
    "name": "Diclo-50",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 22,
    "name": "Ketorol DT",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 23,
    "name": "Metrogyl 200",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 24,
    "name": "Metrogyl 400",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 25,
    "name": "Pantoprazole 40 mg + Domperidone",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 26,
    "name": "Rantac Dom",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 27,
    "name": "Zerodol MR",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 28,
    "name": "Zerodol PT",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 29,
    "name": "Zerodol SP",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 30,
    "name": "Zerodol-TH-MAX-4",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 31,
    "name": "Zerodol-TH-OD-8",
    "category": "swallowable",
    "sub_category": "tablet",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 32,
    "name": "Acutret 20 / Isotroin 20",
    "category": "swallowable",
    "sub_category": "capsule",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 33,
    "name": "Becosules",
    "category": "swallowable",
    "sub_category": "capsule",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 34,
    "name": "Evion 400",
    "category": "swallowable",
    "sub_category": "capsule",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 35,
    "name": "Mox 250",
    "category": "swallowable",
    "sub_category": "capsule",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 36,
    "name": "Mox 500",
    "category": "swallowable",
    "sub_category": "capsule",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 37,
    "name": "Pregabalin 50",
    "category": "swallowable",
    "sub_category": "capsule",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 38,
    "name": "SM Fibro",
    "category": "swallowable",
    "sub_category": "capsule",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 39,
    "name": "Ibugesic Plus",
    "category": "swallowable",
    "sub_category": "syrup",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 40,
    "name": "MoxClav 228.8 mg",
    "category": "swallowable",
    "sub_category": "syrup",
    "gujarati_instruction": NaN,
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 41,
    "name": "Caziq / Kenacort 0.1%",
    "category": "non-swallowable",
    "sub_category": "gel",
    "gujarati_instruction": "આંગળી પર લઇ જ્યાં ફોલ્લા પડ્યા છે ત્યાં લગાવવું, ૩૦ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું એવી રીતે દર ૨ કલાકે લગાવવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 42,
    "name": "Dologel CT",
    "category": "non-swallowable",
    "sub_category": "gel",
    "gujarati_instruction": "આંગળી પર લઇ જ્યાં ફોલ્લા પડ્યા છે ત્યાં લગાવવું, ૫ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું. જ્યારે જમવા બેસો તેની ૫ મિનીટ પહેલા અથવા જયારે જયારે દુખતું હોય ત્યારે લગાવવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 43,
    "name": "Metrogyl DG",
    "category": "non-swallowable",
    "sub_category": "gel",
    "gujarati_instruction": "આંગળી પર લઇ જ્યાં સોજો આવેલો છે ત્યાં ચારે બાજુ પેઢા ઉપર લગાવવું, ઘસવું કે મસાજ કરવું નહિ, ૨૦ મિનીટ સુધી રાખી કોગળા કરી નાખવા, આવું દિવસમાં ૫ વખત કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 44,
    "name": "Metrohex Plus",
    "category": "non-swallowable",
    "sub_category": "gel",
    "gujarati_instruction": "આંગળી પર લઇ જ્યાં સોજો આવેલો છે ત્યાં ચારે બાજુ પેઢા ઉપર લગાવવું, ઘસવું કે મસાજ કરવું નહિ, ૨૦ મિનીટ સુધી રાખી કોગળા કરી નાખવા, આવું દિવસમાં ૫ વખત કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 45,
    "name": "Stolin Gum Paint",
    "category": "non-swallowable",
    "sub_category": "gel",
    "gujarati_instruction": "આંગળી પર લઇ બધા જ પેઢા ઉપર મસાજ કરવું, ૫ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું, એવું સવારે બ્રશ કયા પછી અને રાત્રે સુતી વખતે કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 46,
    "name": "Tretin 0.05%",
    "category": "non-swallowable",
    "sub_category": "gel",
    "gujarati_instruction": "આંગળી પર લઇ અંદર બધે લગાવવું, ઘસવું કે મસાજ કરવું નહિ, આવું દિવસમાં ૫ વખત કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 47,
    "name": "Betadine gargle",
    "category": "non-swallowable",
    "sub_category": "liquid",
    "gujarati_instruction": "૩ ચમચી જેટલું પ્રવાહી લેવું, બહુ જ ધીમેથી કોગળા કરવા , ૫ મિનીટ પછી થૂકી દેવું, આવું દિવસમાં ૫ વખત કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 48,
    "name": "Clohex ADS",
    "category": "non-swallowable",
    "sub_category": "liquid",
    "gujarati_instruction": "એક ગ્લાસમાં 1 ચમચી પ્રવાહી લઇ એમાં ૪ ચમચી પાણી ઉમેરો, સરસ મિક્ષ કરીને ૫ મિનીટ માટે કોગળા કરવા. આવું દિવસમાં ૫-૬ વખત અથવા જમ્યા પછી કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 49,
    "name": "Clohex Heal",
    "category": "non-swallowable",
    "sub_category": "liquid",
    "gujarati_instruction": "૩ ચમચી જેટલું પ્રવાહી લેવું, બહુ જ ધીમેથી કોગળા કરવા , ૫ મિનીટ પછી થૂકી દેવું, આવું દિવસમાં ૫ વખત કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 50,
    "name": "Lignocaine Viscous Solution (for gargle)",
    "category": "non-swallowable",
    "sub_category": "liquid",
    "gujarati_instruction": "૩ ચમચી જેટલું પ્રવાહી લેવું, ૨ મિનીટ કોગળા કરવા . આવું જયારે જમવા બેસો તેની ૫ મિનીટ પહેલા અથવા જયારે જમારે દુખતું હોય ત્યારે કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 51,
    "name": "Vantej Aqua",
    "category": "non-swallowable",
    "sub_category": "liquid",
    "gujarati_instruction": "બોટલના ઢાંકણમાં ૧૦ લખેલું હોય ત્યાં સુધી પ્રવાહી ભરવું. એક મિનીટ માટે કોગળો કરવો, પછી અડધા કલાક માટે કંઇ ખાવું-પીવું નહિ કે સાદા પાણીથી કોગળા કરવા નહિ. એવું સવારે બ્રશ કયા પછી અને રાત્રે સુતી વખતે કરવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 52,
    "name": "Fixon Paste",
    "category": "non-swallowable",
    "sub_category": "extra",
    "gujarati_instruction": "ચોકઠાની અંદરની તરફ લગાવીને પહેરી લેવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 53,
    "name": "Fixon Powder",
    "category": "non-swallowable",
    "sub_category": "extra",
    "gujarati_instruction": "ચોકઠાની અંદરની તરફ લગાવીને પહેરી લેવું.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  },
  {
    "id": 54,
    "name": "Vantej Paste",
    "category": "non-swallowable",
    "sub_category": "extra",
    "gujarati_instruction": "અત્યારે જે પેસ્ટ વાપરતા હોય એ બંધ કરી આ પેસ્ટ ચાલુ કરવી. ૩ મહિના વાપરવી. દાંતમાં ઝણઝણાટી બંધ થઇ ગઈ હોય તો આ પેસ્ટ બંધ કરી તમે જે પેસ્ટ વાપરતા હતા એ પાછી ચાલુ કરી દેવી.",
    "created_at": "Wed Jun 25 2025 15:38:23 GMT+0530 (India Standard Time)"
  }
]

I notice they lack dosages.

P.S. I will be gone for a few hours, ironically to get some dental surgery.

ohh, i hope your treatment went well. Here by dosage if you mean when to give, then i'll select it. and if you are asking for dosage in mg, then i've written the brands name, which have dosage included in itself, so no need to add that. & please do one thing run my app, when you want to run it, just message here, i'll get mail, and i'll give you live link, so you can understand what i want to build, (unless it's night here in india and i'm sleeping)

There is a lot of custom logic in just one of the files in that package:

MedicineSelector.tsx
import React, { useState, useEffect } from 'react';
import type { Medicine, MedicineTiming } from '../types/medicine';
import { generateGujaratiInstruction } from '../utils/gujaratiInstructions';

interface MedicineSelectorProps {
  onAddMedicine: (medicine: Medicine) => void;
  onClose: () => void;
}

export default function MedicineSelector({ onAddMedicine, onClose }: MedicineSelectorProps) {
  const [step, setStep] = useState<'category' | 'subcategory' | 'details'>('category');
  const [selectedCategory, setSelectedCategory] = useState<Medicine['category'] | null>(null);
  const [selectedSubCategory, setSelectedSubCategory] = useState<Medicine['subCategory']>(undefined);
  const [medicineName, setMedicineName] = useState('');
  const [quantity, setQuantity] = useState(1);
  const [timing, setTiming] = useState<MedicineTiming>({
    morning: false,
    noon: false,
    evening: false,
    night: false,
  });
  const [days, setDays] = useState(5);
  const [beforeFood, setBeforeFood] = useState(false);
  const [spoons, setSpoons] = useState(1);
  const [customTablets, setCustomTablets] = useState(10);
  const [searchResults, setSearchResults] = useState<any[]>([]);
  const [isFullTablet, setIsFullTablet] = useState(true);
  const [isFullSpoon, setIsFullSpoon] = useState(true);

  const categories = [
    { id: 'swallowable', name: 'Swallowable' },
    { id: 'non-swallowable', name: 'Non-Swallowable' },
    { id: 'ketorol_10', name: 'Ketorol Dt: 10 Tablets' },
    { id: 'ketorol_custom', name: 'Ketorol Dt: Custom Tablets' },
  ];

  const swallowableSubCategories = [
    { id: 'tablet', name: 'Tablets' },
    { id: 'capsule', name: 'Capsules' },
    { id: 'syrup', name: 'Syrups' },
  ];

  const nonSwallowableSubCategories = [
    { id: 'gel', name: 'Gel' },
    { id: 'liquid', name: 'Liquid' },
    { id: 'extra', name: 'Extra' },
  ];

  const loadMedicinesByCategory = async () => {
    if (!selectedCategory || !selectedSubCategory) return;
    
    try {
      const response = await fetch(`/api/medicines?category=${selectedCategory}&subCategory=${selectedSubCategory}`);
      const medicines = await response.json();
      setSearchResults(medicines);
    } catch (error) {
      console.error('Error loading medicines:', error);
    }
  };

  const searchMedicines = async (query: string) => {
    if (!query.trim()) {
      await loadMedicinesByCategory();
      return;
    }
    
    try {
      const response = await fetch(`/api/medicines/search?q=${encodeURIComponent(query)}&category=${selectedCategory}&subCategory=${selectedSubCategory}`);
      const medicines = await response.json();
      setSearchResults(medicines);
    } catch (error) {
      console.error('Error searching medicines:', error);
    }
  };

  const handleCategorySelect = (category: Medicine['category']) => {
    setSelectedCategory(category);
    
    if (category === 'ketorol_10') {
      // Skip subcategory selection for Ketorol 10 tablets
      setStep('details');
      setMedicineName('Ketorol Dt');
      setQuantity(10);
      setTiming({ morning: true, noon: true, evening: false, night: true });
      setDays(5);
      setBeforeFood(false);
    } else if (category === 'ketorol_custom') {
      // Skip subcategory selection for Ketorol custom tablets
      setStep('details');
      setMedicineName('Ketorol Dt');
    } else {
      setStep('subcategory');
    }
  };

  const handleSubCategorySelect = async (subCategory: Medicine['subCategory']) => {
    setSelectedSubCategory(subCategory);
    setStep('details');
    
    // Set default quantity based on subcategory
    if (subCategory === 'syrup' || subCategory === 'gel' || subCategory === 'liquid' || subCategory === 'extra') {
      setQuantity(1);
    }
    
    // Load medicines for this category/subcategory
    try {
      const response = await fetch(`/api/medicines?category=${selectedCategory}&subCategory=${subCategory}`);
      const medicines = await response.json();
      setSearchResults(medicines);
    } catch (error) {
      console.error('Error loading medicines:', error);
    }
  };

  const handleAddMedicine = async () => {
    if (!selectedCategory || !medicineName.trim()) return;

    // Find the selected medicine from database to get prefilled instruction
    let selectedMedicineFromDB = searchResults.find(med => med.name === medicineName);
    
    // If not found in search results, try to fetch directly from database by name
    if (!selectedMedicineFromDB && selectedCategory === 'non-swallowable') {
      try {
        const response = await fetch(`/api/medicines/byname/${encodeURIComponent(medicineName)}`);
        if (response.ok) {
          selectedMedicineFromDB = await response.json();
        }
      } catch (error) {
        console.error('Error fetching medicine by name:', error);
      }
    }
    
    const medicine: Medicine = {
      id: Date.now().toString(),
      name: medicineName,
      category: selectedCategory,
      subCategory: selectedSubCategory,
      quantity,
      timing: selectedCategory === 'ketorol_10' ? { morning: true, noon: true, evening: false, night: true } : 
              (selectedSubCategory === 'gel' || selectedSubCategory === 'liquid' || selectedSubCategory === 'extra') ? 
              { morning: false, noon: false, evening: false, night: false } : timing,
      days: selectedCategory === 'ketorol_10' ? 3 : 
            (selectedSubCategory === 'gel' || selectedSubCategory === 'liquid' || selectedSubCategory === 'extra') ? 0 : days,
      beforeFood,
      spoons: selectedSubCategory === 'syrup' ? 1 : undefined,
      customTablets: selectedCategory === 'ketorol_custom' ? customTablets : undefined,
      isFullTablet: selectedSubCategory === 'tablet' ? isFullTablet : undefined,
      isFullSpoon: selectedSubCategory === 'syrup' ? isFullSpoon : undefined,
      gujaratiInstruction: '',
    };

    // Use prefilled instruction for non-swallowable and ketorol, generate for swallowable
    if (selectedCategory === 'non-swallowable' && selectedMedicineFromDB?.gujaratiInstruction) {
      medicine.gujaratiInstruction = selectedMedicineFromDB.gujaratiInstruction;
    } else if (selectedCategory === 'ketorol_10') {
      medicine.gujaratiInstruction = 'આ ગોળી એક ગ્લાસ પાણીમાં ઓગળીને, સવારે-બપોરે-રાત્રે જમ્યા પછી પીવાની છે , ફક્ત પહેલી વખત ૨ ગોળી એકસાથે પાણીમાં ઓગાળવાની છે .';
    } else if (selectedCategory === 'ketorol_custom') {
      medicine.gujaratiInstruction = 'જ્યારે અતિશય દુખતું હોય ત્યારે એક ગ્લાસ પાણીમાં એકસાથે ૨ ગોળી ઓગાળીને પી જવું, ૧૦ મીનીટમાં જ દુખાવો ઓછો થઇ જશે.';
    } else {
      medicine.gujaratiInstruction = generateGujaratiInstruction(medicine);
    }
    
    onAddMedicine(medicine);
    onClose();
  };

  const toggleTiming = (period: keyof MedicineTiming) => {
    setTiming(prev => ({ ...prev, [period]: !prev[period] }));
  };

  return (
    <div className="medicine-selector-overlay">
      <div className="medicine-selector">
        <div className="medicine-selector-header">
          <h2>Add Medicine</h2>
          <button onClick={onClose} className="close-btn">×</button>
        </div>

        {step === 'category' && (
          <div className="category-selection">
            <h3>Select Medicine Category</h3>
            <div className="category-grid">
              {categories.map(category => (
                <button
                  key={category.id}
                  onClick={() => handleCategorySelect(category.id as Medicine['category'])}
                  className="category-btn"
                >
                  {category.name}
                </button>
              ))}
            </div>
          </div>
        )}

        {step === 'subcategory' && (
          <div className="subcategory-selection">
            <h3>Select Medicine Type</h3>
            <div className="category-grid">
              {(selectedCategory === 'swallowable' ? swallowableSubCategories : nonSwallowableSubCategories).map(subcat => (
                <button
                  key={subcat.id}
                  onClick={() => handleSubCategorySelect(subcat.id as Medicine['subCategory'])}
                  className="category-btn"
                >
                  {subcat.name}
                </button>
              ))}
            </div>
            <button onClick={() => setStep('category')} className="back-btn">← Back</button>
          </div>
        )}

        {step === 'details' && (
          <div className="medicine-details">
            <h3>Medicine Details</h3>
            
            <div className="form-group">
              <label>Medicine Name:</label>
              <input
                type="text"
                value={medicineName}
                onChange={(e) => {
                  setMedicineName(e.target.value);
                  searchMedicines(e.target.value);
                }}
                placeholder={selectedCategory === 'ketorol_10' || selectedCategory === 'ketorol_custom' ? 
                  "Ketorol Dt" : "Search or select medicine"}
                disabled={selectedCategory === 'ketorol_10' || selectedCategory === 'ketorol_custom'}
              />
              {searchResults.length > 0 && (
                <div className="search-results">
                  {searchResults.map(medicine => (
                    <div
                      key={medicine.id}
                      onClick={() => {
                        setMedicineName(medicine.name);
                        setSearchResults([]);
                      }}
                      className="search-result-item"
                    >
                      <strong>{medicine.name}</strong>
                      {medicine.gujaratiInstruction && (
                        <div style={{fontSize: '0.8rem', color: '#666', marginTop: '2px'}}>
                          Prefilled instruction available
                        </div>
                      )}
                    </div>
                  ))}
                </div>
              )}
            </div>

            {selectedCategory === 'ketorol_custom' && (
              <div className="form-group">
                <label>Number of Tablets:</label>
                <input
                  type="number"
                  value={customTablets}
                  onChange={(e) => setCustomTablets(Number(e.target.value))}
                  min="1"
                />
              </div>
            )}

            {selectedSubCategory === 'tablet' && (
              <>
                <div className="form-group">
                  <label>Tablet Type:</label>
                  <div className="radio-group">
                    <label>
                      <input
                        type="radio"
                        checked={isFullTablet}
                        onChange={() => setIsFullTablet(true)}
                      />
                      Full Tablet
                    </label>
                    <label>
                      <input
                        type="radio"
                        checked={!isFullTablet}
                        onChange={() => setIsFullTablet(false)}
                      />
                      Half Tablet
                    </label>
                  </div>
                </div>
                <div className="form-group">
                  <label>Total Quantity:</label>
                  <input
                    type="number"
                    value={quantity}
                    onChange={(e) => setQuantity(parseInt(e.target.value) || 1)}
                    min="1"
                  />
                </div>
              </>
            )}

            {selectedSubCategory === 'capsule' && (
              <div className="form-group">
                <label>Total Quantity:</label>
                <input
                  type="number"
                  value={quantity}
                  onChange={(e) => setQuantity(parseInt(e.target.value) || 1)}
                  min="1"
                />
              </div>
            )}

            {selectedSubCategory === 'syrup' && (
              <div className="form-group">
                <label>Spoon Type:</label>
                <div className="radio-group">
                  <label>
                    <input
                      type="radio"
                      checked={isFullSpoon}
                      onChange={() => setIsFullSpoon(true)}
                    />
                    Full Spoon
                  </label>
                  <label>
                    <input
                      type="radio"
                      checked={!isFullSpoon}
                      onChange={() => setIsFullSpoon(false)}
                    />
                    Half Spoon
                  </label>
                </div>
              </div>
            )}



            {selectedCategory !== 'ketorol_10' && selectedCategory !== 'ketorol_custom' && selectedSubCategory !== 'gel' && selectedSubCategory !== 'liquid' && selectedSubCategory !== 'extra' && (
              <>
                <div className="form-group">
                  <label>Timing:</label>
                  <div className="timing-checkboxes">
                    {Object.entries(timing).map(([period, checked]) => (
                      <label key={period} className="checkbox-label">
                        <input
                          type="checkbox"
                          checked={checked}
                          onChange={() => toggleTiming(period as keyof MedicineTiming)}
                        />
                        {period.charAt(0).toUpperCase() + period.slice(1)}
                      </label>
                    ))}
                  </div>
                </div>

                <div className="form-group">
                  <label>Total Days:</label>
                  <input
                    type="number"
                    value={days}
                    onChange={(e) => setDays(Number(e.target.value))}
                    min="1"
                  />
                </div>

                <div className="form-group">
                  <label>Food Timing:</label>
                  <div className="radio-group">
                    <label className="radio-label">
                      <input
                        type="radio"
                        checked={beforeFood}
                        onChange={() => setBeforeFood(true)}
                      />
                      Before Food
                    </label>
                    <label className="radio-label">
                      <input
                        type="radio"
                        checked={!beforeFood}
                        onChange={() => setBeforeFood(false)}
                      />
                      After Food
                    </label>
                  </div>
                </div>
              </>
            )}

            <div className="form-actions">
              <button onClick={() => setStep(selectedCategory === 'ketorol_10' || selectedCategory === 'ketorol_custom' ? 'category' : 'subcategory')} className="back-btn">
                ← Back
              </button>
              <button onClick={handleAddMedicine} className="add-btn">
                Add Medicine
              </button>
            </div>
          </div>
        )}
      </div>
    </div>
  );
}

How long did it take to specify all that to Replit, to allow Replit to generate that file?

Probably don't want this to go to waste:

Database dump
-- Complete Medicine Database for Dental Prescription Generator
-- This SQL file contains all 38 medicines with Gujarati instructions

-- Create tables
CREATE TABLE IF NOT EXISTS medicines (
    id SERIAL PRIMARY KEY,
    name TEXT NOT NULL,
    category TEXT NOT NULL,
    sub_category TEXT,
    gujarati_instruction TEXT,
    created_at TIMESTAMP DEFAULT NOW()
);

CREATE TABLE IF NOT EXISTS prescriptions (
    id SERIAL PRIMARY KEY,
    patient_name TEXT,
    patient_age TEXT,
    patient_gender TEXT,
    date TEXT,
    medicines JSON,
    created_at TIMESTAMP DEFAULT NOW()
);

-- Insert all medicines
INSERT INTO medicines (name, category, sub_category, gujarati_instruction) VALUES
-- Swallowable Tablets
('Augmentin Duo', 'swallowable', 'tablet', NULL),
('Azithral 250', 'swallowable', 'tablet', NULL),
('Brufen 600', 'swallowable', 'tablet', NULL),
('DAN-P / Dynapar', 'swallowable', 'tablet', NULL),
('Diclo-50', 'swallowable', 'tablet', NULL),
('Ketorol DT', 'swallowable', 'tablet', NULL),
('Metrogyl 200', 'swallowable', 'tablet', NULL),
('Metrogyl 400', 'swallowable', 'tablet', NULL),
('Pantoprazole 40 mg + Domperidone', 'swallowable', 'tablet', NULL),
('Rantac Dom', 'swallowable', 'tablet', NULL),
('Zerodol MR', 'swallowable', 'tablet', NULL),
('Zerodol PT', 'swallowable', 'tablet', NULL),
('Zerodol SP', 'swallowable', 'tablet', NULL),
('Zerodol-TH-MAX-4', 'swallowable', 'tablet', NULL),
('Zerodol-TH-OD-8', 'swallowable', 'tablet', NULL),

-- Swallowable Capsules
('Acutret 20 / Isotroin 20', 'swallowable', 'capsule', NULL),
('Becosules', 'swallowable', 'capsule', NULL),
('Evion 400', 'swallowable', 'capsule', NULL),
('Mox 250', 'swallowable', 'capsule', NULL),
('Mox 500', 'swallowable', 'capsule', NULL),
('Pregabalin 50', 'swallowable', 'capsule', NULL),
('SM Fibro', 'swallowable', 'capsule', NULL),

-- Swallowable Syrups
('Ibugesic Plus', 'swallowable', 'syrup', NULL),
('MoxClav 228.8 mg', 'swallowable', 'syrup', NULL),

-- Non-Swallowable Gels
('Caziq / Kenacort 0.1%', 'non-swallowable', 'gel', 'આંગળી પર લઇ જ્યાં પોલ્લા પડ્યા છે ત્યાં લગાવવું, ૩૦ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું એવી રીતે દર 2 કલાકે લગાવવું.'),
('Dologel CT', 'non-swallowable', 'gel', 'આંગળી પર લઇ જ્યાં પોલ્લા પડ્યા છે ત્યાં લગાવવું, ૫ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું. જમારે જમવા બેસો તેની ૫ મિનીટ પહેલા અથવા જમારે જમારે દુખતું હોય ત્યારે લગાવવું.'),
('Metrogyl DG', 'non-swallowable', 'gel', 'આંગળી પર લઇ જ્યાં સોજો આવેલો છે ત્યાં ચારે બાજુ પેઢા ઉપર લગાવવું, ઘસવું કે મસાજ કરવું નહિ, ૨૦ મિનીટ સુધી રાખી કોગળા કરી નાખવા, આવું દિવસમાં ૫ વખત કરવું.'),
('Metrohex Plus', 'non-swallowable', 'gel', 'આંગળી પર લઇ જ્યાં સોજો આવેલો છે ત્યાં ચારે બાજુ પેઢા ઉપર લગાવવું, ઘસવું કે મસાજ કરવું નહિ, ૨૦ મિનીટ સુધી રાખી કોગળા કરી નાખવા, આવું દિવસમાં ૫ વખત કરવું.'),
('Stolin Gum Paint', 'non-swallowable', 'gel', 'આંગળી પર લઇ બધા જ પેઢા ઉપર મસાજ કરવું, ૫ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું, એવું સવારે બ્રશ કયા પછી અને રાત્રે સુતી વખતે કરવું.'),
('Tretin 0.05%', 'non-swallowable', 'gel', 'આંગળી પર લઇ અંદર બધે લગાવવું, ઘસવું કે મસાજ કરવું નહિ, આવું દિવસમાં ૫ વખત કરવું.'),

-- Non-Swallowable Liquids
('Betadine gargle', 'non-swallowable', 'liquid', '૩ ચમચી જેટલું પ્રવાહી લેવું, બહુ જ ધીમેથી કોગળા કરવા , ૫ મિનીટ પછી થૂકી દેવું, આવું દિવસમાં ૫ વખત કરવું.'),
('Clohex ADS', 'non-swallowable', 'liquid', 'એક ગ્લાસમાં 1 ચમચી પ્રવાહી લઇ એમાં ચાર ચમચી પાણી ઉમેરો, સારુ મિક્ષ કરીને ૫ મિનીટ માટે કોગળા કરવા. આવું દિવસમાં ૫-૬ વખત અથવા દર વખતે જમ્યા પછી કરવું.'),
('Clohex Heal', 'non-swallowable', 'liquid', '૩ ચમચી જેટલું પ્રવાહી લેવું, બહુ જ ધીમેથી કોગળા કરવા , ૫ મિનીટ પછી થૂકી દેવું, આવું દિવસમાં ૫ વખત કરવું.'),
('Lignocaine Viscous Solution (for gargle)', 'non-swallowable', 'liquid', '૩ ચમચી જેટલું પ્રવાહી લેવું, ૨ મિનીટ કોગળા કરવા . આવું જમારે જમવા બેસો તેની ૫ મિનીટ પહેલા અથવા જમારે જમારે દુખતું હોય ત્યારે કરવું.'),
('Vantej Aqua', 'non-swallowable', 'liquid', 'બોટલના ઢાંકણમાં ૧૦ લાખું હળે ત્યાં સુધી પ્રવાહી ભરવું. એક મિનીટ માટે કોગળો કરવો, પછી અડધા કલાક માટે કંઇ ખાવું-પીવું નહિ કે સાદા પાણીથી કોગળા કરવા નહિ. એવું સવારે બ્રશ કયા પછી અને રાત્રે સુતી વખતે કરવું.'),

-- Non-Swallowable Extra (Pastes and Powders)
('Fixon Paste', 'non-swallowable', 'extra', 'ચોકઠાની અંદરની તરફ લગાવીને પહેરી લેવું.'),
('Fixon Powder', 'non-swallowable', 'extra', 'ચોકઠાની અંદરની તરફ લગાવીને પહેરી લેવું.'),
('Vantej Paste', 'non-swallowable', 'extra', 'અત્યારે જે પેસ્ટ વાપરતા હોય એ બંધ કરી આ પેસ્ટ ચાલુ કરવી. ૩ મહિના વાપરવી. દાંતમાં ઝણઝણાટી બંધ થઇ ગઈ હોય તો આ પેસ્ટ બંધ કરી તમે જે પેસ્ટ વાપરતા હતા એ પાછી ચાલુ કરી દેવી.');

Gujarati instructions updates:

Gujarati instructions updates:
UPDATE medicines SET gujarati_instruction = 'આંગળી પર લઇ જ્યાં ફોલ્લા પડ્યા છે ત્યાં લગાવવું, ૩૦ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું એવી રીતે દર ૨ કલાકે લગાવવું.' WHERE name = 'Caziq / Kenacort 0.1%';
UPDATE medicines SET gujarati_instruction = 'આંગળી પર લઇ જ્યાં ફોલ્લા પડ્યા છે ત્યાં લગાવવું, ૫ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું. જ્યારે જમવા બેસો તેની ૫ મિનીટ પહેલા અથવા જયારે જયારે દુખતું હોય ત્યારે લગાવવું.' WHERE name = 'Dologel CT';
UPDATE medicines SET gujarati_instruction = 'આંગળી પર લઇ જ્યાં સોજો આવેલો છે ત્યાં ચારે બાજુ પેઢા ઉપર લગાવવું, ઘસવું કે મસાજ કરવું નહિ, ૨૦ મિનીટ સુધી રાખી કોગળા કરી નાખવા, આવું દિવસમાં ૫ વખત કરવું.' WHERE name = 'Metrogyl DG';
UPDATE medicines SET gujarati_instruction = 'આંગળી પર લઇ જ્યાં સોજો આવેલો છે ત્યાં ચારે બાજુ પેઢા ઉપર લગાવવું, ઘસવું કે મસાજ કરવું નહિ, ૨૦ મિનીટ સુધી રાખી કોગળા કરી નાખવા, આવું દિવસમાં ૫ વખત કરવું.' WHERE name = 'Metrohex Plus';
UPDATE medicines SET gujarati_instruction = 'આંગળી પર લઇ બધા જ પેઢા ઉપર મસાજ કરવું, ૫ મિનીટ રાખી કોગળા કરીને કાઢી નાખવું, એવું સવારે બ્રશ કયા પછી અને રાત્રે સુતી વખતે કરવું.' WHERE name = 'Stolin Gum Paint';
UPDATE medicines SET gujarati_instruction = 'આંગળી પર લઇ અંદર બધે લગાવવું, ઘસવું કે મસાજ કરવું નહિ, આવું દિવસમાં ૫ વખત કરવું.' WHERE name = 'Tretin 0.05%';
UPDATE medicines SET gujarati_instruction = '૩ ચમચી જેટલું પ્રવાહી લેવું, બહુ જ ધીમેથી કોગળા કરવા , ૫ મિનીટ પછી થૂકી દેવું, આવું દિવસમાં ૫ વખત કરવું.' WHERE name = 'Betadine gargle';
UPDATE medicines SET gujarati_instruction = 'એક ગ્લાસમાં 1 ચમચી પ્રવાહી લઇ એમાં ૪ ચમચી પાણી ઉમેરો, સરસ મિક્ષ કરીને ૫ મિનીટ માટે કોગળા કરવા. આવું દિવસમાં ૫-૬ વખત અથવા જમ્યા પછી કરવું.' WHERE name = 'Clohex ADS';
UPDATE medicines SET gujarati_instruction = '૩ ચમચી જેટલું પ્રવાહી લેવું, બહુ જ ધીમેથી કોગળા કરવા , ૫ મિનીટ પછી થૂકી દેવું, આવું દિવસમાં ૫ વખત કરવું.' WHERE name = 'Clohex Heal';
UPDATE medicines SET gujarati_instruction = '૩ ચમચી જેટલું પ્રવાહી લેવું, ૨ મિનીટ કોગળા કરવા . આવું જયારે જમવા બેસો તેની ૫ મિનીટ પહેલા અથવા જયારે જમારે દુખતું હોય ત્યારે કરવું.' WHERE name = 'Lignocaine Viscous Solution (for gargle)';
UPDATE medicines SET gujarati_instruction = 'બોટલના ઢાંકણમાં ૧૦ લખેલું હોય ત્યાં સુધી પ્રવાહી ભરવું. એક મિનીટ માટે કોગળો કરવો, પછી અડધા કલાક માટે કંઇ ખાવું-પીવું નહિ કે સાદા પાણીથી કોગળા કરવા નહિ. એવું સવારે બ્રશ કયા પછી અને રાત્રે સુતી વખતે કરવું.' WHERE name = 'Vantej Aqua';
UPDATE medicines SET gujarati_instruction = 'ચોકઠાની અંદરની તરફ લગાવીને પહેરી લેવું.' WHERE name = 'Fixon Paste';
UPDATE medicines SET gujarati_instruction = 'ચોકઠાની અંદરની તરફ લગાવીને પહેરી લેવું.' WHERE name = 'Fixon Powder';
UPDATE medicines SET gujarati_instruction = 'અત્યારે જે પેસ્ટ વાપરતા હોય એ બંધ કરી આ પેસ્ટ ચાલુ કરવી. ૩ મહિના વાપરવી. દાંતમાં ઝણઝણાટી બંધ થઇ ગઈ હોય તો આ પેસ્ટ બંધ કરી તમે જે પેસ્ટ વાપરતા હતા એ પાછી ચાલુ કરી દેવી.' WHERE name = 'Vantej Paste';

I notice in your sample prescriptions you represent morning/noon/evening/night as 1-1-1-1.

Does the Gujarati text tell the patients how to decode that, or would you rather just use the words morning/noon/evening/night instead of the 1s and 0s?

Or would it make more sense to offer Gujarati words for those?

replit is ai based, i just gave instructions, it made those by itself as i don't know enything. Now about instructions, 1-1-1-1 for timing when to take medicine, usually the pharmacist teach the patient about it, bit before that when i give prescription to patient, i'd teach them too. but sometimes all this takes to much time. So in this app if you have seen in replit, when i select from morning-noon-evening-night, while creating gujrati instructions, according to selection of time, it automatically makes gujrati instructions based on it. in non-swallowable medicines, the gujrati instructions are prefilled,but in swallowable medicines, based on my selection from: Full tablet/Half Tablet, Full Spoon/ Half Spoon, Total quantity, Morning-Noon-Evening-night, Total Days, Before Food/After Food; the gujrati instructions will generate.

right now I'm also trying to make an app using ai and Android studio, where ai makes code for me.let's hope something works. I'm so happy that you are taking interest in this and helping me. Thanks a lot for that. And please continue help me and look into it.

Hello, No Update?

We generally help people in proportion to their willingness to learn and their efforts.

I am visualizing design elements

We have a For Pay section if you want to contract with a hungry student.

4 Likes

Here's a starter aia export, with all the controls and databases needed for the app.

I had to get it out of my head, before it evaporated.

Not everything would be visible all at once, the various Arrangements would be made visible or invisible in the blocks as needed.


Prescription (1).aia (119.7 KB)

No promises.

I'll leave this running in the waiting room, to ease your wait:

2 Likes

Here's something to play with


Prescription (4).aia (130.4 KB)

Some notes on customizing your app:

Your footer image could easily be replaced in the Designer by nested Arrangements of Labels, with different alignment, font sizes, text colors, etc.

I leave that to you, to adjust to your taste.

I would avoid the Absolute Arrangement.

It ties the layout too closely to your specific device size. The other Arrangements can be set to stretch to fit the device.

Likewise, for your header.
I would split out the two graphics (caduceus and nuclear tooth) and arrange them next to Labels with your text.

If you are set on displaying a button on top of an image, use the image as background in an Arrangement containing the Button.

I hope you enjoy playing with App Inventor.

My conscience would not allow leaving a sloppy untested piece of code on the board.

Here is a cleaned up and tested version:

  • I replaced the footer image with two stacked html labels with centering
  • I hid the footer during entry
  • added saving the three medicine attributes to TinyDB after their Enter buttons clicked
  • added Clear and Exit buttons to the control bar.

Prescription.aia (131.6 KB)

About to write prescription
after back button
ready to generate