Record catalog normalization in changelog
This commit is contained in:
@@ -19,6 +19,12 @@ LEGAL_FORCE_BY_DOCUMENT_TYPE = {
|
||||
"resolution": "subordinate",
|
||||
}
|
||||
CATALOGS = {"document_type": DOCUMENT_TYPES, "status": STATUSES, "authority": AUTHORITIES, "legal_force": LEGAL_FORCE_LEVELS}
|
||||
DOCUMENT_TYPE_ALIASES = {
|
||||
("Положение", "Положение"): "provision",
|
||||
("Конституционный закон", "Конституционный закон"): "constitutional_law",
|
||||
("Указ", "Жарлыгы"): "decree",
|
||||
("устав", None): "charter",
|
||||
}
|
||||
|
||||
|
||||
def labels(category: str, code: str) -> dict[str, str]:
|
||||
@@ -33,8 +39,10 @@ def source_code(category: str, value: dict | None) -> str:
|
||||
pair = ((value or {}).get("ru"), (value or {}).get("ky"))
|
||||
if pair == (None, None):
|
||||
return "unspecified"
|
||||
if category == "document_type" and pair in DOCUMENT_TYPE_ALIASES:
|
||||
return DOCUMENT_TYPE_ALIASES[pair]
|
||||
for code, expected in CATALOGS[category].items():
|
||||
if pair == expected or category == "document_type" and code == "provision" and pair == ("Положение", "Положение"):
|
||||
if pair == expected:
|
||||
return code
|
||||
# ponytail: uncurated source types share one filter; add reviewed codes when separate filtering is needed.
|
||||
if category == "document_type":
|
||||
|
||||
Reference in New Issue
Block a user