Importer consumes conflict-decisions.json to un-quarantine (HUMANQUESTION D)
god maintains tools/import/conflict-decisions.json as Julian/his wife answer the D-conflicts. extract.py now consumes it (apply_conflict_decisions): for an animal matching normalize(name)+dob, it clears the conflict, marks resolvedByDecision, and — when the decision carries a `genotype` (breeder notation, parsed via genotype.py) and/or `farbschlag` — treats those as AUTHORITATIVE. Tolerates a missing/empty/garbled file. Genuinely-unresolved conflicts stay quarantined. Loader (ImportService): SourceAnimal.ResolvedByDecision flows through; the report surfaces Animals.ConflictsResolvedByDecision + a German note. Result on real data: the 2 current decisions (Firefly D-/PP, WildFire PP) un-quarantine → Konflikte 21 → 19. As god appends entries the count grows; nothing else needed from me. Tests: python test_extract (decision clears conflict + genotype authoritative + removes from conflicts list + tolerates missing file) and a C# loader test (a resolved animal loads and is counted). Folded into the EXTRACT-BANDS branch so the next re-extract applies band-aware Farbschlag + these decisions in one pass. No schema change (JSON DTO fields). python + dotnet 121/121 green; has-pending clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -278,6 +278,33 @@ namespace GerbilManager.Tests
|
||||
finally { try { Directory.Delete(dir, recursive: true); } catch { } }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Decision_resolved_animal_loads_and_is_counted()
|
||||
{
|
||||
// extract.py clears the conflict + sets resolvedByDecision when a human conflict-decision
|
||||
// un-quarantines an animal; the loader must then LOAD it and surface the count.
|
||||
var dir = Path.Combine(Path.GetTempPath(), "dec-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(dir);
|
||||
try
|
||||
{
|
||||
File.WriteAllText(Path.Combine(dir, "litters.json"), "[]");
|
||||
File.WriteAllText(Path.Combine(dir, "animals.json"), """
|
||||
[
|
||||
{"id":"firefly","name":"Firefly","dob":"18.12.2019","death":"","farbschlag":"Agouti",
|
||||
"genotype":{"mapped8locus":{"A":["A","a"],"D":["D","?"]},"rawGenotype":"Aa D-","unmappedTokens":[]},
|
||||
"conflict":false,"resolvedByDecision":true}
|
||||
]
|
||||
""");
|
||||
using var db = NewDb();
|
||||
var report = await new ImportService(db, dir, dir).RunAsync(execute: true);
|
||||
|
||||
Assert.Equal(1, report.Animals.ConflictsResolvedByDecision);
|
||||
Assert.True(await db.Gerbils.AnyAsync(g => g.ExternalRef == "firefly")); // loaded, not quarantined
|
||||
Assert.Equal(0, report.Animals.Quarantined.Conflicts);
|
||||
}
|
||||
finally { try { Directory.Delete(dir, recursive: true); } catch { } }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ComposeGenotype_strips_carets_and_fills_missing_loci()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user