초기 정리: PIT3000 분석 자료 업로드

- 좌표/SQL/API 분석 문서화
- 재현 스크립트와 예시 응답 추가
- 개인정보/원본 실행파일 제외
This commit is contained in:
2026-06-29 00:27:06 +00:00
commit 4bacdb0a1e
7 changed files with 384 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
#!/usr/bin/env python3
"""Example normalizer for PIT3000 drug info rows.
This file does not connect to production DB. Replace the stub functions with pyodbc/pymssql calls.
"""
from __future__ import annotations
import json
def normalize_drug_info(drugcode: str, goods: dict, detail: dict, images: list[dict], pictograms: list[dict]) -> dict:
dik_code = goods.get('DIK_CODE') or ''
sung_code = goods.get('SUNG_CODE') or ''
return {
'drugcode': drugcode,
'dik_code': dik_code,
'sung_code': sung_code,
'sung_code_kind': 'ingredient_code',
'names': {
'etcname': detail.get('ETCNAME'),
'splname': detail.get('SPLNAME'),
'ingredient_name_en': detail.get('SUNG_ENM'),
},
'classification': {
'print_type': detail.get('PRINT_TYPE'),
'effctname': detail.get('EFFCTNAME'),
'character': detail.get('CHARACT'),
},
'drug_info': {
'save_medi': detail.get('SAVE_MEDI'),
'indic_medi': detail.get('INDIC_MEDI'),
'effect': detail.get('EFFECT'),
'adr': detail.get('ADR'),
'interaction': detail.get('INTERACTION'),
'gen_medi': detail.get('GEN_MEDI'),
},
'images': images,
'pictograms': pictograms,
'external_links': {
'health_kr_simple': f'https://health.kr/searchDrug/result_drug_simple.asp?drug_cd={dik_code}',
'health_kr_zoom': f'https://www.health.kr/drug_info/sb/zoom.asp?drug_code={dik_code}&print_front=&print_back=',
'pharm_or_kr_zoom': f'https://www.pharm.or.kr/search/zoom.asp?drug_code={dik_code}',
},
}
if __name__ == '__main__':
sample = normalize_drug_info(
'A000000001',
{'DIK_CODE': '123456789', 'SUNG_CODE': '1234567TB'},
{
'ETCNAME': '샘플정', 'SPLNAME': '샘플제약', 'SUNG_ENM': 'Sample ingredient',
'PRINT_TYPE': '해열진통소염제', 'EFFCTNAME': '정제', 'CHARACT': '흰색 원형 정제',
'SAVE_MEDI': '실온 보관', 'INDIC_MEDI': '1일 3회 식후 복용',
'EFFECT': '효능/효과 예시', 'ADR': '주의사항 예시',
'INTERACTION': '상호작용 예시', 'GEN_MEDI': '복약지도 예시',
},
[{'source': 'PM_IMAGE..DrugImg', 'expr1': '1', 'url': '/api/drugs/A000000001/images/1.jpg'}],
[{'pic_code': 'P001', 'source': 'PM_DRUG..CD_PICTOGRAM', 'url': '/api/drugs/A000000001/pictograms/P001.jpg'}],
)
print(json.dumps(sample, ensure_ascii=False, indent=2))