필터 기본값 수정

This commit is contained in:
2025-12-15 18:18:51 +09:00
parent 269e1986a6
commit 07ad735208
12 changed files with 1259 additions and 146 deletions

View File

@@ -1,61 +0,0 @@
/**
* 소 용도 분류 설정
*
* @description
* 소의 용도를 결정하는 비즈니스 로직 임계값 정의
* - 도태 (Culling): 낮은 수태율, 번식 능력 부족
* - 인공수정 (Artificial Insemination): 높은 수태율 + 우수 등급
* - 공란우 (Donor): 중간 수태율 + 우수 등급
* - 수란우 (Recipient): 높은 수태율 + 낮은 등급
*/
export const COW_PURPOSE_CONFIG = {
/**
* 수태율 기반 임계값 (%)
*/
CONCEPTION_RATE_THRESHOLDS: {
/**
* 도태 대상 최대 수태율 (30% 미만)
* 수태율이 이 값보다 낮으면 번식 능력이 부족하여 도태 대상
*/
CULLING_MAX: 30,
/**
* 공란우 최대 수태율 (50% 미만)
* 수태율이 낮지만 우수한 유전자 보유 시 수정란 공급
*/
DONOR_MAX: 50,
/**
* 수란우 최소 수태율 (65% 이상)
* 높은 수태율을 가진 소에게 우수 수정란 이식
*/
RECIPIENT_MIN: 65,
/**
* 인공수정 최소 수태율 (65% 이상)
* 높은 수태율 + 우수 등급 → 일반 인공수정 대상
*/
INSEMINATION_MIN: 65,
},
/**
* 나이 기반 임계값 (년)
*/
AGE_THRESHOLDS: {
/**
* 노령우 기준 (10년 이상)
* 이 나이 이상이면 도태 고려 대상
*/
OLD_AGE_YEARS: 10,
/**
* 번식 적정 최소 나이 (2년)
*/
BREEDING_MIN_AGE: 2,
/**
* 번식 적정 최대 나이 (8년)
*/
BREEDING_MAX_AGE: 8,
},
} as const;

View File

@@ -602,8 +602,8 @@ export class GenomeService {
rank = lowerCount + 1;
} else {
// 나보다 높은 점수를 가진 농장 수 + 1 = 내 순위 (높을수록 좋음)
const higherCount = rankings.filter(r => r.avgEbv > farmData.avgEbv).length;
rank = higherCount + 1;
const higherCount = rankings.filter(r => r.avgEbv > farmData.avgEbv).length;
rank = higherCount + 1;
}
}
@@ -1810,8 +1810,8 @@ export class GenomeService {
];
// inputTraitConditions가 있으면 사용, 없으면 35개 형질 기본값 사용
const traitConditions = inputTraitConditions && inputTraitConditions.length > 0
? inputTraitConditions
: ALL_TRAITS.map(traitNm => ({ traitNm, weight: 1 }));
? inputTraitConditions // 프론트에서 보낸 형질사용
: ALL_TRAITS.map(traitNm => ({ traitNm, weight: 1 })); // 기본값 사용
console.log('[getFarmRegionRanking] traitConditions:', traitConditions.length, 'traits');

View File

@@ -37,67 +37,208 @@ export class MptModel extends BaseModel {
})
fkFarmNo: number;
@Column({ name: 'test_dt', type: 'date', nullable: true, comment: '검사일자' })
@Column({
name: 'test_dt',
type: 'date',
nullable: true,
comment: '검사일자',
})
testDt: Date;
@Column({ name: 'month_age', type: 'int', nullable: true, comment: '월령' })
@Column({
name: 'month_age',
type: 'int',
nullable: true,
comment: '월령',
})
monthAge: number;
@Column({ name: 'milk_yield', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '유량' })
@Column({
name: 'milk_yield',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '유량',
})
milkYield: number;
@Column({ name: 'parity', type: 'int', nullable: true, comment: '산차' })
@Column({
name: 'parity',
type: 'int',
nullable: true,
comment: '산차',
})
parity: number;
@Column({ name: 'glucose', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '혈당' })
@Column({
name: 'glucose',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '혈당',
})
glucose: number;
@Column({ name: 'cholesterol', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '콜레스테롤' })
@Column({
name: 'cholesterol',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '콜레스테롤',
})
cholesterol: number;
@Column({ name: 'nefa', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '유리지방산(NEFA)' })
@Column({
name: 'nefa',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '유리지방산(NEFA)',
})
nefa: number;
@Column({ name: 'bcs', type: 'decimal', precision: 5, scale: 2, nullable: true, comment: 'BCS' })
@Column({
name: 'bcs',
type: 'decimal',
precision: 5,
scale: 2,
nullable: true,
comment: 'BCS',
})
bcs: number;
@Column({ name: 'total_protein', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '총단백질' })
@Column({
name: 'total_protein',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '총단백질',
})
totalProtein: number;
@Column({ name: 'albumin', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '알부민' })
@Column({
name: 'albumin',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '알부민',
})
albumin: number;
@Column({ name: 'globulin', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '총글로불린' })
@Column({
name: 'globulin',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '총글로불린',
})
globulin: number;
@Column({ name: 'ag_ratio', type: 'decimal', precision: 5, scale: 2, nullable: true, comment: 'A/G 비율' })
@Column({
name: 'ag_ratio',
type: 'decimal',
precision: 5,
scale: 2,
nullable: true,
comment: 'A/G 비율',
})
agRatio: number;
@Column({ name: 'bun', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '요소태질소(BUN)' })
@Column({
name: 'bun',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '요소태질소(BUN)',
})
bun: number;
@Column({ name: 'ast', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: 'AST' })
@Column({
name: 'ast',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: 'AST',
})
ast: number;
@Column({ name: 'ggt', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: 'GGT' })
@Column({
name: 'ggt',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: 'GGT',
})
ggt: number;
@Column({ name: 'fatty_liver_idx', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '지방간지수' })
@Column({
name: 'fatty_liver_idx',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '지방간지수',
})
fattyLiverIdx: number;
@Column({ name: 'calcium', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '칼슘' })
@Column({
name: 'calcium',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '칼슘',
})
calcium: number;
@Column({ name: 'phosphorus', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '인' })
@Column({
name: 'phosphorus',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '인',
})
phosphorus: number;
@Column({ name: 'ca_p_ratio', type: 'decimal', precision: 5, scale: 2, nullable: true, comment: '칼슘/인 비율' })
@Column({
name: 'ca_p_ratio',
type: 'decimal',
precision: 5,
scale: 2,
nullable: true,
comment: '칼슘/인 비율',
})
caPRatio: number;
@Column({ name: 'magnesium', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '마그네슘' })
@Column({
name: 'magnesium',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '마그네슘',
})
magnesium: number;
@Column({ name: 'creatinine', type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '크레아틴' })
@Column({
name: 'creatinine',
type: 'decimal',
precision: 10,
scale: 2,
nullable: true,
comment: '크레아틴',
})
creatinine: number;
// Relations