source: main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/jambtables/README.txt @ 5235

Last change on this file since 5235 was 5235, checked in by uli, 14 years ago

Add first sketch for JAMB tables.

File size: 1.3 KB
Line 
1JAMB registration numbers
2*************************
3
4:nodoctest:
5
6JAMB data is stored in a JAMBDataTable.
7
8We can import JAMB registration data from a regular CSV file:
9
10    >>> datafile = 'jambsample.csv'
11    >>> open(datafile, 'wb').write(
12    ... '''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
13    ... 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
14    ... 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
15    ... 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
16    ... ''')
17
18Now we create a JAMBDataTable and import the data:
19
20    >>> from waeup.sirp.jambtables import JAMBDataTable
21    >>> table = JAMBDataTable()
22    >>> len(list(table))
23    0
24
25    >>> table.importFromCSV(datafile)
26    >>> len(list(table))
27    3
28
29We can get the entries from the table as an iterator:
30
31    >>> for x in table:
32    ...   print x
33
34
35We can delete the table:
36
37    >>> del JAMBDataTable
38
39Clean up:
40
41    >>> import os
42    >>> os.unlink(datafile)
Note: See TracBrowser for help on using the repository browser.