Skip to content

SF-3777 Retrieve confidence data and calculate book level scores#3876

Open
pmachapman wants to merge 7 commits into
masterfrom
fix/SF-3777
Open

SF-3777 Retrieve confidence data and calculate book level scores#3876
pmachapman wants to merge 7 commits into
masterfrom
fix/SF-3777

Conversation

@pmachapman
Copy link
Copy Markdown
Collaborator

@pmachapman pmachapman commented May 12, 2026

This PR adds a card to the Serval Builds tab with Quality Estimation, allowing downloading of book and chapter data in a format very similar to SILNLP:

image

This change is Reviewable

@pmachapman pmachapman changed the title SF-3777 Retrieve confidence data and calculate book level scores WIP: SF-3777 Retrieve confidence data and calculate book level scores May 12, 2026
@pmachapman pmachapman marked this pull request as draft May 12, 2026 19:50
Comment thread src/SIL.XForge.Scripture/Services/MachineApiService.cs Fixed
Comment thread src/SIL.XForge.Scripture/Services/MachineApiService.cs Dismissed
@pmachapman pmachapman temporarily deployed to screenshot_diff May 12, 2026 19:57 — with GitHub Actions Inactive
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 81.36201% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.16%. Comparing base (021000d) to head (d35360f).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...administration/build-confidences-export.service.ts 3.33% 29 Missing ⚠️
...p/serval-administration/serval-builds.component.ts 23.52% 12 Missing and 1 partial ⚠️
...c/app/serval-administration/base-export-service.ts 71.42% 0 Missing and 2 partials ⚠️
src/SIL.XForge.Scripture/Models/VerseRefData.cs 81.81% 1 Missing and 1 partial ⚠️
...SIL.XForge.Scripture/Services/MachineApiService.cs 98.42% 0 Missing and 2 partials ⚠️
...orge.Scripture/Controllers/MachineApiController.cs 95.83% 0 Missing and 1 partial ⚠️
...aAccess/SFDataAccessServiceCollectionExtensions.cs 50.00% 1 Missing ⚠️
src/SIL.XForge.Scripture/Models/DraftMetrics.cs 95.00% 1 Missing ⚠️
...XForge.Scripture/Services/PreTranslationService.cs 95.65% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3876      +/-   ##
==========================================
+ Coverage   81.05%   81.16%   +0.11%     
==========================================
  Files         630      635       +5     
  Lines       40690    40924     +234     
  Branches     6603     6633      +30     
==========================================
+ Hits        32983    33218     +235     
+ Misses       6673     6663      -10     
- Partials     1034     1043       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pmachapman pmachapman temporarily deployed to screenshot_diff May 12, 2026 20:41 — with GitHub Actions Inactive
@pmachapman pmachapman force-pushed the fix/SF-3777 branch 2 times, most recently from d198099 to a2f3758 Compare May 13, 2026 04:14
@pmachapman pmachapman changed the title WIP: SF-3777 Retrieve confidence data and calculate book level scores SF-3777 Retrieve confidence data and calculate book level scores May 13, 2026
@pmachapman pmachapman added the will require testing PR should not be merged until testers confirm testing is complete label May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

📸 Screenshot diff deployed! (4 changes)

View the visual diff at: https://pr-3876--sf-screenshot-diffs.netlify.app

@pmachapman pmachapman temporarily deployed to screenshot_diff May 13, 2026 04:21 — with GitHub Actions Inactive
@pmachapman pmachapman marked this pull request as ready for review May 13, 2026 04:22
@pmachapman pmachapman temporarily deployed to screenshot_diff May 17, 2026 21:42 — with GitHub Actions Inactive
@pmachapman pmachapman temporarily deployed to screenshot_diff May 19, 2026 00:45 — with GitHub Actions Inactive
@RaymondLuong3 RaymondLuong3 self-assigned this May 19, 2026
Copy link
Copy Markdown
Collaborator

@RaymondLuong3 RaymondLuong3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is exciting to be one step closer to introducing book and chapter level quality estimates to users!

@RaymondLuong3 reviewed 33 files and all commit messages, and made 7 comments.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on pmachapman).


src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/serval-builds.component.ts line 269 at r3 (raw file):

    } else {
      this.buildConfidencesExportService.exportCsv(rows, this.dateRange$.value);
    }

I think this should be exportRsv.

Code quote:

    } else {
      this.buildConfidencesExportService.exportCsv(rows, this.dateRange$.value);
    }

src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/serval-builds.component.ts line 278 at r3 (raw file):

    } else {
      this.buildConfidencesExportService.exportCsv(rows, this.dateRange$.value);
    }

I think this should be exportTsv

Code quote:

    } else {
      this.buildConfidencesExportService.exportCsv(rows, this.dateRange$.value);
    }

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/build-confidences/display-confidence.component.html line 11 at r2 (raw file):

    <div class="confidence red"><mat-icon>warning</mat-icon> Likely poor quality</div>
  }
}

Looks like this is likely to be shown to the user and needs to be localized. Oh yes, I see below you mention that this is only visible from the serval admin tab right now.

Code quote:

@switch (usabilityLabel) {
  @case ("Green") {
    <div class="confidence green"><mat-icon>check</mat-icon> Likely good quality</div>
  }
  @case ("Yellow") {
    <div class="confidence yellow"><mat-icon class="filled">circle</mat-icon> Likely moderate quality</div>
  }
  @case ("Red") {
    <div class="confidence red"><mat-icon>warning</mat-icon> Likely poor quality</div>
  }
}

src/SIL.XForge.Scripture/Services/MachineApiService.cs line 3100 at r3 (raw file):

                List<ScriptureSegmentUsability> _, // We do not require segment level confidence values
                List<ScriptureChapterUsability> usabilityChapters,
                List<ScriptureBookUsability> usabilityBooks

I know the name is already in Machine so I understand why the variables are named this way, but I have a hard time understanding the meaning of usabilityChapters and usabilityBooks. However, I'm not sure I have a good suggestion

Code quote:

                List<ScriptureSegmentUsability> _, // We do not require segment level confidence values
                List<ScriptureChapterUsability> usabilityChapters,
                List<ScriptureBookUsability> usabilityBooks

src/SIL.XForge.Scripture/Services/PreTranslationService.cs line 68 at r3 (raw file):

            // Get the references - old builds will only have Refs specified,
            // newer builds will have TargetRefs with Refs containing the same values
            List<string> references = [.. preTranslation.TargetRefs];

It seems strange that old builds use Refs, but this code is changing it from using TargetRefs to TargetRefs or Refs. This seems to me that we are introducing Refs as a new fallback. What am I missing?

Code quote:

            // Get the references - old builds will only have Refs specified,
            // newer builds will have TargetRefs with Refs containing the same values
            List<string> references = [.. preTranslation.TargetRefs];

test/SIL.XForge.Scripture.Tests/Services/MachineApiServiceTests.cs line 2335 at r3 (raw file):

        );

        using (Assert.EnterMultipleScope())

This is neat. I haven't encountered this before, but nice to see a way to identify multiple failures within a block.

Code quote:

       using (Assert.EnterMultipleScope())

Copy link
Copy Markdown
Collaborator Author

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmachapman made 5 comments and resolved 1 discussion.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on RaymondLuong3).


src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/serval-builds.component.ts line 269 at r3 (raw file):

Previously, RaymondLuong3 (Raymond Luong) wrote…

I think this should be exportRsv.

Done. Thank you!


src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/serval-builds.component.ts line 278 at r3 (raw file):

Previously, RaymondLuong3 (Raymond Luong) wrote…

I think this should be exportTsv

Done. Thank you!


src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/build-confidences/display-confidence.component.html line 11 at r2 (raw file):

Previously, RaymondLuong3 (Raymond Luong) wrote…

Looks like this is likely to be shown to the user and needs to be localized. Oh yes, I see below you mention that this is only visible from the serval admin tab right now.

This will be localized when the wording is finalized. I thought it might be a bit of a waste of effort to localize it at this early stage.


src/SIL.XForge.Scripture/Services/MachineApiService.cs line 3100 at r3 (raw file):

Previously, RaymondLuong3 (Raymond Luong) wrote…

I know the name is already in Machine so I understand why the variables are named this way, but I have a hard time understanding the meaning of usabilityChapters and usabilityBooks. However, I'm not sure I have a good suggestion

I agree - the names are from the names used by machine, which are consistent with silnlp. I'm not sure what else to call them, without breaking that consistency.


src/SIL.XForge.Scripture/Services/PreTranslationService.cs line 68 at r3 (raw file):

Previously, RaymondLuong3 (Raymond Luong) wrote…

It seems strange that old builds use Refs, but this code is changing it from using TargetRefs to TargetRefs or Refs. This seems to me that we are introducing Refs as a new fallback. What am I missing?

Refs are used by the old corpora format, which does not have TargetRefs specified (this code fixes a bug I noticed). The new corpora format uses TargetRefs/SourceRefs. SF should use SourceRefs, but these are currently blank in Serval due to a bug which is being fixed in the next release. When that is done, I will need to implement support for SourceRefs for drafts made with that version of Serval onwards.

Copy link
Copy Markdown
Collaborator

@RaymondLuong3 RaymondLuong3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RaymondLuong3 reviewed 4 files and all commit messages, made 1 comment, and resolved 5 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on pmachapman).


src/SIL.XForge.Scripture/Services/PreTranslationService.cs line 68 at r3 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

Refs are used by the old corpora format, which does not have TargetRefs specified (this code fixes a bug I noticed). The new corpora format uses TargetRefs/SourceRefs. SF should use SourceRefs, but these are currently blank in Serval due to a bug which is being fixed in the next release. When that is done, I will need to implement support for SourceRefs for drafts made with that version of Serval onwards.

Ok, got it. Thanks for the extra details.

@RaymondLuong3 RaymondLuong3 added ready to test and removed will require testing PR should not be merged until testers confirm testing is complete labels May 19, 2026
@pmachapman pmachapman temporarily deployed to screenshot_diff May 19, 2026 22:05 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants