Coverage for src / local_deep_research / advanced_search_system / evidence / requirements.py: 64%

11 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2026-01-11 00:51 +0000

1""" 

2Evidence requirements for different constraint types. 

3""" 

4 

5from typing import Dict, List 

6 

7from ..constraints.base_constraint import ConstraintType 

8 

9 

10class EvidenceRequirements: 

11 """Define evidence requirements for different constraint types.""" 

12 

13 @staticmethod 

14 def get_requirements( 

15 constraint_type: ConstraintType, 

16 ) -> Dict[str, List[str]]: 

17 """Get evidence requirements for a constraint type. 

18 

19 Args: 

20 constraint_type: The type of constraint 

21 

22 Returns: 

23 Dictionary of evidence types and their sources 

24 """ 

25 requirements = { 

26 ConstraintType.PROPERTY: { 

27 "preferred": ["direct_statement", "official_record"], 

28 "acceptable": ["research_finding", "inference"], 

29 "sources": [ 

30 "scientific papers", 

31 "official documents", 

32 "encyclopedias", 

33 ], 

34 }, 

35 ConstraintType.NAME_PATTERN: { 

36 "preferred": ["direct_statement", "linguistic_analysis"], 

37 "acceptable": ["correlation", "inference"], 

38 "sources": [ 

39 "etymology sources", 

40 "naming databases", 

41 "historical records", 

42 ], 

43 }, 

44 ConstraintType.EVENT: { 

45 "preferred": ["news_report", "official_record"], 

46 "acceptable": ["testimonial", "correlation"], 

47 "sources": [ 

48 "news archives", 

49 "government reports", 

50 "witness accounts", 

51 ], 

52 }, 

53 ConstraintType.STATISTIC: { 

54 "preferred": ["statistical_data", "official_record"], 

55 "acceptable": ["research_finding"], 

56 "sources": [ 

57 "government databases", 

58 "research papers", 

59 "official reports", 

60 ], 

61 }, 

62 ConstraintType.TEMPORAL: { 

63 "preferred": ["official_record", "news_report"], 

64 "acceptable": ["historical_record", "inference"], 

65 "sources": ["archives", "newspapers", "official timelines"], 

66 }, 

67 ConstraintType.LOCATION: { 

68 "preferred": ["geographical_data", "official_record"], 

69 "acceptable": ["mapping_data", "inference"], 

70 "sources": [ 

71 "geographical surveys", 

72 "maps", 

73 "location databases", 

74 ], 

75 }, 

76 ConstraintType.COMPARISON: { 

77 "preferred": ["statistical_comparison", "research_finding"], 

78 "acceptable": ["inference", "correlation"], 

79 "sources": [ 

80 "comparative studies", 

81 "statistical analyses", 

82 "research papers", 

83 ], 

84 }, 

85 ConstraintType.EXISTENCE: { 

86 "preferred": ["direct_statement", "official_record"], 

87 "acceptable": ["news_report", "inference"], 

88 "sources": [ 

89 "official registries", 

90 "databases", 

91 "authoritative sources", 

92 ], 

93 }, 

94 } 

95 

96 return requirements.get( 

97 constraint_type, 

98 { 

99 "preferred": ["direct_statement"], 

100 "acceptable": ["inference"], 

101 "sources": ["general sources"], 

102 }, 

103 ) 

104 

105 @staticmethod 

106 def get_minimum_confidence(constraint_type: ConstraintType) -> float: 

107 """Get minimum confidence required for constraint type. 

108 

109 Args: 

110 constraint_type: The type of constraint 

111 

112 Returns: 

113 Minimum confidence threshold 

114 """ 

115 thresholds = { 

116 ConstraintType.STATISTIC: 0.8, # High accuracy needed 

117 ConstraintType.EVENT: 0.7, # Moderate accuracy 

118 ConstraintType.PROPERTY: 0.6, # Some flexibility 

119 ConstraintType.NAME_PATTERN: 0.5, # More interpretive 

120 } 

121 

122 return thresholds.get(constraint_type, 0.6)