JAMB registration numbers ************************* :doctest: JAMB data is stored in a JAMBDataTable. We can import JAMB registration data from a regular CSV file: >>> datafile = 'jambsample.csv' >>> open(datafile, 'wb').write( ... '''reg_no,fst_sit_fname,lastname,firstname,middlenames,sex,date_of_birth,jamb_state,jamb_lga,course1,screening_date,screening_venue,entry_session,screening_type ... 91100546DD,ISUOSUO MOSES ODOMERO,ISUOSUO,MOSES,ODOMERO,M,25/5/1982,DEL,ISO-S,BSCPOL,2009/09/25 09:00:00 GMT+1,REPRINT SLIP AS FROM WED 23/09/2009,9,pde ... 91111834CC,DURUIHEOMA AUGUSTINA ADANNA,DURUIHEOMA,AUGUSTINA,ADANNA,F,15/4/1986,IMO,MBAIT,BSCPOL,2009/09/25 09:00:00 GMT+1,REPRINT SLIP AS FROM WED 23/09/2009,9,pde ... 91109351AC,ARISERE EBIKEBUNA COMFORT,ARISERE,EBIKEBUNA,COMFORT,F,6/1/1984,EDO,OV-SW,BSCPOL,2009/09/25 09:00:00 GMT+1,REPRINT SLIP AS FROM WED 23/09/2009,9,pde ... ''') Now we create a JAMBDataTable and import the data: >>> from waeup.sirp.jambtables import JAMBDataTable >>> table = JAMBDataTable() >>> len(list(table)) 0 >>> table.importFromCSV(datafile) >>> len(list(table)) 3 We can get the entries from the table as an iterator: >>> from pprint import pprint >>> entries = [x for x in table] >>> pprint(entries) [{'course1': u'BSCPOL', 'date_of_birth': datetime.date(1982, 5, 25), 'entry_session': '9', 'firstname': u'MOSES', 'fst_sit_fname': u'ISUOSUO MOSES ODOMERO', 'jamb_lga': u'ISO-S', 'jamb_state': u'DEL', 'lastname': u'ISUOSUO', 'middlenames': u'ODOMERO', 'reg_no': u'91100546DD', 'screening_date': u'2009/09/25 09:00:00 GMT+1', 'screening_type': u'pde', 'screening_venue': u'REPRINT SLIP AS FROM WED 23/09/2009', 'sex': u'M'}, {...}, {...}] We can also get a datetime stamp, that tells, when the table was imported. This could help with maintaining old tables: >>> table.import_datetime datetime.datetime(..., ..., ..., ..., ..., ..., ...) We can delete the table: >>> del JAMBDataTable Clean up: >>> import os >>> os.unlink(datafile)