{"id":18296549,"url":"https://github.com/fiedsch/quancept-log-parser","last_synced_at":"2025-04-09T08:43:47.406Z","repository":{"id":62504493,"uuid":"120729834","full_name":"fiedsch/quancept-log-parser","owner":"fiedsch","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-12T05:12:09.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T10:08:54.363Z","etag":null,"topics":["logfile","parsing-library","quancept"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fiedsch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-08T08:00:09.000Z","updated_at":"2018-07-12T05:12:11.000Z","dependencies_parsed_at":"2022-11-02T12:31:09.030Z","dependency_job_id":null,"html_url":"https://github.com/fiedsch/quancept-log-parser","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiedsch%2Fquancept-log-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiedsch%2Fquancept-log-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiedsch%2Fquancept-log-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiedsch%2Fquancept-log-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fiedsch","download_url":"https://codeload.github.com/fiedsch/quancept-log-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008555,"owners_count":21032553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logfile","parsing-library","quancept"],"created_at":"2024-11-05T14:41:37.252Z","updated_at":"2025-04-09T08:43:47.385Z","avatar_url":"https://github.com/fiedsch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parse Quancept CATI log files\n\nQuancept generates log files. Among these are `accounts.sms` and `\u003cprojectname\u003e.qca`.\n\nThis library provides classes that help to make parsing these files easier.\n\nThis is Work in Progress. If you find something missing or wrong, please consider \nopening an issue or even better make a pull request.\n\n## Usage \n\n### Installation\n\n```bash\ncomposer require \"fiedsch/quancept-log-parser \u003cversion\u003e\"\n```\n\nwhere `\u003cversion\u003e` is a versionstring like `0.2.0`.   \n\n### Example one parse `accounts.sms`\n\n```php\nrequire __DIR__ . \"/vendor/autoload.php\";\n\nuse Fiedsch\\Data\\File\\FixedWidthReader;\nuse Fiedsch\\Data\\File\\Helper;\nuse Fiedsch\\Quancept\\Logs\\Accounts;\n\n$input = \"/path/to/your/accounts.sms\";\n\n// the columns to be read from $input into our data array\n\n$columns = [\n    'interviewer' =\u003e ['from' =\u003e Accounts::INTERVIEWER_FROM, 'to' =\u003e Accounts::INTERVIEWER_TO],\n    'kex'         =\u003e ['from' =\u003e Accounts::RECORD_KEY_FROM,  'to' =\u003e Accounts::RECORD_KEY_TO],\n    'timestried'  =\u003e ['from' =\u003e Accounts::TIMESTRIED_FROM,  'to' =\u003e Accounts::TIMESTRIED_TO],\n    'start_day'   =\u003e ['from' =\u003e Accounts::START_DATE_FROM,  'to' =\u003e Accounts::START_DATE_TO],\n    'start_time'  =\u003e ['from' =\u003e Accounts::START_TIME_FROM,  'to' =\u003e Accounts::START_TIME_TO],\n    'duration'    =\u003e ['from' =\u003e Accounts::DURATION_FROM,    'to' =\u003e Accounts::DURATION_TO],\n    'tipcode'     =\u003e ['from' =\u003e Accounts::TIPCODE_FROM,     'to' =\u003e Accounts::TIPCODE_TO],\n    'exitcode'    =\u003e ['from' =\u003e Accounts::EXITCODE_FROM,    'to' =\u003e Accounts::EXITCODE_TO],\n    'queuename'   =\u003e ['from' =\u003e Accounts::QUEUENAME_FROM,   'to' =\u003e Accounts::QUEUENAME_TO],\n];\n\n// read file line by line\n\n$reader = new FixedWidthReader($input, $columns);\n\n$aggregated = [];\n\nwhile (($line = $reader-\u003egetLine(FixedWidthReader::SKIP_EMPTY_LINES)) !== null) {\n    // trim all data as they might contain surrounding spaces\n    $data = array_map(function($el) { return trim($el); }, $line);\n    // ignore lines generated by the QTS dialer with no interviewer interaction\n    if ($data[0] === Accounts::AGENT_QTS) { continue; }\n    // reorganize our data array such that the array keys are the names in $columns\n    $data = Helper::setArrayKeys($data, array_keys($columns));\n    // change numeric value to label\n    if (isset(Accounts::EXITCODES[$data['exitcode']])) {\n        $data['exitcode'] = Accounts::EXITCODES[$data['exitcode']];\n    }\n    // do something with $data here (e.g. aggregate values in $aggregated) \n    // Fit to your needs!\n}\n```\n\n## Helpers\n\n### QcaResults\n\n```php\n$results = new QcaResults();\n// read lines of the `*.qca` file into $data\n// for every line do:\n    $results-\u003eaddInterviewerRecord($data[Qca::USERNAME], $data);\n    $results-\u003eaddDayRecord(date(\"ymd\", $data[Qca::INTERVIEWSTARTTIMESTAMP]), $data);\n```\n\n### AccountsResults\n\n```php\n$results = new AccountsResults();\n// read lines of the `accounts.sms` file into $data\n// for every line do:\n    $results-\u003eaddInterviewerRecord($data[AccountsResults::INTERVIEWER], $data);\n    $results-\u003eaddDayRecord($data[AccountsResults::START_DAY], $data);\n```\n\n### Aggregation of QcaResults and AccountsResults\n\n* TODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiedsch%2Fquancept-log-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiedsch%2Fquancept-log-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiedsch%2Fquancept-log-parser/lists"}