 )
 
 (defn gen-section-assoc
-  [districtName schoolName studentName sectionName]
+  [schoolName studentId]
   (element :StudentSectionAssociation {}
-    (student-ref schoolName studentName)
+    (student-ref schoolName studentId)
     (element :SectionReference {}
       (element :SectionIdentity {}
-        (element :StateOrganizationId {} districtName)
-        (element :UniqueSectionCode {} sectionName)
-      )
-    )
-  )
-)
-
-(defn enroll [districtName schoolName studentName]
-  (gen-enroll schoolName studentName)
-  (gen-section-assoc districtName schoolName studentName "Math-7-2011-Sec2")
-)
-
-(defn gen-enrollments
-  [districtName schoolName students section output-file]
+        (element :StateOrganizationId {} schoolName)
+        (element :UniqueSectionCode {}  (format "%s-Math-7-2011-Sec2" schoolName))
+      )
+    )
+    (element :BeginDate {} "2011-09-06")
+    (element :EndDate {} "2011-12-16")
+  )
+)
+
+(defn enroll [schoolName studentId]
+  (gen-enroll schoolName studentId)
+  (gen-section-assoc schoolName studentId)
+)
+
+(defn gen-enrollments [schools rng output-file]
   (gen-edfi :InterchangeStudentEnrollment output-file
-    (for [studentName students]
-      (enroll districtName schoolName studentName)
-    )
-  )
-)
-
-(defn create-session [districtName]
+    (for [schoolName schools]
+      (for [id rng]
+        (enroll schoolName id)
+      )
+    )
+  )
+)
+
+(defn create-session [districtName schoolName]
   (into () [
-    (element :CalendarDate {:id "tmp_day" }
+    (element :CalendarDate {:id (format "%s_day" districtName) }
       (element :Date {} "2011-09-22")
       (element :CalendarEvent {} "Instructional day")
     )
 
-    (element :GradingPeriod {:id "GP1"}
+    (element :GradingPeriod {:id (format "%s-GP1" districtName)}
       (element :GradingPeriodIdentity {}
         (element :GradingPeriod {} "End of Year")
         (element :SchoolYear {} "2011-2012")

)

(defn gen-saas
  [schoolName students assessment n output-file]
  (gen-edfi :InterchangeStudentAssessment output-file
    (for [studentName students, i (range 1 n)]
      (gen-saa schoolName studentName assessment (str "2011-10-" (format "%02d" i)))
    )
  )
)

(defn gen-enroll
  [schoolName student]
  (element :StudentSchoolAssociation {}
    (student-ref schoolName student)
    (element :SchoolReference {}
      (element :EducationalOrgIdentity {}
        (element :StateOrganizationId {} schoolName)


(defn gen-sections [districtName schools output-file]
  (gen-edfi :InterchangeMasterSchedule output-file
    (for [schoolName schools]
      (reverse (create-section districtName schoolName))
    )
  )
)
