[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,100 +1,213 @@
|
||||
---
|
||||
id: wiki-2026-0508-복잡한-비즈니스-도메인-금융-헬스케어-이커머스-등
|
||||
title: 복잡한 비즈니스 도메인 (금융 헬스케어 이커머스 등)
|
||||
title: 복잡한 비즈니스 도메인 (금융, 헬스케어, 이커머스 등)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-AD3BC6]
|
||||
aliases: [Complex Business Domains, Domain-Heavy Systems]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced]
|
||||
verification_status: applied
|
||||
tags: [domain-driven-design, business-domain, architecture, ddd]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
github_commit: "[P-Reinforce] Continuous Worker - 복잡한 비즈니스 도메인 (금융 헬스케어 이커머스 등)"
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: TypeScript
|
||||
framework: NestJS / Spring Boot
|
||||
---
|
||||
|
||||
# [[복잡한 비즈니스 도메인 (금융 헬스케어 이커머스 등)|복잡한 비즈니스 도메인 (금융 헬스케어 이커머스 등]]
|
||||
# 복잡한 비즈니스 도메인 (금융, 헬스케어, 이커머스)
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> 복잡한 비즈니스 도메인(금융, 헬스케어, 이커머스 등)은 방대하고 민감한 데이터 처리, 고도의 보안 및 엄격한 규제 준수, 그리고 복잡한 비즈니스 로직을 특징으로 하는 산업 분야입니다 [1-4]. 이러한 도메인의 내재된 복잡성을 통제하고 현실의 비즈니스 프로세스를 소프트웨어로 정확히 반영하기 위해 도메인 주도 설계(DDD)와 같은 아키텍처 원칙이 필수적으로 활용됩니다 [4-6]. 이를 통해 조직은 기술적 부채를 최소화하고 변화하는 비즈니스 요구에 맞춰 확장 가능하며 유지보수가 용이한 시스템을 구축할 수 있습니다 [5, 7].
|
||||
## 매 한 줄
|
||||
> **"매 복잡한 도메인은 코드의 형태가 아니라 도메인 모델의 형태로 정복된다"**. 매 금융, 헬스케어, 이커머스는 각각 규제, 정확성, 동시성 압력이 다르며 매 DDD bounded context + invariant enforcement + event sourcing 이 2026 의 default approach.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
* **핵심 요구사항 및 도메인 특성:**
|
||||
금융(핀테크), 헬스케어, 이커머스와 같은 복잡한 도메인은 개인식별정보(PII) 및 결제카드산업(PCI) 정보 등 매우 민감한 데이터를 다루므로 설계 단계부터 강력한 데이터 보안, 프라이버시 유지 및 다층적인 암호화 전략이 필수적입니다 [2, 3, 8]. 또한 핀테크의 실시간 사기 탐지나 이커머스의 실시간 재고 관리와 같이 즉각적인 비즈니스 결정과 조치가 필요한 경우, 배치 처리보다 지연 시간이 짧은 실시간 데이터 스트리밍 및 이벤트 기반 아키텍처(EDA)가 강하게 요구됩니다 [1, 8].
|
||||
## 매 핵심
|
||||
|
||||
* **도메인 주도 설계(DDD)를 통한 복잡성 관리:**
|
||||
금융, 헬스케어, 이커머스처럼 비즈니스 로직이 방대하고 복잡한 도메인에서는 도메인 주도 설계(DDD)가 가장 이상적인 아키텍처 베스트 프랙티스로 꼽힙니다 [5]. 거대하고 복잡한 도메인을 '주문 관리(Order [[Management|Management]])', '사용자 관리'와 같이 작고 관리하기 쉬운 '바운디드 컨텍스트(Bounded Context)'로 분할하여 복잡성을 통제합니다 [6, 9]. 이를 통해 기술팀과 도메인 전문가가 공통의 '유비쿼터스 언어(Ubiquitous Language)'를 사용하여 의사소통 격차를 줄이고 소프트웨어가 실제 비즈니스를 정확히 반영하도록 모델링합니다 [4].
|
||||
### 매 도메인별 압력
|
||||
- **금융**: 매 정확성 (decimal arithmetic, no float), audit trail, regulatory (SOX, MiFID II, Basel III, K-AML), idempotency.
|
||||
- **헬스케어**: 매 PHI privacy (HIPAA, GDPR Art.9, K-MyData), HL7/FHIR interoperability, clinical decision support, audit immutability.
|
||||
- **이커머스**: 매 inventory consistency, payment idempotency, fraud detection, peak-load (Black Friday) elasticity, multi-currency/tax.
|
||||
|
||||
* **데이터 거버넌스 및 품질 관리:**
|
||||
규제가 엄격한 금융 및 헬스케어 산업에서는 규정 준수를 위해 강력한 데이터 거버넌스와 메타데이터 관리가 필수적입니다 [8, 10]. 잘못된 데이터로 인한 치명적인 의사결정 오류나 머신러닝 모델의 붕괴를 방지하기 위해 파이프라인의 모든 단계에서 자동화된 데이터 품질 및 유효성 검사 프레임워크(예: Data Contracts)를 적용해야 합니다 [11].
|
||||
### 매 공통 architectural pillars
|
||||
- **Bounded Context**: 매 Order, Payment, Inventory, Patient, Claim 의 명확한 ownership boundaries.
|
||||
- **Aggregate root + invariants**: 매 transactional consistency unit, business rule enforcement.
|
||||
- **Event Sourcing + CQRS**: 매 audit trail + read/write workload split.
|
||||
- **Sagas / Process Managers**: 매 distributed transaction 대신 compensating actions.
|
||||
- **Anti-corruption layer**: 매 legacy 시스템 (COBOL, HL7v2, EDI) 과의 격리.
|
||||
|
||||
* **아키텍처의 논리적 격리와 마이크로서비스 확장:**
|
||||
복잡한 비즈니스 도메인의 핵심 규칙은 클린 아키텍처(Clean [[Architecture|Architecture]]) 원칙에 따라 데이터베이스나 웹 프레임워크와 같은 외부 인프라의 변동으로부터 완벽히 보호(격리)되어야 합니다 [12, 13]. 나아가 마이크로서비스 아키텍처를 도입하여 거대한 시스템을 특정 비즈니스 도메인 기능에 맞춰 세분화된 독립 서비스로 나누면, 각 팀이 자율적으로 배포 및 확장을 수행할 수 있어 복잡한 시스템 환경에서도 비즈니스 민첩성을 확보할 수 있습니다 [6, 14].
|
||||
### 매 응용
|
||||
1. 매 금융: 매 ledger as append-only event log, double-entry bookkeeping, eventual consistency 위 strong invariants.
|
||||
2. 매 헬스케어: 매 FHIR resource model + consent management + audit per-field-access.
|
||||
3. 매 이커머스: 매 inventory reservation saga + payment authorization/capture + outbox pattern.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** Programming & Language 분야의 자동 자산화 수행.
|
||||
## 💻 패턴
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** [[도메인 주도 설계 (DDD)|도메인 주도 설계 (DDD]], 바운디드 컨텍스트 (Bounded Context), 마이크로서비스 아키텍처 (Microservices Architecture), [[이벤트 기반 아키텍처 (Event-Driven Architecture)|이벤트 기반 아키텍처 (Event-Driven Architecture]], [[데이터 거버넌스 (Data Governance)|데이터 거버넌스 (Data Governance]]
|
||||
- **Projects/Contexts:** [[핀테크의 실시간 사기 탐지|핀테크의 실시간 사기 탐지]], [[이커머스의 실시간 재고 관리|이커머스의 실시간 재고 관리]], 헬스케어의 민감 데이터(PII/PCI) 보안 규제 준수
|
||||
- **Contradictions/Notes:** 소스 문헌들은 복잡한 비즈니스 도메인 구축 시 기술적인 관점으로만 시스템을 나누는 것(예: 단순 계층형 아키텍처)보다, 비즈니스 현실을 중심에 두고 비즈니스 역량과 도메인 모델을 기준으로 시스템을 세분화하는 도메인 주도 설계(DDD)나 마이크로서비스 아키텍처가 훨씬 더 높은 확장성과 유지보수성을 제공한다고 강조합니다 [5, 6, 15].
|
||||
### Decimal money (금융)
|
||||
```typescript
|
||||
import Decimal from 'decimal.js';
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-18*
|
||||
|
||||
---
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
class Money {
|
||||
constructor(readonly amount: Decimal, readonly currency: string) {}
|
||||
static of(amount: string, currency: string) {
|
||||
return new Money(new Decimal(amount), currency);
|
||||
}
|
||||
add(other: Money): Money {
|
||||
if (other.currency !== this.currency) throw new Error('currency mismatch');
|
||||
return new Money(this.amount.plus(other.amount), this.currency);
|
||||
}
|
||||
// never use number — IEEE-754 binary float ruins cents
|
||||
}
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Aggregate with invariants (이커머스)
|
||||
```typescript
|
||||
class Order {
|
||||
private items: OrderItem[] = [];
|
||||
private status: 'draft'|'placed'|'paid'|'fulfilled'|'cancelled' = 'draft';
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
addItem(productId: string, qty: number, unitPrice: Money) {
|
||||
if (this.status !== 'draft') throw new Error('cannot modify placed order');
|
||||
if (qty <= 0) throw new Error('qty>0');
|
||||
this.items.push(new OrderItem(productId, qty, unitPrice));
|
||||
}
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
place(): OrderPlaced {
|
||||
if (this.items.length === 0) throw new Error('empty order');
|
||||
this.status = 'placed';
|
||||
return { type: 'OrderPlaced', orderId: this.id, total: this.total() };
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Saga: payment + inventory (이커머스)
|
||||
```typescript
|
||||
async function placeOrderSaga(orderId: string) {
|
||||
const reservation = await inventory.reserve(orderId);
|
||||
try {
|
||||
const payment = await payments.authorize(orderId);
|
||||
try {
|
||||
await inventory.commit(reservation.id);
|
||||
await payments.capture(payment.id);
|
||||
} catch (e) {
|
||||
await payments.void(payment.id);
|
||||
await inventory.release(reservation.id);
|
||||
throw e;
|
||||
}
|
||||
} catch (e) {
|
||||
await inventory.release(reservation.id);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Event sourcing (금융 ledger)
|
||||
```typescript
|
||||
type LedgerEvent =
|
||||
| { type: 'AccountOpened', accountId: string, currency: string }
|
||||
| { type: 'Debited', accountId: string, amount: string, txId: string }
|
||||
| { type: 'Credited', accountId: string, amount: string, txId: string };
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
function reduce(events: LedgerEvent[]): Account {
|
||||
return events.reduce((acc, e) => {
|
||||
if (e.type === 'AccountOpened') return { ...acc, currency: e.currency, balance: new Decimal(0) };
|
||||
if (e.type === 'Debited') return { ...acc, balance: acc.balance.minus(e.amount) };
|
||||
if (e.type === 'Credited') return { ...acc, balance: acc.balance.plus(e.amount) };
|
||||
return acc;
|
||||
}, {} as Account);
|
||||
}
|
||||
```
|
||||
|
||||
### FHIR resource (헬스케어)
|
||||
```typescript
|
||||
interface Patient {
|
||||
resourceType: 'Patient';
|
||||
id: string;
|
||||
identifier: Array<{ system: string; value: string }>;
|
||||
name: HumanName[];
|
||||
birthDate: string; // ISO8601
|
||||
consent?: Reference<Consent>; // K-MyData / HIPAA consent linkage
|
||||
}
|
||||
```
|
||||
|
||||
### Outbox pattern (이커머스 reliability)
|
||||
```typescript
|
||||
await db.transaction(async tx => {
|
||||
await tx.insert('orders', order);
|
||||
await tx.insert('outbox', {
|
||||
id: ulid(),
|
||||
aggregateId: order.id,
|
||||
type: 'OrderPlaced',
|
||||
payload: JSON.stringify(event),
|
||||
createdAt: new Date(),
|
||||
});
|
||||
});
|
||||
// async outbox poller publishes to Kafka — at-least-once delivery
|
||||
```
|
||||
|
||||
### Anti-corruption layer (legacy HL7v2 → FHIR)
|
||||
```typescript
|
||||
class HL7v2ToFhirAdapter {
|
||||
translate(adt: Hl7v2Message): Patient {
|
||||
const pid = adt.segment('PID');
|
||||
return {
|
||||
resourceType: 'Patient',
|
||||
id: pid.field(3).value(),
|
||||
name: [{ family: pid.field(5).component(1), given: [pid.field(5).component(2)] }],
|
||||
birthDate: this.parseHl7Date(pid.field(7).value()),
|
||||
identifier: [{ system: 'urn:hospital:mrn', value: pid.field(3).value() }],
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Idempotency key (payments)
|
||||
```typescript
|
||||
async function charge(req: ChargeRequest, idempotencyKey: string) {
|
||||
const existing = await db.idempotency.findOne({ key: idempotencyKey });
|
||||
if (existing) return existing.response;
|
||||
const result = await processor.charge(req);
|
||||
await db.idempotency.insert({ key: idempotencyKey, response: result, ttl: '24h' });
|
||||
return result;
|
||||
}
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 금융 ledger | Event sourcing + double-entry |
|
||||
| 헬스케어 record | FHIR + consent + audit log |
|
||||
| 이커머스 order flow | Saga + outbox + idempotency |
|
||||
| Cross-domain integration | Anti-corruption layer |
|
||||
| Strong invariant | Aggregate boundary, single-writer |
|
||||
| High read throughput | CQRS read model |
|
||||
|
||||
**기본값**: 매 Bounded Context first, Aggregate + invariants second, Events as integration third.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Domain-Driven Design]] · [[Bounded_Context]]
|
||||
- 변형: [[Event Sourcing]] · [[CQRS]] · [[Saga Pattern]]
|
||||
- 응용: [[이커머스의 실시간 재고 관리]] · [[엔터프라이즈 소프트웨어 개발]]
|
||||
- Adjacent: [[ACID Transactions]] · [[비기능 요구사항 (Non-functional Requirements)]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 도메인 모델링, invariant 추출, ubiquitous language 정리, regulatory mapping (HIPAA → field-level access policy).
|
||||
**언제 X**: 매 specific compliance interpretation (변호사·CISO 검토 필수), 매 production money handling (independent audit 필요).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Anonymic domain model**: 매 getter/setter 만 있는 비즈니스 로직 없는 entity → service 비대화.
|
||||
- **Float for money**: 매 0.1 + 0.2 ≠ 0.3 의 IEEE-754 catastrophe.
|
||||
- **Distributed transaction (2PC)**: 매 micro-services 간 2PC → coordinator deadlock + low availability.
|
||||
- **One DB for all bounded contexts**: 매 schema coupling 으로 deploy lock-step.
|
||||
- **PHI in logs**: 매 healthcare/finance 의 unmasked PII/PHI 가 log 에 → instant compliance breach.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Evans "Domain-Driven Design", Vernon "Implementing DDD", FHIR R5 spec, ISO 20022).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — finance/healthcare/ecommerce DDD patterns 정리 |
|
||||
|
||||
Reference in New Issue
Block a user