We know that Hashem gives everyone free choice. But when examining the traits of an insane person, it is clear that someone can be so mentally ill that it is impossible for them to control what they do. So, how can one say that this person has free choice? Is the only medicine that will stop their “uncontrollable” actions, the Torah? Please cite sources.
When a person did lose his free choice, we say that he became Shote, loosely linked to the inaccurate term of "crazy" or insane. He is categorized as a child regarding responsibility and this state is often reversed to sanity.
For instance mishna Gittin 2.6
קיבל הקטן והגדיל, חירש ונתפקח, סומא ונתפתח, שוטה ונשתפה, נוכרי ונתגייר--פסול. אבל פיקח ונתחרש וחזר ונתפקח, פיתח ונסתמא וחזר ונתפתח, שפוי ונשתטה חזר ונשתפה--כשר. זה הכלל--כל שתחילתו וסופו בדעת, כשר.
The status of Shote makes him exempt from mitsvot and no responsible for his actions even if he caused damages, even if he murdered. But sane people need to apply every duty toward insane people, there is no reciprocity, as you see in Baba Kama 8.4.
חירש שוטה וקטן, העבד, והאישה--פגיעתן רעה. החובל בהן, חייב.
So not everybody has free choice. If a man doesn't have free choice, why was he created? King David asked this, and the answer is that this has a functionality that is not appearing immediately.