I have to write a program to modify a payphone call class recorded in call detail records. It is about 60,000 records a day.
So I think performance is important. I have to parse a log file using TjvCsvDataSet (JEDI) and create CSV file ready for MS SQL bulk insert. The original call class are:-
1 - Local Call
2 - STD (National Call)
4 - Bordering Call (Nearby Countries)
5 - Mobile Call
Payphone System is sometime classify incorrect class like 0,3,6 call class. I have to correct it. As the same time, I have to do a deeper classification for class 2.
21 - Other call (begin with Non zero digit except 1234 )
22 - STD, to fixed line (begin with these 02, 032, 032, 034, 035, 036, 037, 053, 054, 056, 074, 075, 076, 077
222- STD, VoIP to fixed line (begin with 1234+prefix in 22 class)
225 - STD, VoIP to mobile (begin with 1234 + prefix of 01, 06, 09, 033, 03, 055, 057, 071, 078, 079) all prefixes which are not for fixed line will be assigned to Mobile.
4- Bordering call start with 007+Country Code+Destination number
I know that to get a best performance I have to reduce a number of checking. May be I have to sort these digit in length and start comparation from one digit .... if found then I look for a call class. As I have to copy substring from Dialed Number in Call Detail Record, Any Idea? For example
Dialed number = '1234015558950' (original call class = 2, new = 225)
Normally Dialed number length = 9, Length <= 9 should be 21, > 9 should be 222, 225 or 4
If any one know the technique used in payphone or exchange please recommend. I want to know algorithm for best speed not size of program. Only suggestion or Idea is ok.