Bacterial Antibiotic Resistance Simulation
Here is an interactive bacterial antibiotic resistance simulation created using Python, with assistance from AI (Claude) later converted to React. The simulation serves as an educational tool to demonstrate how bacterial populations evolve and respond to antibiotic treatment over time, highlighting the importance of consistent medication adherence.
The script has been put on github for public access and simulation is hosted on a webpage. Link of the webpage: https://avanishutsav.github.io/AMr/
The simulation is inspired from an activity by Science Education for Public Understanding Program(SEPUP).
Development Process
The simulation was developed using Python as the primary programming language, leveraging several key technologies:
- Tkinter for the graphical user interface
- Matplotlib for real-time population graphing
- Canvas widgets for bacterial and dice visualization
- Threading for smooth animations
Later the python script was converted to react using AI. AI assistance through Claude was instrumental in developing the core logic and implementing the visual components. The AI helped structure the code efficiently and implement complex features like the dynamic visualization system.
Simulation Mechanics
The simulation tracks three distinct bacterial populations:
1. Blue bacteria (least resistant to antibiotics)
2. Yellow bacteria (moderately resistant)
3. Red bacteria (highly resistant)
Each day in the simulation follows these steps:
- A dice roll (1-6) determines if antibiotics are administered
- Rolls of 1, 3, 5, or 6: Remove 5 bacteria (starting with least resistant)
- Rolls of 2 or 4: Skip dose (simulating missed medication)
- Surviving bacteria reproduce (population increases by 1 per type)
- Visual displays update to reflect population changes
Visual Components
The interface consists of three main elements:
1. Population Graph
- Real-time line graph showing population trends
- Color-coded lines for each bacteria type
- Day-by-day progression tracking
2. Bacteria Visualization Panel
- Visual representation of current populations
- Color-coded circles representing individual bacteria
- Organized display showing relative population sizes
3. Interactive Dice
- Animated dice roll visualization
- Visual feedback for antibiotic administration decisions
- Enhanced user engagement through animation
Concepts addressed
The simulation effectively demonstrates several key concepts:
- Development of antibiotic resistance in bacterial populations
- Impact of inconsistent medication adherence
- Importance of completing prescribed antibiotic courses
The visual elements make complex concepts accessible to students and help illustrate the consequences of different treatment patterns. The interactive nature of the simulation engages users and reinforces learning through direct manipulation of variables.
The simulation allows users to:
- Set initial population numbers
- Progress through days at their own pace
- Observe immediate and long-term effects of treatment
- Track population changes through multiple visual representation
The project demonstrates how AI can be effectively utilized in educational simulation for complex concepts. Future enhancements could include additional bacterial types, more complex resistance mechanisms.
0 comments