Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -685,126 +685,76 @@ def country_aliases_for_mfds(country):
|
|
| 685 |
|
| 686 |
|
| 687 |
def parse_mfds_detail_text(term, text):
|
| 688 |
-
"""
|
| 689 |
-
์์ฝ์ฒ ์์ธ ํ๋ฉด์ ํ์ ํ
์คํธ์์ ๊ตฌ๋ถ/๋ฐฐํฉ๊ธ์ง๊ตญ๊ฐ/์ ํ๊ตญ๊ฐ/์ ํ์ฌํญ์ ๊ตฌ์กฐ์ ์ผ๋ก ์ฝ๋๋ค.
|
| 690 |
-
|
| 691 |
-
๊ฒ์์ด์ ์์ฝ์ฒ ๊ณ ์์๋ฃ๋ช
์ด ์๋ก ๋ฌ๋ผ๋, ์์ธ ํ๋ฉด์ ๋ค์ด๊ฐ ๊ฒฐ๊ณผ๋ผ๋ฉด
|
| 692 |
-
'๊ตฌ๋ถ=๊ธ์ง'์ '๋ฐฐํฉ๊ธ์ง๊ตญ๊ฐ=์์ธ์' ๊ฐ์ ํ๋ ๊ธฐ์ค์ผ๋ก ํ์ ํ๋ค.
|
| 693 |
-
"""
|
| 694 |
clean = re.sub(r"\s+", " ", safe_str(text)).strip()
|
| 695 |
-
|
| 696 |
if not clean:
|
| 697 |
return []
|
| 698 |
|
| 699 |
rows = []
|
| 700 |
|
| 701 |
-
prohibited_region = ""
|
| 702 |
-
restricted_region = ""
|
| 703 |
-
|
| 704 |
-
m = re.search(r"๋ฐฐํฉ๊ธ์ง๊ตญ๊ฐ(.{0,1200})", clean)
|
| 705 |
-
if m:
|
| 706 |
-
prohibited_region = m.group(0)
|
| 707 |
-
|
| 708 |
-
m = re.search(r"(๋ฐฐํฉ์ ํ๊ตญ๊ฐ|์ ํ๊ตญ๊ฐ|์ ํ์ฌํญ|์ ํ๊ตญ๊ฐ)(.{0,1500})", clean)
|
| 709 |
-
if m:
|
| 710 |
-
restricted_region = m.group(0)
|
| 711 |
-
|
| 712 |
notice_name = ""
|
| 713 |
-
m = re.search(r"๊ณ ์์๋ฃ๋ช
\s*([^\n\r]{0,
|
| 714 |
if m:
|
| 715 |
notice_name = m.group(1).strip(" :|-")
|
| 716 |
|
| 717 |
-
is_prohibited_page = ("๊ตฌ๋ถ ๊ธ์ง" in clean) or ("๊ตฌ๋ถ: ๊ธ์ง" in clean) or ("๊ธ์ง" in prohibited_region)
|
| 718 |
-
is_restricted_page = ("๊ตฌ๋ถ ์ ํ" in clean) or ("๊ตฌ๋ถ: ์ ํ" in clean) or bool(restricted_region)
|
| 719 |
-
|
| 720 |
country_candidates = [
|
| 721 |
("ASEAN", ["์์ธ์", "ASEAN"]),
|
| 722 |
("EU", ["์ ๋ฝ", "EU", "์ ๋ฝ์ฐํฉ"]),
|
| 723 |
("FDA", ["๋ฏธ๊ตญ", "USA", "United States", "FDA"]),
|
| 724 |
-
("Korea", ["ํ๊ตญ", "๋ํ๋ฏผ๊ตญ"]),
|
| 725 |
("์ผ๋ณธ", ["์ผ๋ณธ", "Japan"]),
|
| 726 |
("์ค๊ตญ", ["์ค๊ตญ", "China"]),
|
| 727 |
("UK", ["์๊ตญ", "UK", "United Kingdom"]),
|
| 728 |
]
|
| 729 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 730 |
if is_prohibited_page:
|
| 731 |
region = prohibited_region or clean
|
| 732 |
-
|
| 733 |
for display, aliases in country_candidates:
|
| 734 |
if any(alias in region for alias in aliases):
|
| 735 |
rows.append({
|
| 736 |
-
"๊ฒ์์ด": term,
|
| 737 |
-
"
|
| 738 |
-
"
|
| 739 |
-
"CAS.No": "",
|
| 740 |
-
"๊ตฌ๋ถ": "๊ธ์ง",
|
| 741 |
-
"๊ตญ๊ฐ": display,
|
| 742 |
-
"๊ท์ ๋ด์ฉ": region[:1200],
|
| 743 |
-
"ํ๋": "",
|
| 744 |
-
"์กฐ๊ฑด": "",
|
| 745 |
-
"์ถ์ฒ": "MFDS live: " + MFDS_LIVE_URL,
|
| 746 |
-
"์์ธ์๋ฌธ": clean[:6000],
|
| 747 |
})
|
| 748 |
|
| 749 |
-
if is_restricted_page
|
| 750 |
region = restricted_region or clean
|
| 751 |
-
|
| 752 |
for display, aliases in country_candidates:
|
| 753 |
if any(alias in region for alias in aliases):
|
| 754 |
-
limit_match = re.search(r"([0-9]+(?:\.[0-9]+)?)\s*%", region)
|
| 755 |
rows.append({
|
| 756 |
-
"๊ฒ์์ด": term,
|
| 757 |
-
"
|
| 758 |
-
"
|
| 759 |
-
"
|
| 760 |
-
"๊ตฌ๋ถ": "์ ํ",
|
| 761 |
-
"๊ตญ๊ฐ": display,
|
| 762 |
-
"๊ท์ ๋ด์ฉ": region[:1200],
|
| 763 |
-
"ํ๋": limit_match.group(0).replace(" ", "") if limit_match else "",
|
| 764 |
-
"์กฐ๊ฑด": "",
|
| 765 |
-
"์ถ์ฒ": "MFDS live: " + MFDS_LIVE_URL,
|
| 766 |
-
"์์ธ์๋ฌธ": clean[:6000],
|
| 767 |
})
|
| 768 |
|
| 769 |
-
|
| 770 |
-
|
| 771 |
-
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
"--no-sandbox",
|
| 777 |
-
"--disable-setuid-sandbox",
|
| 778 |
-
"--disable-dev-shm-usage",
|
| 779 |
-
"--disable-gpu",
|
| 780 |
-
"--disable-software-rasterizer",
|
| 781 |
-
],
|
| 782 |
-
)
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
def mfds_try_install_chromium_once():
|
| 786 |
-
"""
|
| 787 |
-
postBuild๊ฐ ์คํ๋์ง ์์ ํ๊ฒฝ์์ Chromium์ด ์์ ๋ 1ํ ์ค์น๋ฅผ ์๋ํ๋ค.
|
| 788 |
-
์คํจํ๋๋ผ๋ ์ฑ ์ ์ฒด๊ฐ ์ฃฝ์ง ์๊ณ ๊ตญ๊ฐ๋ณ ํ์ผ ๊ฒ์ ๊ฒฐ๊ณผ๋ ๊ณ์ ํ์ํ๋ค.
|
| 789 |
-
"""
|
| 790 |
-
try:
|
| 791 |
-
proc = subprocess.run(
|
| 792 |
-
[sys.executable, "-m", "playwright", "install", "chromium"],
|
| 793 |
-
stdout=subprocess.PIPE,
|
| 794 |
-
stderr=subprocess.PIPE,
|
| 795 |
-
text=True,
|
| 796 |
-
timeout=180,
|
| 797 |
-
)
|
| 798 |
-
|
| 799 |
-
if proc.returncode == 0:
|
| 800 |
-
return True, "Chromium ๋ฐํ์ ์ค์น ์๋ฃ"
|
| 801 |
-
|
| 802 |
-
msg = (proc.stderr or proc.stdout or "").strip()
|
| 803 |
-
return False, msg[:500]
|
| 804 |
-
except Exception as e:
|
| 805 |
-
return False, str(e)
|
| 806 |
-
|
| 807 |
|
|
|
|
| 808 |
|
| 809 |
|
| 810 |
def mfds_lookup_one_term_with_retry(page, term):
|
|
@@ -1007,6 +957,10 @@ def ingredient_matches_live_row(material, component, row):
|
|
| 1007 |
|
| 1008 |
def live_row_country_matches(country, row_country):
|
| 1009 |
row_country = safe_str(row_country)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1010 |
aliases = country_aliases_for_mfds(country)
|
| 1011 |
|
| 1012 |
return any(alias and normalize_compact(alias) in normalize_compact(row_country) for alias in aliases)
|
|
@@ -1038,8 +992,8 @@ def evaluate_live_detail_rule(country, material, component, live_df):
|
|
| 1038 |
display = f"๋ฐฐํฉํ๋: {limit}"
|
| 1039 |
result_text = f"์์ฝ์ฒ ์ค์๊ฐ ์กฐํ: {display_country(country)} ์ ํ / ํ๋ {limit}"
|
| 1040 |
else:
|
| 1041 |
-
display =
|
| 1042 |
-
result_text = f"์์ฝ์ฒ ์ค์๊ฐ ์กฐํ: {display_country(country)} ์ ํ/ํ์ธ ํ์"
|
| 1043 |
|
| 1044 |
if regulation:
|
| 1045 |
result_text += " / " + regulation[:300]
|
|
@@ -1790,6 +1744,71 @@ def warmup_country_indexes(countries):
|
|
| 1790 |
|
| 1791 |
|
| 1792 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1793 |
def evaluate_component_from_country_files_only(country, material, component, target_id=""):
|
| 1794 |
"""
|
| 1795 |
GPT ํ์ ์์ด ์ฌ์ฉ์๊ฐ ์
๋ฐ์ดํธํ ๊ตญ๊ฐ๋ณ ๊ท์ ํ์ผ๋ง ์ง์ ๊ฒ์ํด์ ํ์ ํ๋ค.
|
|
@@ -1876,6 +1895,18 @@ def evaluate_component_from_country_files_only(country, material, component, tar
|
|
| 1876 |
|
| 1877 |
# 1. Annex II / Prohibited / Negative List
|
| 1878 |
# ํต์ฌ: ์ฑ๋ถ ์ฃผ๋ณ์ ๊ธ์ง๋ผ๋ ๋จ์ด๊ฐ ์์ด๋ ํด๋น ํ์ผ์์ ๋ฐ๊ฒฌ๋๋ฉด ๋ฐฐํฉ๊ธ์ง.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1879 |
if reg_kind == "prohibited":
|
| 1880 |
result = {
|
| 1881 |
"๋ํ INCI": representative,
|
|
|
|
| 685 |
|
| 686 |
|
| 687 |
def parse_mfds_detail_text(term, text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 688 |
clean = re.sub(r"\s+", " ", safe_str(text)).strip()
|
|
|
|
| 689 |
if not clean:
|
| 690 |
return []
|
| 691 |
|
| 692 |
rows = []
|
| 693 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
notice_name = ""
|
| 695 |
+
m = re.search(r"๊ณ ์์๋ฃ๋ช
\s*([^\n\r]{0,220}?)(?:๋จ์์กฐํญ|์ ํ์ฌํญ|๋ฐฐํฉ๊ธ์ง๊ตญ๊ฐ|๋ฐฐํฉ์ ํ๊ตญ๊ฐ|์ ํ๊ตญ๊ฐ|๋ฐฐํฉ๋ชฉ์ |๊ธฐ์ค์ผ์|$)", clean)
|
| 696 |
if m:
|
| 697 |
notice_name = m.group(1).strip(" :|-")
|
| 698 |
|
|
|
|
|
|
|
|
|
|
| 699 |
country_candidates = [
|
| 700 |
("ASEAN", ["์์ธ์", "ASEAN"]),
|
| 701 |
("EU", ["์ ๋ฝ", "EU", "์ ๋ฝ์ฐํฉ"]),
|
| 702 |
("FDA", ["๋ฏธ๊ตญ", "USA", "United States", "FDA"]),
|
| 703 |
+
("Korea", ["ํ๊ตญ", "๋ํ๋ฏผ๊ตญ", "Korea"]),
|
| 704 |
("์ผ๋ณธ", ["์ผ๋ณธ", "Japan"]),
|
| 705 |
("์ค๊ตญ", ["์ค๊ตญ", "China"]),
|
| 706 |
("UK", ["์๊ตญ", "UK", "United Kingdom"]),
|
| 707 |
]
|
| 708 |
|
| 709 |
+
def region_after(labels, size=2000):
|
| 710 |
+
for label in labels:
|
| 711 |
+
m = re.search(label + r"(.{0," + str(size) + r"})", clean, flags=re.IGNORECASE)
|
| 712 |
+
if m:
|
| 713 |
+
return m.group(0)
|
| 714 |
+
return ""
|
| 715 |
+
|
| 716 |
+
prohibited_region = region_after([r"๋ฐฐํฉ๊ธ์ง๊ตญ๊ฐ", r"๊ธ์ง๊ตญ๊ฐ"], 1600)
|
| 717 |
+
restricted_region = region_after([r"๋ฐฐํฉ์ ํ๊ตญ๊ฐ", r"์ ํ๊ตญ๊ฐ", r"์ ํ์ฌํญ", r"์ฌ์ฉ์ ํ", r"๋ฐฐํฉํ๋"], 2400)
|
| 718 |
+
|
| 719 |
+
is_prohibited_page = ("๊ตฌ๋ถ ๊ธ์ง" in clean) or ("๊ตฌ๋ถ: ๊ธ์ง" in clean) or bool(prohibited_region)
|
| 720 |
+
is_restricted_page = (
|
| 721 |
+
("๊ตฌ๋ถ ์ ํ" in clean)
|
| 722 |
+
or ("๊ตฌ๋ถ: ์ ํ" in clean)
|
| 723 |
+
or bool(restricted_region)
|
| 724 |
+
or ("์ ํ" in clean and ("%" in clean or "ppm" in clean or "ํ๋" in clean))
|
| 725 |
+
)
|
| 726 |
+
|
| 727 |
if is_prohibited_page:
|
| 728 |
region = prohibited_region or clean
|
|
|
|
| 729 |
for display, aliases in country_candidates:
|
| 730 |
if any(alias in region for alias in aliases):
|
| 731 |
rows.append({
|
| 732 |
+
"๊ฒ์์ด": term, "์๋ฃ๋ช
": notice_name or term, "INCI": notice_name or term, "CAS.No": "",
|
| 733 |
+
"๊ตฌ๋ถ": "๊ธ์ง", "๊ตญ๊ฐ": display, "๊ท์ ๋ด์ฉ": region[:1200],
|
| 734 |
+
"ํ๋": "", "์กฐ๊ฑด": "", "์ถ์ฒ": "MFDS live: " + MFDS_LIVE_URL, "์์ธ์๋ฌธ": clean[:6000],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 735 |
})
|
| 736 |
|
| 737 |
+
if is_restricted_page:
|
| 738 |
region = restricted_region or clean
|
| 739 |
+
limit_text, condition_text = extract_limit_condition_from_context(region)
|
| 740 |
for display, aliases in country_candidates:
|
| 741 |
if any(alias in region for alias in aliases):
|
|
|
|
| 742 |
rows.append({
|
| 743 |
+
"๊ฒ์์ด": term, "์๋ฃ๋ช
": notice_name or term, "INCI": notice_name or term, "CAS.No": "",
|
| 744 |
+
"๊ตฌ๋ถ": "์ ํ", "๊ตญ๊ฐ": display, "๊ท์ ๋ด์ฉ": region[:1200],
|
| 745 |
+
"ํ๋": limit_text, "์กฐ๊ฑด": condition_text,
|
| 746 |
+
"์ถ์ฒ": "MFDS live: " + MFDS_LIVE_URL, "์์ธ์๋ฌธ": clean[:6000],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 747 |
})
|
| 748 |
|
| 749 |
+
if not rows and is_restricted_page:
|
| 750 |
+
limit_text, condition_text = extract_limit_condition_from_context(restricted_region or clean)
|
| 751 |
+
rows.append({
|
| 752 |
+
"๊ฒ์์ด": term, "์๋ฃ๋ช
": notice_name or term, "INCI": notice_name or term, "CAS.No": "",
|
| 753 |
+
"๊ตฌ๋ถ": "์ ํ", "๊ตญ๊ฐ": "์ ์ฒด/๊ตญ๊ฐ ๋ฏธ๋ถ๋ฅ", "๊ท์ ๋ด์ฉ": (restricted_region or clean)[:1200],
|
| 754 |
+
"ํ๋": limit_text, "์กฐ๊ฑด": condition_text, "์ถ์ฒ": "MFDS live: " + MFDS_LIVE_URL, "์์ธ์๋ฌธ": clean[:6000],
|
| 755 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 756 |
|
| 757 |
+
return rows
|
| 758 |
|
| 759 |
|
| 760 |
def mfds_lookup_one_term_with_retry(page, term):
|
|
|
|
| 957 |
|
| 958 |
def live_row_country_matches(country, row_country):
|
| 959 |
row_country = safe_str(row_country)
|
| 960 |
+
|
| 961 |
+
if row_country in ["์ ์ฒด/๊ตญ๊ฐ ๋ฏธ๋ถ๋ฅ", "์ ์ฒด", "๊ตญ๊ฐ ๋ฏธ๋ถ๋ฅ"]:
|
| 962 |
+
return True
|
| 963 |
+
|
| 964 |
aliases = country_aliases_for_mfds(country)
|
| 965 |
|
| 966 |
return any(alias and normalize_compact(alias) in normalize_compact(row_country) for alias in aliases)
|
|
|
|
| 992 |
display = f"๋ฐฐํฉํ๋: {limit}"
|
| 993 |
result_text = f"์์ฝ์ฒ ์ค์๊ฐ ์กฐํ: {display_country(country)} ์ ํ / ํ๋ {limit}"
|
| 994 |
else:
|
| 995 |
+
display = "๋ฐฐํฉํ๋/์ ํ ํ์ธ"
|
| 996 |
+
result_text = f"์์ฝ์ฒ ์ค์๊ฐ ์กฐํ: {display_country(country)} ์ ํ ํ์ธ / ํ๋ยท์กฐ๊ฑด ํ์ธ ํ์"
|
| 997 |
|
| 998 |
if regulation:
|
| 999 |
result_text += " / " + regulation[:300]
|
|
|
|
| 1744 |
|
| 1745 |
|
| 1746 |
|
| 1747 |
+
|
| 1748 |
+
def extract_limit_condition_from_context(context):
|
| 1749 |
+
text = safe_str(context)
|
| 1750 |
+
compact = re.sub(r"\s+", " ", text).strip()
|
| 1751 |
+
if not compact:
|
| 1752 |
+
return "", ""
|
| 1753 |
+
|
| 1754 |
+
patterns = [
|
| 1755 |
+
r"([0-9]+(?:\.[0-9]+)?\s*%)",
|
| 1756 |
+
r"([0-9]+(?:\.[0-9]+)?\s*ppm)",
|
| 1757 |
+
r"([0-9]+(?:\.[0-9]+)?\s*g\s*/\s*100\s*g)",
|
| 1758 |
+
r"([0-9]+(?:\.[0-9]+)?\s*g\s+per\s+100\s*g)",
|
| 1759 |
+
r"([0-9]+(?:\.[0-9]+)?\s*mg\s*/\s*kg)",
|
| 1760 |
+
]
|
| 1761 |
+
limits = []
|
| 1762 |
+
for pat in patterns:
|
| 1763 |
+
for m in re.finditer(pat, compact, flags=re.IGNORECASE):
|
| 1764 |
+
v = m.group(1).replace(" ", "")
|
| 1765 |
+
if v not in limits:
|
| 1766 |
+
limits.append(v)
|
| 1767 |
+
|
| 1768 |
+
condition_keywords = [
|
| 1769 |
+
"leave-on", "rinse-off", "oral", "mucosa", "washed away",
|
| 1770 |
+
"๋ณด์กด์ ", "๋ฐฉ๋ถ์ ", "์์ธ์ ", "์์", "์ ๋ง", "๊ตฌ๊ฐ",
|
| 1771 |
+
"์ ํ์ฌํญ", "๊ฒฝ๊ณ ", "warning", "condition", "ํ๋", "์ ํ",
|
| 1772 |
+
]
|
| 1773 |
+
condition_lines = []
|
| 1774 |
+
for line in [safe_str(x) for x in text.splitlines() if safe_str(x)]:
|
| 1775 |
+
l = line.lower()
|
| 1776 |
+
if any(k.lower() in l for k in condition_keywords):
|
| 1777 |
+
cleaned = re.sub(r"\s+", " ", line).strip()
|
| 1778 |
+
if cleaned not in condition_lines:
|
| 1779 |
+
condition_lines.append(cleaned)
|
| 1780 |
+
|
| 1781 |
+
return ", ".join(limits[:5]), " / ".join(condition_lines[:5])[:700]
|
| 1782 |
+
|
| 1783 |
+
|
| 1784 |
+
def make_restricted_or_positive_result(country, component, match, reg_type):
|
| 1785 |
+
context = safe_str(match.get("context", "")) if isinstance(match, dict) else safe_str(match)
|
| 1786 |
+
label = safe_str(reg_type.get("label", "๊ท์ ๋ชฉ๋ก"))
|
| 1787 |
+
kind = safe_str(reg_type.get("type", ""))
|
| 1788 |
+
limit_text, condition_text = extract_limit_condition_from_context(context)
|
| 1789 |
+
representative = safe_str(component.get("INCI Name", "")) or safe_str(component.get("ํ๊ธ ์ฑ๋ถ๋ช
", "")) or "-"
|
| 1790 |
+
|
| 1791 |
+
if limit_text:
|
| 1792 |
+
display = f"๋ฐฐํฉํ๋: {limit_text}"
|
| 1793 |
+
result = f"{display_country(country)} {label}์์ ์ฑ๋ถ ํ์ธ / ํ๋ {limit_text}"
|
| 1794 |
+
elif kind.startswith("positive_"):
|
| 1795 |
+
display = "ํ์ฉ๋ชฉ๋ก ๋ฑ์ฌ / ํ๋ ํ์ธ ํ์"
|
| 1796 |
+
result = f"{display_country(country)} {label}์์ ์ฑ๋ถ ํ์ธ / ๋ชฉ์ ๋ณ ํ์ฉ๋ชฉ๋ก ๋ฑ์ฌ, ํ๋ยท์กฐ๊ฑด ํ์ธ ํ์"
|
| 1797 |
+
else:
|
| 1798 |
+
display = "๋ฐฐํฉํ๋/์ ํ ํ์ธ"
|
| 1799 |
+
result = f"{display_country(country)} {label}์์ ์ฑ๋ถ ํ์ธ / ํ๋ยท์กฐ๊ฑด ํ์ธ ํ์"
|
| 1800 |
+
|
| 1801 |
+
if condition_text:
|
| 1802 |
+
result += f" / ์กฐ๊ฑด: {condition_text}"
|
| 1803 |
+
|
| 1804 |
+
return {
|
| 1805 |
+
"๋ํ INCI": representative,
|
| 1806 |
+
"๊ฒฐ๊ณผ": result,
|
| 1807 |
+
"ํ์๋ฌธ๊ตฌ": display,
|
| 1808 |
+
"๋น๊ณ ": context[:1000] if context else label,
|
| 1809 |
+
}
|
| 1810 |
+
|
| 1811 |
+
|
| 1812 |
def evaluate_component_from_country_files_only(country, material, component, target_id=""):
|
| 1813 |
"""
|
| 1814 |
GPT ํ์ ์์ด ์ฌ์ฉ์๊ฐ ์
๋ฐ์ดํธํ ๊ตญ๊ฐ๋ณ ๊ท์ ํ์ผ๋ง ์ง์ ๊ฒ์ํด์ ํ์ ํ๋ค.
|
|
|
|
| 1895 |
|
| 1896 |
# 1. Annex II / Prohibited / Negative List
|
| 1897 |
# ํต์ฌ: ์ฑ๋ถ ์ฃผ๋ณ์ ๊ธ์ง๋ผ๋ ๋จ์ด๊ฐ ์์ด๋ ํด๋น ํ์ผ์์ ๋ฐ๊ฒฌ๋๋ฉด ๋ฐฐํฉ๊ธ์ง.
|
| 1898 |
+
if reg_kind == "restricted" or reg_kind.startswith("positive_"):
|
| 1899 |
+
result = make_restricted_or_positive_result(country, component, best, reg_type)
|
| 1900 |
+
log_search_context(
|
| 1901 |
+
target_id,
|
| 1902 |
+
country,
|
| 1903 |
+
component,
|
| 1904 |
+
result["๊ฒฐ๊ณผ"],
|
| 1905 |
+
"COUNTRY_FILE_FAST",
|
| 1906 |
+
result["๋น๊ณ "],
|
| 1907 |
+
)
|
| 1908 |
+
return result
|
| 1909 |
+
|
| 1910 |
if reg_kind == "prohibited":
|
| 1911 |
result = {
|
| 1912 |
"๋ํ INCI": representative,
|