Merged in feature/multichecks (pull request #153)

Multiple Checks in a Cell

* multi
This commit is contained in:
Michael McGuinness
2025-05-23 11:57:14 +00:00
parent 7221100037
commit c2d06fc5a7
6 changed files with 9230 additions and 6 deletions
Binary file not shown.
+1 -1
View File
@@ -1296,7 +1296,7 @@ Start of Page No. = 27
EXHIBIT B-3 EXHIBIT B-3
COMPENSATION COMPENSATION
-------Table Start-------- -------Table Start--------
[["Applicable Benefit Plan(s):","Dual Special Needs Plan (D-SNP) Does not participate in D-SNP"],["Applicable Benefit Plan(s):","Local Mental Health Authority (LMHA)"],["Applicable Benefit Plan(s):","Chemical Dependency (CD) Treatment Facility"],["Provider Type:","Early Childhood Intervention (ECI) Provider"],["Provider Type:","Mental Health Targeted Case Management"],["Provider Type:","Non- Local Mental Health Authority (LMHA)"],["Provider Type:","Behavioral Health Services"],["Services:","Mental Health Targeted Case Management"],["","Mental Health Rehabilitative Services"]] [["Applicable Benefit Plan(s):","Dual Special Needs Plan (D-SNP) Does not participate in D-SNP"]]
-------Table End-------- -------Table End--------
Physician/Provider does not participate in above plan/program Physician/Provider does not participate in above plan/program
chat chat
+10
View File
@@ -0,0 +1,10 @@
Start of Page No. = 1
EXHIBIT B-3
COMPENSATION
-------Table Start--------
[["Applicable Benefit Plan(s):","Dual Special Needs Plan (D-SNP) Does not participate in D-SNP"]]
-------Table End--------
Physician/Provider does not participate in above plan/program.
File diff suppressed because it is too large Load Diff
@@ -104,6 +104,25 @@ func TestGetDocumentText(t *testing.T) {
assertReaders(t, txtFile, text) assertReaders(t, txtFile, text)
}) })
t.Run("table_select", func(t *testing.T) {
t.Parallel()
cfg := DocTextConfig{}
svc := Service{
cfg: &cfg,
}
mockTextract := textractmock.NewMockTextractClient(t)
cfg.TextractClient = mockTextract
textractBaseOut, pdf, txtFile, close := getFiles(t, "table_select")
defer close()
textExpectations(t, ctx, mockTextract, pdf, textractBaseOut)
text, err := svc.getDocumentText(ctx, pdf)
require.NoError(t, err)
assertReaders(t, txtFile, text)
})
t.Run("multi_column", func(t *testing.T) { t.Run("multi_column", func(t *testing.T) {
t.Parallel() t.Parallel()
cfg := DocTextConfig{} cfg := DocTextConfig{}
+20 -5
View File
@@ -30,7 +30,7 @@ func (s *Service) addTable(ctx context.Context, id uuid.UUID, blockMap map[uuid.
invalidRows := make([]bool, params.maxRow+1) invalidRows := make([]bool, params.maxRow+1)
for _, cell := range params.table { for _, cell := range params.table {
if !cell.isSelected && cell.column == 0 { if !cell.isSelected {
invalidRows[cell.row] = true invalidRows[cell.row] = true
} }
} }
@@ -117,19 +117,34 @@ func (s *Service) addComponentTable(ctx context.Context, id uuid.UUID, blockMap
func (s *Service) getCellContent(id uuid.UUID, blockMap map[uuid.UUID]types.Block) (string, bool) { func (s *Service) getCellContent(id uuid.UUID, blockMap map[uuid.UUID]types.Block) (string, bool) {
var str strings.Builder var str strings.Builder
isSelected := true var isSelected *bool
for _, uid := range s.getRelationshipIds(blockMap[id]) { for _, uid := range s.getRelationshipIds(blockMap[id]) {
if blockMap[uid].BlockType == types.BlockTypeWord { if blockMap[uid].BlockType == types.BlockTypeWord {
if str.String() != "" { if str.String() != "" {
str.WriteRune(' ') str.WriteRune(' ')
} }
str.WriteString(*blockMap[uid].Text) str.WriteString(*blockMap[uid].Text)
} else if blockMap[uid].BlockType == types.BlockTypeSelectionElement && blockMap[uid].SelectionStatus == types.SelectionStatusNotSelected { }
isSelected = false
if blockMap[uid].BlockType != types.BlockTypeSelectionElement {
continue
}
if isSelected == nil || !*isSelected {
selected := true
if blockMap[uid].SelectionStatus == types.SelectionStatusNotSelected {
selected = false
}
isSelected = &selected
} }
} }
return str.String(), isSelected selected := true
if isSelected != nil {
selected = *isSelected
}
return str.String(), selected
} }
func (s *Service) addCellToTable(rowIndex int, columnIndex int, content string, isSelected bool, params *tableParams) { func (s *Service) addCellToTable(rowIndex int, columnIndex int, content string, isSelected bool, params *tableParams) {