feat(ucca): Advisor obligation-status Durchstich (step 3 complete)
AssessObligationStatus traverses obligation_id -> (citation_unit) -> accepted controls -> required evidence -> status (erfuellt|offen|unklar). Evidence presence is a callback; MVP passes nil (nothing collected yet) -> offen. citation_spans = "pending" until the Legal-Knowledge-Graph session attaches them. This is the vertical slice that makes the graph a product feature: "CRA obligation fulfilled because evidence X/Y/Z is present", not "a doc exists". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -146,3 +146,36 @@ func ComputeObligationCoverage(joins *ObligationJoinKeys, mappings *ControlMappi
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// AcceptedControlsForObligation returns our accepted control mappings that reach an
|
||||
// obligation via the interim citation_unit join (deduped by target control).
|
||||
func AcceptedControlsForObligation(ob ObligationKey, mappings *ControlMappingSet) []ControlMapping {
|
||||
keys := make(map[string]bool, len(ob.CitationUnits))
|
||||
for _, cu := range ob.CitationUnits {
|
||||
keys[citationUnitKey(cu)] = true
|
||||
}
|
||||
out := []ControlMapping{}
|
||||
seen := map[string]bool{}
|
||||
for _, m := range mappings.All {
|
||||
if !m.IsAccepted() || !keys[citationUnitKey(m.SourceNorm)] {
|
||||
continue
|
||||
}
|
||||
ck := m.TargetFramework + ":" + m.TargetControl
|
||||
if seen[ck] {
|
||||
continue
|
||||
}
|
||||
seen[ck] = true
|
||||
out = append(out, m)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// FindObligation returns the registry entry for an obligation_id (nil if unknown).
|
||||
func (o *ObligationJoinKeys) FindObligation(obligationID string) *ObligationKey {
|
||||
for i := range o.ObligationIDs {
|
||||
if o.ObligationIDs[i].ObligationID == obligationID {
|
||||
return &o.ObligationIDs[i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user