{"id":27382018,"url":"https://github.com/phils0/cifparser","last_synced_at":"2025-04-13T15:17:05.625Z","repository":{"id":35096901,"uuid":"169283417","full_name":"Phils0/CifParser","owner":"Phils0","description":".Net Standard 2.0 Library to parse a CIF formatted UK rail timetable","archived":false,"fork":false,"pushed_at":"2024-02-07T10:16:06.000Z","size":2233,"stargazers_count":1,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T15:17:05.362Z","etag":null,"topics":["c-sharp","library","netstandard20"],"latest_commit_sha":null,"homepage":"","language":"C#","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/Phils0.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-05T17:39:40.000Z","updated_at":"2024-05-20T13:49:02.000Z","dependencies_parsed_at":"2023-11-08T13:28:06.461Z","dependency_job_id":"33c46d28-18a9-4284-8478-e692790c1071","html_url":"https://github.com/Phils0/CifParser","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phils0%2FCifParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phils0%2FCifParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phils0%2FCifParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phils0%2FCifParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Phils0","download_url":"https://codeload.github.com/Phils0/CifParser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732484,"owners_count":21152852,"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":["c-sharp","library","netstandard20"],"created_at":"2025-04-13T15:17:04.470Z","updated_at":"2025-04-13T15:17:05.619Z","avatar_url":"https://github.com/Phils0.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CifParser\nA .Net Standard 2.0 Library to parse a CIF formatted UK rail timetable.  Can read both the Network Rail Open Data format and the RDG Format, both DTD and TTIS archives.\n\n![Build](https://github.com/phils0/CifParser/actions/workflows/build.yml/badge.svg)\n![Package](https://github.com/phils0/CifParser/actions/workflows/package.yml/badge.svg)\n\n## How do I read a CIF archive?\n\nInstantiate an Archive, create a Parser and Read to be returned an enumeration of CIF records.  Records are returned in the order they appear in the file.\n\n```\nvar archive = new Archive(file, logger);\nvar parser = archive.CreateCifParser();\nvar records = parser.Read();\n```\n\n## Grouping Schedule records.\n\nBy default a set of schedule records are grouped together into a `Schedule`.\nA schedule comprises a list of records in order:\n* A `ScheduleDetails` record (BS)\n* A `ScheduleDetailsExtraData` record (BX)\n* An `OriginLocation` record (LO)\n* Zero or more `IntermediateLocation` records (LI) in journey sequence\n* Possibly `ScheduleChange` record(s) (CR).  These proceed the location record where the change occurs\n* A `TerminalLocation` record (LT)\n\n```\n// To read an indivdual schedule\nvar schedule = records.OfType\u003cSchedule\u003e().First();\nforeach(var scheduleRecord in schedule.Records)\n{\n\t...\n}\n```\n\nwhere a record is not part of a schdule e.g. `Association` it is immediately returned.\n\n## RDG (DTD or TTIS) Zip Archives.\n\nRDG zip archives contain a cif file (.mca) plus additional data files.  The CIF parser will process the CIF file.  It will set the RetailServiceId in the BX record that is additionally provided by the RDG format.  \n\nThe additional files are a work in progress, currently only the master station file (.msn) is handled.\n\n```\nvar archive = new Archive(file, logger);\nvar parser = archive.CreateParser();\nvar records = parser.ReadFile(RdgZipExtractor.StationExtension);\n```\n\n## Implementation Details, why return `IEnumerable\u003cICifRecord\u003e`?\n\nIt reads the CIF file record by record, yielding to the client once it has constructed a record.  This means it does not need to hold the whole set of records in memory at any time.\n\nThe implementation uses the [FileHelpers](https://www.filehelpers.net/) package to do most of the heavy lifting to acheive this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphils0%2Fcifparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphils0%2Fcifparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphils0%2Fcifparser/lists"}