A. Make a copy of the mysql DB
B. Clean up the data
- subtopics table - remove all rows with stage!=1
- cells table - remove all rows with subtopic_id that doesn't exist in subtopics table
- cells_to_phrases table - remove all rows with cell_id that doesn't exist in cells table
- phrases table - remove all rows with phrase_id that doesn't exist in cells_to_phrases table
- phrase_distractors table- remove all rows with phrase_id that doesn't exist in phrases table
- blank_answers table - remove all rows with phrase_id that doesn't exist in phrases table
- blank_distractors table - remove all rows with blank_id that doesn't exist in blank_answers table
- cells_comprehension table - remove all rows with cell_id that doesn't exist in cells table
- comprehension table - remove all rows with comprehension_id that doesn't exist in cells_comprehension table
- comprehension_distractors table - remove all rows with comprehension_id that doesn't exist in comprehension table.
C. Dump the result into an sqlite file on the server
D. Refresh cloud front server via their api.