Getting fountain-mode in Emacs working with imenu-list-mode and writeroom-mode

So I was playing around in Emacs recently [insert obligatory joke here] and saw a working environment that looked kinda like the following:

Emacs fountain-mode with olivetti-mode and imenu-list-minor-mode

I wanted to try it out, but some of the documentation for how to do so was missing. I did some searching around and contacted the people who run that site and was able to get my system to look the same, at least in all the ways that were relevant to me.

So, I wrote it all down, mostly for my own reference later, but maybe you will find it useful too.

My setup: elementary OS v 5.0 (based on Ubuntu 18.04) and Emacs v 25.2.1.

I’m going to assume that the reader knows how to use Emacs as a regular text editor already. There’s a tutorial built into Emacs that is better than what I would write anyway, so if this is your first time using this text editor, I recommend going through it.

Fountain is a markup language for screenwriting. Similar to Markdown, it is unformatted text that many common text editors can parse to apply a simple set of formatting rules. This allows one to focus on writing the story, rather than the details of making sure that Microsoft Word or whatever is correctly applying your stylesheets.

Installing Emacs packages

From inside Emacs, type:

M-x package-install RET fountain-mode RET

This will install the major mode for editing .fountain files. Now, if you open an example .fountain file, it should be parsed with the appropriate markup rules and have syntax-appropriate highlighting and formatting applied.

At this point, you can also already export the .fountain file as a file to be typset by LaTeX into a PDF, or an HTML file to publish online or a couple other formats.

M-x package-install RET olivetti RET

This command will install olivetti-mode, a minor mode which allows one to constrain the width of column in which you’re typing, regardless of the width of the window in which it is contained. This also eliminates distractions in one’s writing environment, as the number of characters you will see across a text file are consistent. This also reduces eye strain, because you can now maximize the window to cover your entire screen without having to follow a line of text that is hundreds of characters long.

M-x package-install RET imenu-list RET

This command installs imenu-list, a plugin that creates an automatically updated index for an Emacs buffer. This will help with navigating your document while you’re editing it.

M-x package-install RET writeroom-mode RET

This command installs a minor mode that makes Emacs go full-screen, and provides a “distraction-free” editing environment.

Installing Courier

Download Courier Prime Emacs, and install on your computer.

To make this work with fountain-mode, go to: Fountain > Customize Faces from the menu bar.

Fountain > Customize Faces in Emacs

This will bring up a page where you can customize the formatting applied in fountain-mode. Scroll down to the first “Fountain face / Default base-level face for ‘fountain-mode’ buffers.” Click on the disclosure triangle to the left of where it says “Fountain” and then click on “Show All Attributes.”

Click the “Font Family” box and then type “Courier Prime Emacs,” then click the “Height” box, change the units to 1/10 pt and enter “120.”

Now click the “State” button and “Save for future sessions.”

When you open fountain-mode, the font will now be 12pt Courier!

Turning these modes on automatically

Right now, fountain-mode should already start automatically when you open a .fountain file, but we want to have olivetti-mode too, as well as an imenu buffer for ease of navigation.

To have fountain-mode start other minor modes when it starts, go to: Fountain > Customize Mode from the menu bar.

Fountain > Customize Mode in Emacs

This will bring up an editor with a lot of options. Scroll down until you find “Fountain Mode Hook / Hook run after entering Fountain mode,” then click the disclosure triangle.

You can uncheck turn-on-visual-line-mode, because this is done by olivetti-mode.

Click the “INS” button and type “olivetti-mode” in the grey text box.

Click “INS” again and type “imenu-list-minor-mode” in the grey text box.

Click “State” and then “Save for future sessions.”

When you’re done editing it, it should look like the following:

Fountain Mode Hook editor

Now when you open a .fountain file, olivetti-mode and imenu-list-minor-mode will start.

I did not tell it to start writeroom-mode automatically, because I personally don’t always want that. If you want to start writeroom-mode, type the following command:

M-x writeroom-mode RET

This will make the current buffer full-screen, and it will hide the imenu buffer. If you want to see the navigation again, the following commands will work:

C-x 3
C-x o
C-x b

The first command listed above splits the window vertically, the second moves the focus to the new window (optional) and the third one prompts you to choose which buffer to switch to.

Type *Ilist* to select the buffer with the scenes and sections menu. Drag the vertical column divider to your liking and enjoy your distraction-free workspace!

But wait, I want to export to PDF

To export your screenplay, Go to Fountain > Export > Buffer to LaTeX.

If your .fountain file is named screenplay.fountain, then it will make a new file in the same directory named screenplay.tex.

LaTeX is not a PDF, but it’s a step in the right direction.

Open the terminal and type the following:

$ sudo apt install texlive-xetex

It will ask for your admin password, and then start installing some software. Once it finishes (it may take a while), in the terminal, navigate to the directory where your .tex file is saved and type the following:

$ xelatex screenplay.tex

This will produce a new file called screenplay.pdf, which will be your printable, final output. Note that section headings (if you used them in your .fountain file, they would have started with #’s) and comments are not included in the final PDF. They are for the writer’s reference only.

Here’s an R function that you can use to download clinical trial data

Sometimes you need to look at a lot of sets of clinical trial data, and you don’t want to go to and do searches manually, then save the files manually, then load them into R or Excel manually to get your work done.


get_ct_dot_gov_data_for_drugname <- function (drugname) {

   temp <- tempfile()

   download.file(paste0("", URLencode(drugname, reserved = TRUE), "&flds=a&flds=b&flds=y"), temp)

   trial_data <- read_delim(
     escape_double = FALSE,
     trim_ws = TRUE


   return (trial_data)


So here’s a function that you can use to download all the trials for a given drug name, and it returns a data frame with the trial metadata.


How to train a Markov chain based on any Star Trek character

Requirements: Linux desktop computer with Python 3

There is a wonderful site that has transcripts for every Star Trek episode ever at (Thank you!) This will be the data source that we will be using for this tutorial. And if you appreciate the work that went into transcribing, there’s a donation button on their site.

In order to reduce the amount of strain that I’m putting on their server, I made a local copy of all their transcripts by scraping their site using the following in the command line:

$ wget -r -np

This step only has to be done once, and now the files are saved locally, we don’t have to keep hitting their server with requests for transcripts. This will get you all the transcripts for DS9, but you could also navigate to, say, the page for TNG and do the same there if you were so inclined.

This produces a directory full of numbered HTML files (401.htm to 575.htm, in the case of DS9) and some other files (episodes.htm and robots.txt) that can be safely discarded.

Make a new directory for your work. I keep my projects in ~/Software/, and this one in particular I put in ~/Software/extract-lines/ but you can keep it wherever. Make a folder called scripts inside extract-lines and fill it with the numbered HTML files you downloaded previously.

Make a new file called with the following Python code inside it:

# Provide the character name you wish to extract as an argument to this script
# Must be upper case (e.g. "GARAK" not "Garak")
# For example:
# $ python3 GARAK

import sys
import os

from html.parser import HTMLParser

class MLStripper(HTMLParser):
    def __init__(self):
        self.strict = False
        self.convert_charrefs= True
        self.fed = []
    def handle_data(self, d):
    def get_data(self):
        return ''.join(self.fed)

def strip_tags(html):
    s = MLStripper()
    return s.get_data()

corpus_file = open(str(sys.argv[1]) + ".txt", "a")

for file_name in os.listdir ("scripts/"):
    script_file = open ("scripts/" + file_name, "r")
    script_lines = script_file.readlines()

    line_count = 0

    for script_line in script_lines:
        extracted_line = ""
        if script_line.startswith(str(sys.argv[1])):
            extracted_line += strip_tags(script_line[len(str(sys.argv[1]))+1:])
            if "<br>" not in script_line and "</font>" not in script_line:
                more_lines = ""
                more_lines_counter = 1
                while "<br>" not in more_lines and "</font>" not in more_lines:
                    more_lines = strip_tags(more_lines) + script_lines[line_count + more_lines_counter]
                    more_lines_counter += 1
                extracted_line += strip_tags(more_lines)
                extracted_line = extracted_line.replace("\n", " ")
            corpus_file.write(extracted_line.strip() + "\n")
        line_count += 1


Back in the command line, go to the extract-lines/ folder, and run the following command:

$ python3 GARAK

This will make a text file called GARAK.txt in the extract-lines/ folder that contains every line spoken by Garak.

Do that for every character whose lines you want to extract. You’ll end up with a bunch of .txt files that you can copy into a new project.

Now, make a new folder. I put mine in ~/Software/more_ds9/.

You’ll need to make a Python virtual environment because whoever invented Python hates you. Run the following in your terminal and don’t think too much about it:

$ cd ~/Software/more_ds9/
$ python3 -m venv env
$ source env/bin/activate
$ pip install markovify

Okay I guess I should explain. What you’ve done is created a little mini-Python installation inside your system’s big Python installation, so that you can install packages just for this project without them affecting anything else. To access this, in the terminal you ran $ source env/bin/activate, and if you want to run your Python code later and have it work, you have to do that first every time. When you’re done with it, just type $ deactivate.

Make a new file in your project directory called with the following Python code in it:

# Usage example:
# $ python3 GARAK

 import sys
 import markovify
 with open ("corpuses/" + str(sys.argv[1]) + ".txt") as corpus_file:
     corpus_text =

# Build the model
 text_model = markovify.Text(corpus_text)

# Generate a sentence
 print(str(str(sys.argv[1]) + ": " + str(text_model.make_sentence())))

Make a new directory called corpuses inside more_ds9 and copy all the text files that you generated in your extract-lines project above.

Go to your command line and type the following:

$ python3 GARAK

It should give you some output like:

GARAK: This time, Intendant, I trust the source, but rest assured I will confirm the rod's authenticity before I say I am.

If you change “GARAK” to any other character whose lines you extracted in the previous project, you will get an output generated by that character. Now you have the tools and data sources to make a Markov chain for any character in any Star Trek series you like!

And if you don’t want to bother with Python and all that, I took this method and built a fedibot that posts “new” Deep Space Nine dialogue using this method once per hour, which you can find here:

Most pediatric approval documents are filed under the wrong date in the Drugs@FDA data files


Research ethics and meta-research depend on reliable data from regulatory bodies such as the FDA. These provide information that is used to evaluate drugs, clinical trials of new therapies, and even entire research programmes. Transparency in regulatory decisions and documentation is also a necessary part of a modern health information economy.

The FDA publishes several data sets to further these ends, including the Drugs@FDA data set, and the Postmarketing Commitments Data set. The Drugs@FDA data set contains information regarding drug products that are regulated by the FDA, submissions to the FDA regarding these products and related application documents, their meta-data and links to the documents themselves.

Errors in these data files may invalidate other meta-research on drug development, and threaten the trust we have in regulatory institutions.


The Drugs@FDA data file was downloaded from the following address, as specified in the R code below:

The version dated 2019 July 16 has been saved to this blog at the following address for future reference, in case the link is changed later on, or the issue reported in the following is addressed:

The following code was run in R:


# Download files from FDA

temp <- tempfile()
download.file("", temp)

# Import Application Docs

 ApplicationDocs <- read_delim(
   unz(temp, "ApplicationDocs.txt"),
   escape_double = FALSE,
   col_types = cols(
     ApplicationDocsDate = col_date(format = "%Y-%m-%d 00:00:00"),
     ApplicationDocsID = col_integer(),
     ApplicationDocsTitle = col_character(),
     ApplicationDocsTypeID = col_integer(),
     SubmissionNo = col_integer()
   trim_ws = TRUE

# Plot Application Docs histogram (Figure 1)

     x = ApplicationDocsDate
   data = ApplicationDocs
 ) + geom_histogram(
   binwidth = 365.25
 ) + labs (
   title = "Histogram of Drugs@FDA application document dates",
   x = "Application document date",
   y = "Number of documents"

# Import Application Docs Types

ApplicationsDocsType_Lookup <- read_delim(
   unz(temp, "ApplicationsDocsType_Lookup.txt"),
   escape_double = FALSE,
   col_types = cols(
     ApplicationDocsType_Lookup_ID = col_integer()
   trim_ws = TRUE

# Delete the downloaded files, as they're no longer necessary


# Merge Application Docs information with Document Types

Application_Docs_With_Types <- merge(
   by.x = "ApplicationDocsTypeID",
   by.y = "ApplicationDocsType_Lookup_ID"

# Restrict to pediatric only

Pediatric_Docs <- subset(
     ApplicationDocsType_Lookup_Description, = TRUE

# Plot Pediatric Application Docs histogram (Figure 2)

     x = ApplicationDocsDate
   data = Pediatric_Docs
 ) + geom_histogram(
   binwidth = 365.25
 ) + labs (
   title = "Histogram of Drugs@FDA application document dates (pediatric only)",
   x = "Application document date",
   y = "Number of documents"

These data were analyzed using R version 3.6.1 (2019-07-05)¹ and plotted using the ggplot2 package.²


There are a total of 57,495 application documents published in the Drugs@FDA data files, with dates ranging from 1900-01-01 to 2019-07-16, the date the data set was published, see Figure 1.

Figure 1. Number of FDA application documents published over time

The histogram shows a spike of 1404 application documents at the year 1900, followed by an absence of FDA application documents between 1900 and 1955. There is a steady increase in the number of application documents starting in the 1990’s until the present day. All of the application documents that comprise that spike in the year 1900 are dated exactly 1900-01-01.

These 1404 application documents dated 1900-01-01, all have an application document type that includes the term “pediatric.” (“Pediatric Addendum,” “Pediatric Amendment,” “Pediatric CDTL Review,” “Pediatric Clinical Pharmacology Addendum,” etc.)

Among the 57,495 published Drugs@FDA application documents, there are a total of 1666 documents whose application document type includes the term “pediatric,” only 262 of which are dated after 1900-01-01, see Figure 2.

Figure 2. Number of FDA application documents with a pediatric document type published over time


These data suggest that most of the FDA application documents that have pediatric document types—1404 distinct documents (84% of pediatric application documents and 2% of all documentation published in the Drugs@FDA data files) have an inaccurate date.

This may have arisen from a data entry error in which unknown dates were marked with “00” and that was interpreted by the FDA software as “1900.” These errors may have gone un-noticed because the website that interprets the Drugs@FDA data set does not display dates for individual documents, although these are reported in the downloadable data file. These errors become apparent when FDA data are included in other software, such as Clinical trials viewer

The potential errors reported here can be corrected by manually extracting the dates from the linked PDF documents and entering them in the Drugs@FDA database back-end.

Swiftly correcting errors can help maintain trust in regulatory instutions’ databases; help ensure the quality of meta-research; aid in research ethics, and provide transparency.


  1. R Core Team (2019). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL
  2. H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016.
  3. Carlisle BG. Clinical trials viewer [Internet]. Retrieved from The Grey Literature; 2019. Available from:

Introducing: Clinical trials viewer

The development of a new drug is often depicted as an orderly, linear progression from small, phase 1 trials testing safety to somewhat larger phase 2 trials to generate efficacy hypotheses, and finally larger phase 3 pivotal trials. It is even described as a “pipeline,” and even depicted as such in pharmacology lectures and textbooks.

However, the reality of clinical trial activity is much more complicated. For example, a clinical trial does not occur all on a single date, but rather is extended in time, often overlapping with trials in later or earlier phases. Earlier phase trials can sometimes follow higher ones, and intermediary phases can sometimes be skipped altogether. Trial activity often continues after licensure, and grasping the amount of research, along with all the meta-data available can be difficult.

To illustrate the totality of registered clinical trial activity reported on, the STREAM research group at McGill University has been using Clinical trials viewer as an internal research tool since 2012. This software is now available for others to use, install on their own servers, or modify (under the constraint that you make the source code for any modifications available, as per the AGPL).


Clinical trials viewer downloads and parses information from at the time of search to populate the graph of clinical trials. FDA information is updated weekly from the Drugs@FDA dataset and the FDA postmarketing commitment data set.

Yellow flags indicating the dates for FDA submissions appear flattened along the top of the grid. Red flags indicating the dates for FDA documents also appear flattened in the FDA information section. Cyan flags indicating the original projected completion date for FDA postmarketing commitments (PMCs) and requirements (PMRs) also appear here. PMCs and PMRs can be clicked to reveal more details. There are buttons to expand or flatten each of these categories.

Below the horizontal rule, there is a graph aligned to the same horizontal date scale indicating the opening and closure dates for clinical trials registered with the NLM clinical trial registry. By default these are sorted by start date, but they can be sorted according to other meta data. Each trial can be clicked to reveal more information.

There are two boxes at the left. The top box contains buttons for customizing the display of information. The bottom box contains a table for all the products found in the FDA database that match the search term provided, sorted by NDA. This application number will also appear on all the FDA submissions, documents and PMCs/PMRs.

How do I use it?

Visit for a live version of Clinical trials viewer.

Type the name of a drug into the search field and press enter or click the search button. This will bring up a graph of clinical trial data retrieved from, along with FDA submissions, FDA documents and postmarketing commitments and requirements.

Can I install it on my own server?

Yes, and if you intend to be using it a lot, I recommend that you do, so that you don’t crash mine! I have provided the source code, free of charge, and licensed it under the AGPL. This means that anyone can use my code, however, if you build anything on it, or make any modifications to the code, you are obliged to publish your changes.


Clinical trials viewer was built for installation on a LAMP stack using Bootstrap v 4.3.1, and jQuery v 3.4.1.

Clinical trials viewer draws data to populate its graphs from the following sources:, Drugs@FDA, FDA PMC Download.

Clinical trials viewer was originally designed for use by the STREAM research group at McGill University in Montreal Canada to work on the Signals, Safety and Success CIHR grant.

There’s another reason why Pfizer actually did the right thing with Enbrel in Alzheimer’s

The Washington Post recently ran a story about a potential use of Enbrel, an anti-inflammatory drug, to reduce the risk of Alzheimer’s disease. The article reports that a non-randomized, non-interventional, retrospective, non-published, non-peer-reviewed, internal review of insurance claims was correlated with a reduced risk for Alzheimer’s disease. This hypothesis was dismissed after internal consideration, on the basis of scientific (and probably business) considerations.

You can probably guess my take on it, given the way I describe it, but for people who are unfamiliar with the hierarchy of medical evidence, this kind of data mining represents pretty much the lowest, most unreliable form of medical evidence there is. If you were, for some reason, looking for even lower-level evidence than this, you would need to go into the case study literature, but even that would at least be peer-reviewed and published for public scrutiny. If you need further convincing, Derek Lowe has already published a fairly substantial debunking of why this was not a missed Alzheimer’s opportunity on his blog.

Many people, even after being convinced that Pfizer probably made the right call in not pursuing a clinical trial of Enbrel in Alzheimer’s, still think that the evidence should have been made public.

There’s been lots of opinions thrown around on the subject, but there’s one point that people keep missing, and it relates to a paper I wrote in the British Medical Journal (also the final chapter of my doctoral thesis). Low-level evidence that causes suspicion of activity of a drug, when it is not swiftly followed up with confirmatory testing, can create something that we call “Clinical Agnosticism.”

Not all evidence is sufficient to guide clinical practice. But in the absence of a decisive clinical trial, well-intentioned physicians or patients who have exhausted approved treatment options may turn to off-label prescription of approved drugs in indications that have not received regulatory sanction. This occurs where there is a suggestion of activity from exploratory trials, or in this case, extremely poor quality retrospective correlational data.

Pfizer should not be expected to publish every spurious correlation that can be derived from any data set. In fact, doing so would only create Clinical Agnosticism, and potentially encourage worse care for patients.

On techbros in healthcare and medical research

My thoughts on the following may change over time, but at least for me, I have found it helpful to think about the threats that techbros pose to healthcare and medical research in terms of the following four major categories. These aren’t completely disjoint of course, and even the examples that I give could, in many cases, fit under more than one. I am also not claiming that these categories exhaust the ways that techbros pose a threat to healthcare.

1. Medical-grade technosolutionism, or “medicine plus magic”

When Elizabeth Holmes founded her medical diagnostics company Theranos, she fit exactly into the archetype that we all carry around in our heads for the successful whiz-kid tech-startup genius. She was not just admitted to Stanford University, but she was too smart for it, and dropped out. She wore Steve Jobs-style black turtlenecks. She even founded her company in the state of California—innovation-land.

She raised millions of dollars for her startup, based on the claim that she had come up with a novel method for doing medical diagnostics—dozens of them—from a single drop of blood. Theranos claimed that the research backing up these claims occurred outside the realm of peer-review. This practice was derisively called “stealth research,” and generally criticized because of the threat that this mode of innovation might have posed to the enterprise of medical research as a whole.

It was, of course, too good to be true. The company has now been shut down, and Theranos has been exposed as a complete fraud. This sort of thing happens on a smaller scale on crowdfunding sites with some regularity. (Remember the “Healbe” Indiegogo?)

While I’m not entirely sure what is driving this particular phenomenon, I have a few pet theories. For starters, we all want to believe in the whiz-kid tech-startup genius myth so much that we collectively just let this happen out of sheer misguided hope that the techbros will somehow get it right. And on some level, I understand that impulse. Medical research progress is slow, and it would be wonderful if there actually were a class of smart and talented geniuses out there who could solve it by just applying their Apple Genius powers to the matter. Alas, it is not that easy.

And unfortunately, there is a certain kind of techbro who does think like that: “I’m a computer-genius. Medicine is just a specialized case that I can just figure out if I put my mind to it.” And there’s also a certain kind of medical professional who thinks, “I’m a doctor. I can figure out how to use a computer, thank-you-very-much.” And when those two groups of people intersect, sometimes they don’t call each other out on their lack of specialized knowledge, but rather, they commit synergy.

And worse, all this is happening under an extreme form of capitalism that has poisoned our minds to the extent that the grown-ups—the people who should know better—are turning a blind eye because they can make a quick buck.

Recommended reading: “Stealth Research: Is Biomedical Innovation Happening Outside the Peer-Reviewed Literature?” by John Ioannidis, JAMA. 2015;313(7):663-664.

2. The hype of the week (these days, it’s mostly “medicine plus blockchain”)

In 2014 I wrote a post on this very blog that I low-key regret. In it, I suggest that the blockchain could be used to prospectively timestamp research protocols. This was reported on in The Economist in 2016 (they incorrectly credit Irving and Holden; long story). Shortly thereafter, there was a massive uptick of interest in applications of the blockchain to healthcare and medical research. I’m not claiming that I was the first person to think about blockchain in healthcare and research, or that my blog post started the trend, but I am a little embarrassed to say that I was a part of it.

Back in 2014, being intrigued by the novelty of the blockchain was defensible. There’s a little bit of crypto-anarchist in all of us, I think. At the time, people were just starting to think about alternate applications for it, and there was still optimism that the remaining problems with the technology might still be solved. By 2016, blockchain was a bit passé—the nagging questions about its practicality that everyone thought would have been solved by that point just, weren’t. Now that it’s 2019, and the blockchain as a concept has been around for a full ten years, and I think it’s safe to say that those solutions aren’t coming.

There just aren’t any useful applications for the blockchain in medicine or science. The kinds of problems that medicine and science have are not the kinds of problems that a blockchain can solve. Even my own proposed idea from 2014 is better addressed in most cases by using a central registry of protocols.

Unfortunately, there continues to be well-funded research on blockchain applications in healthcare and science. It is a tech solution desperately in search of its problem, and millions of research funding has already been spent toward this end.

This sort of hype cycle doesn’t just apply to “blockchain in science” stuff, although that is probably the easiest one to spot today. Big new shiny things show up in tech periodically, promising to change everything. And with surprising regularity, there is an attempt to shoehorn them into healthcare or medical research.

It wasn’t too long ago that everyone thought that smartphone apps would revolutionize healthcare and research. (They didn’t!)

3. “The algorithm made me do it”

Machine learning and artificial intelligence (ML/AI) techniques have been applied to every area of healthcare and medical research you can imagine. Some of these applications are useful and appropriate. Others are poorly-conceived and potentially harmful. Here I will gesture briefly toward some ways that ML/AI techniques can be applied within medicine or science to abdicate responsibility or bolster claims where the evidence is insufficient to support them.

There’s a lot of problems that could go under this banner, and I’m not going to say that this is even a good general overview of the problems with ML/AI, but many of these major problems stem from the “black box” nature of ML/AI techniques, which is a hard problem to solve, and it’s almost a constitutive part of what a lot of ML/AI techniques are.

The big idea behind machine learning is that the algorithm “teaches itself” in some sense how to interpret the data and make inferences. And often, this means that many ML/AI techniques don’t easily allow for the person using them to audit the way that inputs into the system are turned into outputs. There is work going on in this area, but ML/AI often doesn’t lend itself well to explaining itself.

There is an episode of Star Trek, called “The Ultimate Computer,” in which Kirk’s command responsibilities are in danger of being given over to a computer called the “M-5.” As a test of the computer, Kirk is asked who he would assign to a particular task, and his answer differs slightly from the one given by the M-5. For me, my ability to suspend disbelief while watching it was most thoroughly tested when the M-5 is asked to justify why it made the decision it did, and it was able to do so.

I’ve been to the tutorials offered at a couple different institutions where they teach computer science students (or tech enthusiasts) to use the Python library for machine learning or other similar software packages. Getting an answer to “Why did the machine learning programme give me this particular answer?” is really, really hard.

Which means that potential misuses or misinterpretations are difficult to address. Once you get past a very small number of inputs, there’s rarely any thought given to trying to figure out why the software gave you the answer it did, and in some cases it becomes practically impossible to do so, even if you wanted to.

And with the advent of “Big Data,” there is often an unspoken assumption is that if you just get enough bad data points, machine learning or artificial intelligence will magically transmute them into good data points. Unfortunately, that’s not how it works.

This is dangerous because the opaque nature of ML/AI may hide invalid scientific inferences based on analyses of low-quality data, causing well-meaning researchers and clinicians who rely on robust medical evidence to provide poorer care. Decision-making algorithms may also mask the unconscious biases built into them, giving them the air of detached impartiality, but still having all the human biases of their programmers.

And there are many problems with human biases being amplified while at the same time being presented as impartial through the use of ML/AI, but it’s worth mentioning that these problems will of course harm the vulnerable, the poor, and the marginalized the most. Or, put simply: the algorithm is racist.

Techbros like Bill Gates and Elon Musk are deathly afraid of artificial intelligence because they imagine a superintelligent AI that will someday, somehow take over the world or something. (I will forego an analysis of the extreme hubris of the kind of person who needs to imagine a superhuman foe for themselves.) A bigger danger, and one that is already ongoing, is the noise and false signals that will be inserted into the medical literature, and the obscuring of the biases of the powerful that artificial intelligence represents.

Recommended reading: Weapons of Math Destruction by Cathy O’Neil.

4. Hijacking medical research to enable the whims of the wealthy “… as a service”

I was once at a dinner party with a techbro who has absolutely no education at all in medicine or cancer biology. I told him that I was doing my PhD on cancer drug development ethics. He told me with a straight face that he knew what “the problem with breast cancer drug development” is, and could enlighten me. I took another glass of wine as he explained to me that the real problem is that “there aren’t enough disruptors in the innovation space.”

I can’t imagine being brazen enough to tell someone who’s doing their PhD on something that I know better than them about it, but that’s techbros for you.

And beyond the obnoxiousness of this anecdote, this is an idea that is common among techbros—that medicine is being held back by “red tape” or “ethical constraints” or “vested interests” or something, and that all it would take is someone who could “disrupt the industry” to bring about true innovation and change. They seriously believe that if they were just given the reins, they could fix any problem, even ones they are entirely unqualified to address.

For future reference, whenever a techbro talks about “disrupting an industry,” they mean: “replicating an already existing industry, but subsidizing it heavily with venture capital, and externalizing its costs at the expense of the public or potential workers by circumventing consumer-, worker- or public-protection laws in order to hopefully undercut the competition long enough to bring about regulatory capture.”

Take, for example, Peter Thiel. (Ugh, Peter Thiel.)

He famously funded offshore herpes vaccine tests in order to evade US safety regulations. He is also extremely interested in life extension research, including transfusions from healthy young blood donors. He was willing to literally suck the blood from young people in the hopes of extending his own life. And these treatments were gaining popularity, at least until the FDA made a statement warning that they were dangerous and ineffective. He also created a fellowship to enable students to drop out of college to pursue other things such as scientific research outside of the academic context. (No academic institution, no institutional review board, I suppose.)

And this is the work of just one severely misguided techbro who is able to make all kinds of shady research happen because of the level of wealth that he has been allowed to accumulate. Other techbros are leaving their mark on healthcare and research in other ways. The Gates Foundation for example, is strongly “pro-life,” which is one of the strongest arguments I can think of, for why philanthropists should instead be taxed and the funds they would have spent on their conception of the public good dispersed through democratic means, rather than allowing the personal opinions of an individual become de facto healthcare policy.

The moral compass behind techbro incursions into medical research is calibrated to a different North than the one most of us recognize. Maybe one could come up with a way to justify any one of these projects morally. But you can see that the underlying philosophy (“we can do anything if you’d just get your pesky ‘ethics’ out of the way”) and priorities (e.g. slightly longer life for the wealthy at the expense of the poor) are different from what we might want to be guiding medical research.

Why is this happening and what can be done to stop it?

Through a profound and repeated set of regulatory failures, and a sort of half-resigned public acceptance that techbros “deserve” on some level to have levels of wealth that are comparable with nation states, we have put us all in the position where a single techbro can pervert the course of entire human research programmes. Because of the massive power that they hold over industry, government and nearly every part of our lives, we have come to uncritically idolize techbros, and this has leaked into the way we think about applications of their technology in medicine and science. This was all, of course, a terrible mistake.

The small-picture solution is to do all the things we should be doing anyway: ethical review of all human research; peer-review and publication of research (even research done with private funds); demanding high levels of transparency for applications of new technology applied to healthcare and research; etc. A high proportion of the damage they so eagerly want to cause can probably be avoided if all our institutions are always working at peak performance and nothing ever slips through the cracks.

The bigger-picture solution is that we need to fix the massive regulatory problems in the tech industry that allowed techbros to become wealthy and powerful in the first place. Certainly, a successful innovation in computer technology should be rewarded. But that reward should not include the political power to direct the course of medicine and science for their own narrow ends.

Star Trek Discovery has a problem with tragic gay representation

Content warning: strong language; description of violence; death; abuse; spoilers for seasons 1 and 2 of Star Trek Discovery

I will start by briefly telling you what tragic gay representation is. I will make a case that Star Trek Discovery has provided nearly exclusively tragic gay representation in seasons 1 and 2. I will conclude by telling you why this is a problem.

What do I mean by “tragic gay representation?”

I have written previously about what I have described as different “levels” of queer representation in media. Here I will focus on tragic gay representation, also known as the “bury your gays” trope.

When I talk about “tragic” representation, I don’t necessarily mean cases in which a queer person dies (although that happens often enough). By “tragic gay representation,” I mean representation in which gay characters are denied a happy ending. While this happens to trans and bi queer people as well, I will mostly be talking about gay representation here, as the specific characters involved in Star Trek Discovery are gay and lesbian, and different (but related) dynamics are present for bi and trans representation.

Tragic gay representation has a very long history. Lesbian representation in media is particularly prone to ensuring that lesbians, when they are depicted at all, are either killed, or converted to being straight. Now that you’ve had it pointed out to you, you’ll start seeing it everywhere too.

Of course, no, not every gay character in every TV show and movie dies, and of course, not every character who dies is gay, but there are fewer gays and lesbians on-screen in general, and unless it’s a film about queer issues, the main character Has To Be Straight, so if someone is going to die to advance the plot, you can guess who it’s going to be.

There is tragic gay representation in Star Trek Discovery and it’s nearly exclusively tragic gay representation

In season 1, the first thing we learn about Stamets is that his research has been co-opted by Starfleet for the war effort. The second thing we learn is that he had a friend that he did research with, and in the same episode we also find out that this friend was tragically deformed and then died in terrible pain. In the time-loop episode, Stamets watches everyone he knows and loves die over and over again.

Stamets’ boyfriend Culber is tragically murdered by one of the straight people. His death serves no other purpose in season 1 other than to up the stakes for the straight-people drama. We find out that Stamets’ boyfriend likes something called Kasseelian opera, and the only thing we find out about this kind of opera is that Kasseelian prima donnas tragically kill themselves after a single performance.

In season 2, we find out that Culber is not dead, but rather he has been trapped in the mushroom dimension, but even after they save him, he and Stamets can’t be happy together. Tragic.

Culber’s change into an angry person does however serve as an object lesson for a pep-talk for the straight people partway through the season. And in case you think that I’m reading too much into that, they double down on it by panning over his face while Burnham is giving a voice-over about how she’s personally changed, so they were definitely intentional about him being an object lesson about personal transformation.

At the end of season 2, Culber gets a bunch of unsolicited relationship advice, and guess what, it comes from an even more powerfully tragic lesbian whose partner died. Culber decides to get back together with Stamets, but tragically, he is only able to tell him after Stamets is tragically, heroically and life-threateningly impaled.

There is almost nothing that happens in Stamets and Culber’s story-arc or that we’re told about their back-story that isn’t specifically calculated to just make us feel bad for them. The writers seem to be fine with burning up gay characters, and the people they love, so that by that light, we can better see the straight-people drama.

Why is tragic gay representation in Star Trek a problem?

So you might be thinking, “These aren’t real people. It’s just a story. No gays were harmed in the making of Star Trek Discovery.” Right?

I mean, sort of. No one’s saying it’s as bad as actually hurting gays in real life, but especially in the context of Star Trek, it’s in poor taste, a faux pas, and sends a homophobic message in real life, whether or not it was intended that way.

First off, the whole premise of Star Trek is: “What if, somehow, hundreds of years in the future, humanity finally got its shit together?” The whole project of Star Trek is to imagine an optimistic, near-utopian, positive conception of a humanity that finally grew up.

This is a future where, when you call the cops, it’s the good guys who show up, so to speak. In this fictional universe, Rule 1 of exploring the galaxy can be summed up as, “don’t be like, colonial about it.” There’s no poverty, no racism, no sexism, and for the “first time” (we can have the erasure talk another day), Star Trek Discovery was supposed to pose the question, “What would it look like for there to be a future in which there was also no hate for queer people?”

And this is part of why it’s so toxic to get these old, tired and low-key homophobic tropes tossed at us in Star Trek. The writers are saying, Even in a future utopia, the best-case-scenario for humanity’s future, the gays still don’t ever get to be happy.

Historically, the bury-your-gays trope hasn’t always come out of innocent sloppiness on the writers’ part. Certainly, sometimes when a writer makes a gay into a tragic one, it’s just because they only have so many characters in their story, and the straight one is the protagonist, so out of this sort of lazy necessity, there’s a lot of rainbow-coloured blood spilled. But that hasn’t always been the case. In a lot of literature, the gays come to a sad end in order to send the message that this is what they deserve. And whether or not the writers at Discovery realize this or if they meant to send that message, they are walking in step with that sad and homophobic tradition. You can only watch so many shows where the queer gets killed, after all, before you start to wonder if there’s a message there.

I don’t think this is being too rough on the show. In the lead-up to Discovery season 1, everyone associated with the show positively crowed about how they were going to do gay representation in Star Trek, and do it right. If you’re gonna preemptively claim moral kudos for representing us gays, you’re gonna be held to a higher standard. There are lots of other TV shows that include gay characters that are examples of good gay representation. (E.g. Felix from Orphan Black is fantastic.)

So if anyone from CBS is reading this, Don’t let your PR people write cheques that your writers aren’t going to honour. If you promise good gay representation, you better deliver. Also if you need a new writer, I’m a published author, I’m looking for a job, I have a PhD in medical ethics, encyclopedic knowledge of Star Trek, and Opinions.

The moral efficiency of clinical trials in anti-cancer drug development