Supposedly, there are screenwriting programs that can generate screenplays using a rather sophisticated algorithm that has analyzed the plots and dialogue of thousands of movies. I don’t know how successful these programs have been, but I have a sneaky suspicion that the script for the new teen medical tearjerker, Five Feet Apart, credited to the novice wife and husband team of Mikki Daughtry and Tobias Iaconis, is actually the “brainchild” of such a program. If that’s true, someone needs to change the program’s algorithm immediately.

Stop me if you’ve heard this before. Or, on second thought, don’t, because otherwise, this review will only go on for another two sentences. Five Feet Apart is an example of a specialized subgenre, the dying teen romance, and an even more specialized subgenre, the two-teens-dying-of-the-same-disease romance. The best example of this subgenre is the 2014 tearjerker The Fault in Our Stars. In comparing these two movies, the only differences appear to be a different tragic disease and a complete lack of compelling supporting characters in Five Feet Apart.

The disease in Five Feet Apart is the all-too-real but relatively unfamiliar cystic fibrosis, a genetic ailment that most people have heard of, but few know just what it is. One of the few real benefits that may derive from this movie is a better understanding of cystic fibrosis, a genetic disorder that severely compromises the respiratory system and generally leads to a young death. There is no cure, but lung transplants can extend a patient’s life by several years. To make matters worse, CF patients are prone to various infections that could prove fatal.

Stella Grant (Haley Lu Richardson) and Will Newman (Cole Sprouse) are two CF patients at the same hospital, which has an extensive CF treatment center. She is awaiting a lung transplant; he has been exposed to a bacterial infection that disqualifies him from the transplant list, but he is taking part in an experimental drug trial. Of course, as you might guess, other than their shared disease, Stella and Will have virtually nothing in common. She is a stickler for rules and protocols, while he is the typical rebel who really doesn’t care what happens to him.

In what might be labeled a spoiler if it weren’t so patently obvious from the moment Stella (and the audience) first see the hunky Will in the hospital, the two gradually fall for each other. Any relationship they might share is complicated enormously by the fact that they can’t get within several feet of each other to avoid spreading infections to another patient whose immune system is already severely compromised.

If Five Feet Apart were any other type of movie, revealing the ending would be a total no-no for critics, and, even here, there is some small degree of uncertainty on the part of viewers. There are actually two and only two ways that this movie could turn out, and I won’t reveal which one it winds up being. I will say, however, that there is no such uncertainty regarding the fate of the only other character in the movie who has any sort of personality or character. That would be Poe (Moises Arias), a skinny, gay teen in the CF unit, who is both Stella’s only real friend and the film’s only source of humor. If you can’t figure out what happens to him, then you’ve never seen a movie before.

Of course, the very idea of the gay confidante sidekick for the female lead in a romance has become so stereotyped that it was mercilessly lampooned last month in Isn’t It Romantic. The screenwriters obviously missed that lesson in film school, just as they missed a whole lot of other lessons such as the avoidance of needless foreshadowing. All you need to hear is Poe telling Stella how excited he is that his new boyfriend is going to visit the hospital the next day to know that poor Poe’s health is going to take a drastic downturn.

I give Moises Arias credit for soldiering on in a thankless role in Five Feet Apart, trying and occasionally finding a bit of humor here and there in a drab movie. However, I give more credit to Haley Lu Richardson, who has graduated from playing sidekicks in films like Edge of Seventeen to a romantic lead here. She dominates the movie with charm and determination, making a real person out of what was, on paper, a mess of clichés and stereotypes. Moreover, I give the filmmakers credit for having the guts to show Stella as a sick person (there are a couple of coughing fit scenes that aren’t for the squeamish). All too many disease films feature actors who look in the picture of health until the very end. Here, it’s quite evident that these are very sick teenagers. Indeed, one of the best scenes in the film involves Stella and Will stripping to a PG-13 level of underwear, overcoming, not just the usual teen anxieties about imperfect bodies, but an understandable concern over exposing their various tubes and scars to another person.

It’s moments like the swimming scene that make Five Feet Apart work on occasion. In those scenes, the audience understands that the disease is real and not just a convenient third-act plot device. But when those scenes end and the more traditional ones like the birthday party shown below resume, the film relapses into predictability. Director Justin Baldoni (also a feature film novice) tries for big romantic moments, including a late-film get-together between Stella and Will that, in a complete abandonment of any semblance of plausibility, winds up literally on thin ice. However, they fall flat, over and over again.

Five Feet Apart really has only two things going for it. First, there is the film’s exceedingly detailed warts-and-all portrayal of a disease that, unlike cancer, rarely gets depicted onscreen. Just by raising public awareness, the filmmakers have done the audience a favor. But in terms of what the movie has to offer artistically, the audience is left with a winning performance by Haley Lu Richardson, an actress who really nails her breakout role. Unfortunately, neither public awareness nor a good lead performance results in a movie that works enough of the time. Instead, we are left with a film that is five feet apart from genuine quality.

In this clip, Haley Lu Richardson throws a surprise birthday party for Cole Sprouse.