Skip to content

Commit 05ecd67

Browse files
committed
Update readme
1 parent 93d8a29 commit 05ecd67

File tree

5 files changed

+48
-6
lines changed

5 files changed

+48
-6
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Call Event Parser
2+
3+
## Introduction
4+
5+
This application processes sets of call data in a specific CSV format. The data is read, validated and then uploaded to a database. Once a file has been successfully processed it moved to a process directory. Any records that can not be processed form files are logged to the syslog.
6+
7+
This project is designed to be run as a back ground task.
8+
9+
## Config
10+
11+
The project is a CLI application and requires 9 arguments to be run. The variables that can be configured are:
12+
13+
- Database Username
14+
- Database Password
15+
- Database Host
16+
- Database Port
17+
- Database Name
18+
- Database Table
19+
- Process directory path (Where files will be moved when processed)
20+
- Upload directory path (Directory where incoming cvs files are located)
21+
- File running path (Path to a temport file that stops this application running in more than one process at a time)
22+
23+
24+
## Build and Run
25+
26+
To build this project run the following in the root of the project
27+
28+
`go install`
29+
30+
from you $GOPATH/bin directory run the application passingin the arguments
31+
32+
`./call-event-parser username password host port db_name db_table "./processed/" "./uploaded" "/tmp/call_event_parse_running"`
33+
34+
35+
### Things to note
36+
37+
The processed directory argument must include a '/' at the end. This is a bug that needs to be resolved. Make sure the application as read/write access to the `File running path` location.
38+
39+
40+
## Tests
41+
42+
This project contains test which can be run from the project root using
43+
44+
`go test ./...`

call-event-file.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const (
1818

1919
type CallEventFile struct {
2020
filenamePath string
21-
validData [][]string // Record
22-
recordErrors []string // LogMessage
21+
validData [][]string
22+
recordErrors []string
2323
numberOfRecords int
2424
}
2525

@@ -128,7 +128,6 @@ func CreateCallEventFileFromRaw(rawData [][]string, filepath string) CallEventFi
128128
}
129129

130130
func removeHeader(rawCsv [][]string) [][]string {
131-
// untested
132131
if len(rawCsv) > 0 {
133132
return rawCsv[1:]
134133
}

call-event-parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
type callEventParser struct {
12-
processLockFile string // MK rename this
12+
processLockFile string
1313
processedDirectory string
1414
store callEventStore
1515
}

call-event-store.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ func (s *MySqlCallEventStore) Create(file CallEventFile) error {
9696
return err
9797
}
9898

99-
// table from s.table
10099
insertTemplate := "INSERT INTO %s(event_date_time, event_action, call_ref, event_value, event_currency_code) VALUES "
101100
query := fmt.Sprintf(insertTemplate, s.table)
102101
vals := []interface{}{}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func main() {
1616
args := os.Args[1:]
1717

1818
if !validArgs(args) {
19-
log("In valid command line arguments 8 required")
19+
log("In valid command line arguments 9 required")
2020
os.Exit(0)
2121
}
2222

0 commit comments

Comments
 (0)