mitai-jinkendo/frontend/src/utils/referenceValueMeta.js
Lars 296e79c3b3
All checks were successful
Deploy Development / deploy (push) Successful in 46s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
feat: Implement reference value types reordering and confidence level sorting
- Added a new API endpoint for reordering reference value types based on user-defined order.
- Updated the AdminReferenceValueTypesPage to allow users to reorder types using up/down buttons.
- Introduced a consistent confidence level sorting mechanism across the application.
- Refactored related components to remove unused sort order fields and improve user experience.
2026-04-06 21:40:55 +02:00

60 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** Labels für Referenzwert-Metadaten (Erfassung). */
export const REF_SOURCE_LABELS = {
manual_user: 'Manuell (Nutzer)',
manual_admin: 'Manuell (Admin)',
import_device: 'Import Gerät',
import_app: 'Import App',
derived_system: 'Abgeleitet (System)',
estimated_system: 'Geschätzt (System)',
test_entry: 'Testeintrag',
}
export const REF_METHOD_LABELS = {
direct_measurement: 'Direkte Messung',
lab_test: 'Labortest',
field_test: 'Feldtest',
questionnaire: 'Fragebogen',
formula_estimation: 'Formel-Schätzung',
trend_analysis: 'Trendanalyse',
device_algorithm: 'Geräte-Algorithmus',
manual_assessment: 'Manuelle Einschätzung',
imported_external: 'Extern importiert',
unknown: 'Unbekannt',
}
export const REF_CONFIDENCE_LABELS = {
high: 'Hoch',
medium: 'Mittel',
low: 'Niedrig',
unknown: 'Unbekannt',
}
/** Reihenfolge für Dropdowns (nicht alphabetisch) */
export const REF_CONFIDENCE_ORDER = ['high', 'medium', 'low', 'unknown']
export function sortConfidenceKeys(keys) {
if (!Array.isArray(keys)) return []
const known = REF_CONFIDENCE_ORDER.filter((k) => keys.includes(k))
const rest = [...keys].filter((k) => !REF_CONFIDENCE_ORDER.includes(k)).sort()
return [...known, ...rest]
}
export function labelSource(k) {
return REF_SOURCE_LABELS[k] || k || ''
}
export function labelMethod(k) {
return REF_METHOD_LABELS[k] || k || ''
}
export function labelConfidence(k) {
return REF_CONFIDENCE_LABELS[k] || k || ''
}
export const VALUE_DATA_TYPE_LABELS = {
integer: 'Ganzzahl',
decimal: 'Dezimalzahl',
percentage: 'Prozent',
text: 'Text',
enum: 'Auswahl (ENUM)',
}