-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add getters for ICD10, ICD11, and ICF (#43)
* Create icd11.py * Update * Add icd10
- Loading branch information
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""A getter for ICD10.""" | ||
|
||
import requests | ||
|
||
from bioversions.utils import Getter, VersionType | ||
|
||
__all__ = [ | ||
"ICD10Getter", | ||
] | ||
|
||
URL = "https://icd.who.int/browse10/" | ||
|
||
|
||
class ICD10Getter(Getter): | ||
"""A getter for ICD10.""" | ||
|
||
bioregistry_id = "icd10" | ||
name = "International Classification of Diseases, 10th Revision" | ||
version_type = VersionType.date | ||
date_version_fmt = "%Y" | ||
|
||
def get(self) -> str: | ||
"""Get the latest ICD10 version number.""" | ||
response = requests.get(URL, allow_redirects=True) | ||
final_url = response.url | ||
return final_url[len("https://icd.who.int/browse10/") :].split("/")[0] | ||
|
||
|
||
if __name__ == "__main__": | ||
ICD10Getter.print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""A getter for ICD11.""" | ||
|
||
import requests | ||
|
||
from bioversions.utils import Getter, VersionType | ||
|
||
__all__ = [ | ||
"ICD11Getter", | ||
] | ||
|
||
URL = "https://icd.who.int/browse/latest-release/mms/en" | ||
|
||
|
||
class ICD11Getter(Getter): | ||
"""A getter for ICD11.""" | ||
|
||
bioregistry_id = "icd11" | ||
name = "International Classification of Diseases, 11th Revision" | ||
version_type = VersionType.date | ||
date_version_fmt = "%Y-%m" | ||
|
||
def get(self) -> str: | ||
"""Get the latest ICD11 version number.""" | ||
response = requests.get(URL, allow_redirects=True) | ||
final_url = response.url | ||
return final_url[len("https://icd.who.int/browse/") :].split("/")[0] | ||
|
||
|
||
if __name__ == "__main__": | ||
ICD11Getter.print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""A getter for ICF.""" | ||
|
||
import requests | ||
|
||
from bioversions.utils import Getter, VersionType | ||
|
||
__all__ = [ | ||
"ICFGetter", | ||
] | ||
|
||
URL = "https://icd.who.int/browse/latest-release/icf/en" | ||
|
||
|
||
class ICFGetter(Getter): | ||
"""A getter for ICF.""" | ||
|
||
bioregistry_id = "icf" | ||
name = "International Classification of Functioning, Disability and Health" | ||
version_type = VersionType.date | ||
date_version_fmt = "%Y-%m" | ||
|
||
def get(self) -> str: | ||
"""Get the latest ICF version number.""" | ||
response = requests.get(URL, allow_redirects=True) | ||
final_url = response.url | ||
return final_url[len("https://icd.who.int/browse/") :].split("/")[0] | ||
|
||
|
||
if __name__ == "__main__": | ||
ICFGetter.print() |