codedx 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,10 @@ wheels/
10
10
  # Virtual environments
11
11
  .venv
12
12
 
13
- # local config. while I do use claude to code this
14
- # I dont consider the agent config part of the project.
13
+ # environment file. may contain secrets.
14
+ .env
15
+
16
+ # agent config is not part of the project.
15
17
  .claude
16
18
 
17
19
  # Downloaded at build time — not committed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codedx
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Swedish medical coding used for diagnosis codes
5
5
  Author-email: Ludvig Hult <ludvig.hult@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -46,6 +46,13 @@ Dots are dropped throughout, matching what is typically found in databases: `A01
46
46
  pip install codedx
47
47
  ```
48
48
 
49
- Downloads data at install time from Socialstyrelsen, WHO, and CDC. Raw files are not redistributed due to licence restrictions.
49
+ Downloads data at install time from Ehälsomyndigheten, WHO, and CDC. Raw files are not redistributed due to licence restrictions.
50
50
 
51
- > **Note:** Socialstyrelsen is migrating data to Ehälsomyndigheten — download URLs may stop working in the future.
51
+ ## Changelog
52
+
53
+ ### 0.2.0
54
+ - ICD-10-SE and history file now downloaded from Ehälsomyndigheten (replacing Socialstyrelsen URLs)
55
+ - Retired code lookup now uses the comprehensive history file (`historik-icd-10-se-1997-2026.xlsx`) covering all codes 1997–2026, instead of the partial inactivation list
56
+
57
+ ### 0.1.0
58
+ - Initial release
@@ -36,6 +36,13 @@ Dots are dropped throughout, matching what is typically found in databases: `A01
36
36
  pip install codedx
37
37
  ```
38
38
 
39
- Downloads data at install time from Socialstyrelsen, WHO, and CDC. Raw files are not redistributed due to licence restrictions.
39
+ Downloads data at install time from Ehälsomyndigheten, WHO, and CDC. Raw files are not redistributed due to licence restrictions.
40
40
 
41
- > **Note:** Socialstyrelsen is migrating data to Ehälsomyndigheten — download URLs may stop working in the future.
41
+ ## Changelog
42
+
43
+ ### 0.2.0
44
+ - ICD-10-SE and history file now downloaded from Ehälsomyndigheten (replacing Socialstyrelsen URLs)
45
+ - Retired code lookup now uses the comprehensive history file (`historik-icd-10-se-1997-2026.xlsx`) covering all codes 1997–2026, instead of the partial inactivation list
46
+
47
+ ### 0.1.0
48
+ - Initial release
@@ -40,8 +40,8 @@ _MULTI_ZIPS = [
40
40
  "icd10se_latest.zip",
41
41
  "ICD-10-SE latest release (~15 MB)",
42
42
  [
43
- ("icd-10-se.tsv", "https://www.socialstyrelsen.se/globalassets/sharepoint-dokument/dokument-webb/klassifikationer-och-koder/icd-10-se.tsv"),
44
- ("andringar-icd-10-se.xlsx", "https://www.socialstyrelsen.se/globalassets/sharepoint-dokument/dokument-webb/klassifikationer-och-koder/andringar-icd-10-se.xlsx"),
43
+ ("icd-10-se.tsv", "https://samarbetsyta.ehalsomyndigheten.se/download/attachments/451267009/icd-10-se.tsv?api=v2"),
44
+ ("historik-icd-10-se-1997-2026.xlsx", "https://samarbetsyta.ehalsomyndigheten.se/download/attachments/451267009/historik-icd-10-se-1997-2026%20%281%29.xlsx?api=v2"),
45
45
  ],
46
46
  ),
47
47
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codedx"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Swedish medical coding used for diagnosis codes"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1,6 +1,6 @@
1
1
  import pathlib
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.2.0"
4
4
  _CACHE_DIR = pathlib.Path.home() / ".cache" / "codedx" / f"v{__version__}"
5
5
 
6
6
  from codedx._core import ( # noqa: E402
@@ -52,19 +52,19 @@ def _build_retired(work_dir: pathlib.Path) -> pl.DataFrame:
52
52
  "Code": pl.Series([], dtype=pl.String),
53
53
  "Titel": pl.Series([], dtype=pl.String),
54
54
  })
55
- xlsx = work_dir / "andringar-icd-10-se.xlsx"
56
- if not xlsx.exists():
55
+ historik = work_dir / "historik-icd-10-se-1997-2026.xlsx"
56
+ if not historik.exists():
57
57
  return _empty
58
58
  try:
59
- df = pl.read_excel(xlsx, sheet_name="Inaktiverade koder")
59
+ df = pl.read_excel(historik)
60
60
  except Exception:
61
61
  return _empty
62
- if "Inaktiverad kod" not in df.columns:
62
+ if "Giltig till" not in df.columns:
63
63
  return _empty
64
64
  return (
65
- df.filter(pl.col("Inaktiverad kod").is_not_null())
65
+ df.filter(pl.col("Giltig till").is_not_null() & (pl.col("Giltig till") != ""))
66
66
  .select(
67
- pl.col("Inaktiverad kod").str.replace_all("\\.", "").alias("Code"),
67
+ pl.col("Kod").str.replace_all("\\.", "").alias("Code"),
68
68
  pl.col("Titel"),
69
69
  )
70
70
  .unique("Code")
File without changes
File without changes
File without changes
File without changes
File without changes