A Swift command-line application that generates a daily schedule for taking medicines based on specific rules, dosages, and timing requirements.
- Reads a list of medicines from a file (
listaLekova.md) - Parses medicine-specific rules and requirements
- Takes into account daily events (wake up, meals, sleep)
- Creates an optimized schedule that respects medicine-specific requirements
- Visual formatting with emojis for different types of events:
- ☀️ Wake Up
- 🥑 Breakfast
- 🍗 Lunch
- 🍝 Dinner
- 🛏️ Sleep
- 💊 Medicines
- Handles special cases like:
- Medicines that need to be taken on an empty stomach (e.g., Eutirox, Heferal)
- Medicines that must be taken with food
- Medicines that need to be separated from other medicines (e.g., Nifelat and Utrogestan)
- Medicines with specific timing or meal requirements
- Specific dosage instructions and rotations
- Paired medications (e.g., Heferal and Vitamin C always scheduled together)
- Optimally distributes multiple daily doses to maximize time between doses
- Special handling for bedtime medications
- Ensure your list of medicines is in the
listaLekova.mdfile in the current directory - Run the application:
swift run terapija- The application will read the medicine list, generate a schedule based on default daily events, and display the results.
The medicine list file (listaLekova.md) should contain entries in the following format:
- MedicineName: dosage instructions and special rules
For example:
- Eutirox: 4 days = 50mg + 3 days = 75mg (take it on empty stomach, in the morning, 30-60 minutes before taking the food)
- Aleract: 2x per day
- Heferal: 2x per day (on empty stomach but with C vitamin or citruses, but NOT with milk NOR calcium)
- Pronison 5mg: 1x per day (recommended after breakfast)
The application uses a sophisticated scheduling algorithm that:
- Prioritizes medicine-specific requirements (e.g., Eutirox must be taken before breakfast)
- Separates conflicting medicines (e.g., keeping Nifelat and Utrogestan at least 2 hours apart)
- Distributes multiple daily doses evenly throughout the day
- Places nighttime medicines before sleep
- Schedules medicines with empty stomach requirements at appropriate times
- Adds detailed notes for each medicine to explain special requirements
- Ensures proper timing between related medications:
- Eutirox taken 30 minutes after waking up, but at least 30 minutes before breakfast
- Heferal taken exactly 1 hour before breakfast or 2 hours after dinner on empty stomach
- Vitamin C scheduled together with Heferal
The schedule uses distinct visual formatting to enhance readability:
- Medicine names are displayed in UPPERCASE for emphasis
- Daily events use specific emojis for easy identification:
- ☀️ for wake up time
- 🥑 for breakfast
- 🍗 for lunch
- 🍝 for dinner
- 🛏️ for sleep time
- 💊 for all medicines
- Blank lines after meal entries for improved visual separation
You can modify the daily event times by updating the setDailyEvents parameters in main.swift. The default times are:
- Wake up: 07:00
- Breakfast: 09:00
- Lunch: 14:00
- Dinner: 17:00
- Sleep: 23:00
- Swift 5.0+
- macOS, Linux, or any platform supporting Swift