   []
   (aget js/window "ModulesMap"))
 
+(defn- get-module-name-from-module-code
+  "Given a module code, returns the name of the module"
+  [moduleCode]
+  (let [modulesMap (get-ModulesMap)]
+    (get-in modulesMap [moduleCode "name"])))
+
+(defn- get-module-lesson-groups-map
+  "Retrieves the map of lesson group strings to vector of lessons"
+  [moduleCode lessonType]
+  (let [modulesMap (get-ModulesMap)]
+    (get-in modulesMap [moduleCode "lessons" lessonType])))
+
+(defn- module-lesson-type-has-multiple-choices?
+  "Given a module code and a long form lesson type, determines if there are
+   multiple choices of lesson groups for that lesson type (eg. multiple
+   tutorial choices for a module)."
+  [moduleCode lessonType]
+  (let [lessonGroupsMap (get-module-lesson-groups-map moduleCode lessonType)]
+    (> (count lessonGroupsMap) 1)))
+
+(defn- get-all-lesson-types-for-module
+  "Returns a sequence of strings, where each string is a long form lesson type
+   for a module."
+  [moduleCode]
+  (let [modulesMap (get-ModulesMap)]
+    (keys (get-in modulesMap [moduleCode "lessons"]))))
+
+(defn- get-all-lesson-group-strings
+  "Given a module and a lesson type, returns a sequence of all its lesson
+   group strings."
+  [moduleCode lessonType]
+  (let [lessonGroupsMap (get-module-lesson-groups-map moduleCode lessonType)]
+    (keys lessonGroupsMap)))
+
+(defn- get-first-lesson-group-for-module-lesson-type
+  "Given a module and a lesson type, retrieves the 'first' lesson group string
+   for that module.
+   This is used for selecting a random lesson group for a lesson type of a
+   module."
+  [moduleCode lessonType]
+  (first (get-all-lesson-group-strings moduleCode lessonType)))
+
+(defn- module-has-lesson-group?
+  "Given a module code, a lesson type, and a lesson group, determines if the
+   module has such a lesson group."
+  [moduleCode lessonType lessonGroup]
+  (let [lessonGroupsMap (get-module-lesson-groups-map moduleCode lessonType)]
+    (not (nil? (get lessonGroupsMap lessonGroup)))))
+
 (def ^{:doc     "Width in pixels of a half hour timeslot"
        :private true
        }


                ; Only lesson types with more than 1 option of lesson group
                ; will be draggable
                (if (> (count (get-in ModulesMap [moduleCode "lessons"
                                                  lessonType]))
                       1)
                    (make-added-lessons-draggable $divElemSeq moduleCode
                                                  lessonType lessonLabel
                                                  bgColorCssClass)))

   NOTE: This function should only be called by
         `add-module-lesson-groups-from-url-hash!`"
  [moduleInfoSeq]
  (let [moduleLessonGroupsMap
        (reduce (fn [lgMap modInfo]
                  ; Replaces earlier lesson groups with later ones if we
                  ; encounter a duplicate lesson type
