{"id":23290999,"url":"https://github.com/jplusplus/vantetider-scraper","last_synced_at":"2025-04-06T17:44:24.744Z","repository":{"id":62587012,"uuid":"109659368","full_name":"jplusplus/vantetider-scraper","owner":"jplusplus","description":"A scraper of statistical data from Vantetider.se built on top of Statscraper.","archived":false,"fork":false,"pushed_at":"2021-02-08T08:21:46.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-15T14:03:13.569Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/jplusplus.png","metadata":{"files":{"readme":"README.rst","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":"2017-11-06T07:04:15.000Z","updated_at":"2021-02-08T08:21:49.000Z","dependencies_parsed_at":"2022-11-03T22:16:17.778Z","dependency_job_id":null,"html_url":"https://github.com/jplusplus/vantetider-scraper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplusplus%2Fvantetider-scraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplusplus%2Fvantetider-scraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplusplus%2Fvantetider-scraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplusplus%2Fvantetider-scraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jplusplus","download_url":"https://codeload.github.com/jplusplus/vantetider-scraper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526675,"owners_count":20953141,"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":[],"created_at":"2024-12-20T05:13:49.203Z","updated_at":"2025-04-06T17:44:24.716Z","avatar_url":"https://github.com/jplusplus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThis is a scraper for statistical data from http://www.vantetider.se built on top of the `Statscraper package \u003chttps://github.com/jplusplus/statscraper\u003e`.\n\nInstall\n-------\n\n  pip install -r requirements.txt\n\nThe scraper has to do a lot of requests and uses `requests-cache \u003chttps://pypi.python.org/pypi/requests-cache\u003e` to store queries.\n\nExample usage\n-------------\n\n.. code:: python\n\n  from vantetider import VantetiderScraper\n\n  scraper = VantetiderScraper()\n  scraper.items  # List _implemeted_ datasets\n  # [\u003cVantetiderDataset: VantatKortareAn60Dagar (Väntat kortare än 60 dagar )\u003e, \u003cVantetiderDataset: Overbelaggning (Överbeläggningar)\u003e, \u003cVantetiderDataset: PrimarvardTelefon (Telefontillgänglighet)\u003e, \u003cVantetiderDataset: PrimarvardBesok (Läkarbesök)\u003e, \u003cVantetiderDataset: SpecialiseradBesok (Förstabesök)\u003e, \u003cVantetiderDataset: SpecialiseradOperation (Operation/åtgärd)\u003e]\n\n  dataset = scraper.get(\"Overbelaggning\")  # Get a specific dataset\n\n  # List all available dimensions\n  print dataset.dimensions\n\n  print datatset.regions  # List available region\n  print datatset.years  # List available years\n\n  # Make a query, you have to explicitly define all dimension values you want\n  # to query. By default the scraper will fetch default values.\n  res = dataset.fetch({\n    \"region\": \"Blekinge\",\n    \"year\": \"2016\",\n    \"period\": \"Februari\",\n    # Currenty we can only query by id of dimension value\n    \"type_of_overbelaggning\": [\"0\", \"1\"], # \"Somatik\" and \"Psykiatri\"\n    })\n\n  # Do something with the result\n  df = res.pandas\n\nPractical application, using dataset.py for storege.\n\n.. code:: python\n\n  from vantetider import VantetiderScraper\n  from vantetider.allowed_values import TYPE_OF_OVERBELAGGNING, PERIODS\n  import dataset\n\n  db = dataset.connect('sqlite:///vantetider.db')\n\n  TOPIC = \"Overbelaggning\"\n\n  # Set up local db\n  table = db.create_table(TOPIC)\n  scraper = VantetiderScraper()\n\n  dataset = scraper.get(TOPIC)\n\n  # Get all available regions and years for query\n  years = [x.value for x in dataset.years]\n  regions = [x.value for x in dataset.regions]\n\n  # Query in chunks to be able to store to database on the run\n  for region in regions:\n      for year in years:\n          res = dataset.fetch({\n              \"year\": year,\n              \"type_of_overbelaggning\": [x[0] for x in TYPE_OF_OVERBELAGGNING],\n              \"period\": PERIODS,\n              \"region\": region,\n              })\n          df = res.pandas\n          data = res.list_of_dicts\n          table.insert_many(data)\n\nTODO\n----\n\n- Implement scraping of \"Aterbesok\", \"Undersokningar\", \"BUPdetalj\", \"BUP\".\n- Enable querying on label names on all dimensions\n- Add more allowed values to `vantetider/allowed_values.py`\n- Make requests-cache optional.\n\nDevlop\n------\n\nRun tests:\n\n  make tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjplusplus%2Fvantetider-scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjplusplus%2Fvantetider-scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjplusplus%2Fvantetider-scraper/lists"}