{
"info": {
"author": "Qian Fu",
"author_email": "qian.fu@outlook.com",
"bugtrack_url": null,
"classifiers": [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only"
],
"description": "# pyrcs\n\n**Author**: Qian Fu [](https://twitter.com/Qian_Fu) \n\n[](https://pypi.org/project/pyrcs/)\n[](https://www.python.org/downloads/)\n[](https://github.com/mikeqfu/pyrcs/blob/master/LICENSE)\n[](https://github.com/mikeqfu/pyrcs/tree/master/pyrcs)\n[](https://pypistats.org/packages/pyrcs)\n\nA small web scraper for collecting railway codes and other data used in the UK rail industry. \n\n\n\n## Installation\n\n```\npip install --upgrade pyrcs\n```\n\n**Note**: \n\n* Make sure you have the most up-to-date version of `pip` installed.\n\n ```\n python -m pip install --upgrade pip\n ```\n\n* `Python-Levenshtein`, one of the dependencies of this package, may fail to be installed on a Windows OS without VC2015 (or above). A workaround is to download and install its [.whl](https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-levenshtein) file. In this case, you should go for `python_Levenshtein-0.12.0-cp37-cp37m-win_amd64.whl` if you're using Python 3.7 on 64-bit OS: \n\n ```\n pip install --upgrade \\path\\to\\python_Levenshtein-0.12.0-cp37-cp37m-win_amd64.whl\n ```\n\n\n\n## Quick start (Examples) \n\nThe following examples may provide a quick guide to the usage of the package.\n\n\n\n### 1. CRS, NLC, TIPLOC and STANOX Codes \n\nIf your preferred import style is `from import `:\n\n```python\nfrom pyrcs.line_data_cls import crs_nlc_tiploc_stanox as ldlc\n```\n\nIf your preferred import style is `import .`:\n\n```python\nimport pyrcs.line_data_cls.crs_nlc_tiploc_stanox as ldlc\n```\n\nAfter importing the module, you can create a 'class' for the location codes (including all CRS, NLC, TIPLOC, STANME and STANOX) :\n\n```python\nlocation_codes = ldlc.LocationIdentifiers()\n```\n\n\n\n***Given different preferences, there are several alternative ways of importing the module.***\n\n***Alternative 1***: \n\n```python\nfrom pyrcs.line_data import crs_nlc_tiploc_stanox as ldlc\nlocation_codes = ldlc.LocationIdentifiers()\n```\n\n***Alternative 2*** (*Preferred and used for the following examples*):\n\n```python\nfrom pyrcs.line_data import LineData\nline_data_cls = LineData() # contains all classes under the category of 'Line data'\nlocation_codes = line_data_cls.LocationIdentifiers\n```\n\n\n\n#### 1.1 Locations beginning with a given letter \n\nYou can get the location codes starting with a specific letter, say 'A' or 'a', by using the method`collect_location_codes_by_initial`, which returns a `dict`. \n\n```python\n# The input is case-insensitive\nlocation_codes_a = location_codes.collect_location_codes_by_initial('A')\n```\n\nThe keys of `location_codes_a` include: \n\n* `'A'`\n* `'Last_updated_date'`\n* `'Additional_note'`\n\nThe corresponding values are:\n\n* `location_codes_a['A']` is a `pandas.DataFrame` that contains the table data. You may compare it with the table on the web page: http://www.railwaycodes.org.uk/crs/CRSa.shtm\n* `location_codes_a['Last_updated_date']` is the date (in `str`) when the web page was last updated\n* `location_codes_a['Additional_note']` is some important additional information on the web page (if available)\n\n\n\n#### 1.2 All available location codes in this category \n\nYou can also get all available location codes in this category as a whole , using the method `fetch_location_codes`, which also returns a `dict`:\n\n```python\nlocation_codes_data = location_codes.fetch_location_codes()\n```\n\nThe keys of `location_codes_a` include: \n\n- `'Location_codes'`\n- `'Latest_updated_date'` \n- `'Additional_note'`\n- `'Other_systems'`\n\nThe corresponding values are:\n\n- `location_codes_data['Location_codes']` is a `pandas.DataFrame` that contains all table data (from 'A' to 'Z')\n- `location_codes_data['Latest_updated_date']` is the latest 'Last_updated_date' (in `str`) among all initial-specific table data\n- `location_codes_data['Additional_note']` is some important additional information on the web page (if available)\n- `location_codes_data['Other_systems']` is a `dict` for [Other systems](http://www.railwaycodes.org.uk/crs/CRS1.shtm)\n\n\n\n### 2. Engineer's Line References (ELRs) \n\n```python\nem = line_data_cls.ELRMileages\n```\n\n\n\n#### 2.1 ELR codes \n\nTo get ELR codes starting with a specific letter, say `'A'`, by using the method `collect_elr_by_initial`, which returns a `dict`. \n\n```python\nelr_a = em.collect_elr_by_initial('A') # em.collect_elr_by_initial('a')\n```\n\nThe keys of `elr_a` include: \n\n- `'A'`\n- `'Last_updated_date'`\n\nThe corresponding values are:\n\n- `elr_a['A']` is a `pandas.DataFrame` that contains the table data. You may compare it with the table on the web page: http://www.railwaycodes.org.uk/elrs/elra.shtm\n- `elr_a['Last_updated_date']` is the date (in `str`) when the web page was last updated\n\nTo get all available ELR codes, by using the method `fetch_elr`, which returns a `dict`:\n\n```python\nelr_codes = em.fetch_elr()\n```\n\nThe keys of `elr_codes` include: \n\n- `'ELRs_mileages'`\n- `'Latest_updated_date'`\n\nThe corresponding values are:\n\n- `elr_codes['ELRs_mileages']` is a `pandas.DataFrame` that contains all table data (from 'A' to 'Z')\n- `elr_codes['Latest_updated_date']` is the latest 'Last_updated_date' (in `str`) among all initial-specific table data\n\n\n\n#### 2.2 Mileage files \n\nTo collect more detailed mileage data for a given ELR, say `'AAM'`, by using the method `fetch_mileage_file`, which returns a `dict`:\n\n```python\nem_amm = em.fetch_mileage_file('AAM')\n```\n\nThe keys of `em_amm` include: \n\n- `'ELR'`\n- `'Line'`\n- `'Sub-Line'`\n- `'AAM'`\n\nThe corresponding values are:\n\n- `em_amm['ELR']` is the name (in `str`) of the given ELR\n- `em_amm['Line']` is associated line name (in `str`) \n- `em_amm['Sub-Line']` is associated sub line name (in `str`), if available\n- `em_amm['AAM']` is a `pandas.DataFrame` of the mileage file data\n\n\n\n### 3. Railway stations data \n\nThe data of railway stations belongs to another category, '[Other assets](http://www.railwaycodes.org.uk/otherassetsmenu.shtm)'\n\n```python\nfrom pyrcs.other_assets import OtherAssets\nother_assets_cls = OtherAssets()\n```\n\nSimilar to getting 'CRS, NLC, TIPLOC and STANOX Codes' above, to get stations data by a given initial letter (say 'A'):\n\n```python\nstations_a = other_assets_cls.Stations.collect_station_locations('A')\n```\n\nTo get all available stations data:\n\n```python\nstations = other_assets_cls.Stations.fetch_station_locations()\n```\n\nThe data type of both `stations_a` and `stations` are `dict`.\n\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/mikeqfu/pyrcs",
"keywords": "",
"license": "",
"maintainer": "",
"maintainer_email": "",
"name": "pyrcs",
"package_url": "https://pypi.org/project/pyrcs/",
"platform": "",
"project_url": "https://pypi.org/project/pyrcs/",
"project_urls": {
"Homepage": "https://github.com/mikeqfu/pyrcs"
},
"release_url": "https://pypi.org/project/pyrcs/0.2.3/",
"requires_dist": [
"beautifulsoup4",
"fuzzywuzzy",
"html5lib",
"lxml",
"measurement",
"more-itertools",
"pandas",
"pyhelpers",
"python-Levenshtein",
"requests",
"sqlalchemy",
"sqlalchemy-utils"
],
"requires_python": "",
"summary": "A small web scraper for collecting the railway codes used in the UK rail industry",
"version": "0.2.3"
},
"last_serial": 5929667,
"releases": {
"0.2.0": [
{
"comment_text": "",
"digests": {
"md5": "b5c4d20ab714e88bcb3be7ab455eefa4",
"sha256": "32945ef0f3cc73ae34bd64832720d9372124f3d4307492e9038028e5932526bc"
},
"downloads": -1,
"filename": "pyrcs-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b5c4d20ab714e88bcb3be7ab455eefa4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1704660,
"upload_time": "2019-08-29T13:38:08",
"url": "https://files.pythonhosted.org/packages/d2/04/270d0d189c0cf0b436934565e206a9af37db30f6098e217abe2cb0061bb6/pyrcs-0.2.0-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "8d6ac548abaf78106dd1610a426a1e95",
"sha256": "c2d0b2ddded4c9444117fc8df1a4464db2fb6ef2a43b288e40c4d79e02afca69"
},
"downloads": -1,
"filename": "pyrcs-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "8d6ac548abaf78106dd1610a426a1e95",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 38704,
"upload_time": "2019-08-29T13:38:10",
"url": "https://files.pythonhosted.org/packages/bc/18/09b9e03befcdfbef9e0099f6a9a64c3155aa05c3f56db09cb669fc8e6e31/pyrcs-0.2.0.tar.gz"
}
],
"0.2.1": [
{
"comment_text": "",
"digests": {
"md5": "f77067f6be35ec3f636f09c86be22d5d",
"sha256": "e984c4afc2a81ab6a5652ada22276d614f48a79504042e70c90d067d5a44917b"
},
"downloads": -1,
"filename": "pyrcs-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f77067f6be35ec3f636f09c86be22d5d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1790946,
"upload_time": "2019-09-18T17:31:57",
"url": "https://files.pythonhosted.org/packages/27/3e/480d74f6c5a6fc04c5b9628f02290d6272917d11cd290d2489c204bdee58/pyrcs-0.2.1-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "c243c30837c9018fa99b0a2030884a5c",
"sha256": "20adc2d366e95067214664167a080a0817506413ab2be3d070e42d17b3389492"
},
"downloads": -1,
"filename": "pyrcs-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "c243c30837c9018fa99b0a2030884a5c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 39121,
"upload_time": "2019-09-18T17:32:00",
"url": "https://files.pythonhosted.org/packages/f7/c5/064711992a23fb51943dc43a3a67f678ad3c312597cca9a71fc160759feb/pyrcs-0.2.1.tar.gz"
}
],
"0.2.2": [
{
"comment_text": "",
"digests": {
"md5": "d75d463205f09a2d1a4007225eaa4efe",
"sha256": "63b41e2a37dbadf14047f41232c682e0a3df7f15bf9bf9f342584563eb537acb"
},
"downloads": -1,
"filename": "pyrcs-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d75d463205f09a2d1a4007225eaa4efe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1737422,
"upload_time": "2019-09-27T13:52:36",
"url": "https://files.pythonhosted.org/packages/2a/69/4bd5abac3adc71e18d704ce0ac88c8d2b7b413133227795f356e2dc9ba4e/pyrcs-0.2.2-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "99df23434694e59a81bbd6a4197af1dc",
"sha256": "618b3a6752c7d4ced47d0dfa1aa76f8080cc6d1d8d15ed4e2b47bc33c34d5e6c"
},
"downloads": -1,
"filename": "pyrcs-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "99df23434694e59a81bbd6a4197af1dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 40269,
"upload_time": "2019-09-27T13:52:39",
"url": "https://files.pythonhosted.org/packages/dd/3b/ab7dc1dfe7d5b8a25d834ac520eb29dfe815ea99a4e879e1fe1ea4afc413/pyrcs-0.2.2.tar.gz"
}
],
"0.2.3": [
{
"comment_text": "",
"digests": {
"md5": "24b1f405c92e75a3d53d7575b96673ca",
"sha256": "476842ee6074a1868a0fbd5bd736c175b9ffef0626ff71d0af6f54b1fce3ed03"
},
"downloads": -1,
"filename": "pyrcs-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24b1f405c92e75a3d53d7575b96673ca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1760813,
"upload_time": "2019-10-04T18:31:57",
"url": "https://files.pythonhosted.org/packages/fa/64/9cd6cb17aceca38b6f4e748c4a69315f4a3a6d5130f90675e82ebdd9243e/pyrcs-0.2.3-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "f1282474cd7700f834f81701b8b9ca3a",
"sha256": "2f9b4231bb244304560d0fb0a859aef1b917714ea937948e3bd3e84806f68a8e"
},
"downloads": -1,
"filename": "pyrcs-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "f1282474cd7700f834f81701b8b9ca3a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 40681,
"upload_time": "2019-10-04T18:31:59",
"url": "https://files.pythonhosted.org/packages/19/06/50534c3f29452c0a607e08676743858c957db6d49e1efe0572b5772a5bc3/pyrcs-0.2.3.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "24b1f405c92e75a3d53d7575b96673ca",
"sha256": "476842ee6074a1868a0fbd5bd736c175b9ffef0626ff71d0af6f54b1fce3ed03"
},
"downloads": -1,
"filename": "pyrcs-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24b1f405c92e75a3d53d7575b96673ca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1760813,
"upload_time": "2019-10-04T18:31:57",
"url": "https://files.pythonhosted.org/packages/fa/64/9cd6cb17aceca38b6f4e748c4a69315f4a3a6d5130f90675e82ebdd9243e/pyrcs-0.2.3-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "f1282474cd7700f834f81701b8b9ca3a",
"sha256": "2f9b4231bb244304560d0fb0a859aef1b917714ea937948e3bd3e84806f68a8e"
},
"downloads": -1,
"filename": "pyrcs-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "f1282474cd7700f834f81701b8b9ca3a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 40681,
"upload_time": "2019-10-04T18:31:59",
"url": "https://files.pythonhosted.org/packages/19/06/50534c3f29452c0a607e08676743858c957db6d49e1efe0572b5772a5bc3/pyrcs-0.2.3.tar.gz"
}
]
}