Image indexing¶
Image indexing creates the metadata record for a scanned or received document image. The caller populates a clsImageIdx instance with file/category/document-type codes, a document date, and optional EAIP/agency/group context, then saves it. Before the row is written, the business rule set validates required fields, the document date, the category/type pairing, and external-view visibility; after the primary IMAGE row is inserted, up to three conditional sub-records are created depending on the image's context.
| Field | Value |
|---|---|
| Operation ID | OP-IMG-01 |
| Trigger | Caller sets image metadata on clsImageIdx (file code, category code, document type code, document date, and optional EAIP/agency/group fields) and calls Save() |
| Inputs | Image file/category/document-type codes, claim ID/number, document date, comment text, discovery flag, security level number, external view code, and EAIP period/agency/group context |
| Outputs | Persisted IMAGE row with a new IMAGE_SEQ_NUM; optionally a persisted IMAGE_EAIP, IMAGE_AGENCY, or IMAGE_GROUP row |
| Primary components | clsImageIdx.BeforeCreate, clsImageIdx.BeforeInsert, clsImageIdx.AfterInsert, clsImageIdx.AddBusinessRules |
| Entry point | Business\SAIF.Business.Imaging\clsImageIdx.vb |
Steps¶
- Caller sets image metadata on a new
clsImageIdxinstance, including file code, category code, document type code, document date, and (optionally) EAIP period, agency, or group context via the embeddedm_EAIPmember and other fields. - Validate required fields. While the record is locally dirty, the rule set requires non-empty
ImageFileCode,ImageDocumentTypeCode,ImageCategoryCode, and aDocumentDateother thanDate.MinValue(BR-IMG-02). - On failure: a broken rule with the corresponding required-field message is added and blocks
IsValid. - Validate the document date is not too far in the future. The document date must not exceed
Todayplus the record'sDocumentDateDaystolerance (BR-IMG-03). - On failure: a broken rule is added naming the allowed number of days.
- Validate the category/type pairing. The rule set executes SQL-029 against IMAGE_DOCUMENT_TYPE_CODE to confirm the selected document type belongs to the selected category and file code (BR-IMG-04).
- On failure (count = 0): a broken rule ("The Doc Type must be in the Doc Category") is added.
- Validate external-view visibility.
ExternalViewCode = "SHOW"is rejected whenDiscoveryFlag = "N"or whenSecurityLevelNum > 0(BR-IMG-05). - On failure: a broken rule is added identifying the conflicting condition (non-discoverable or secured).
- Generate the sequence number.
BeforeCreateexecutes SQL-002 to obtain the nextIMAGE_SEQ_NUMfromimage_seq.nextval(DUAL). - Insert the IMAGE row.
BeforeInsertexecutes SQL-010, binding 24 parameters, to insert the row into IMAGE. - Verify the insert.
AfterInsertconfirms exactly oneIMAGErow was affected. - On failure: an error is raised rather than allowing a partial index record.
- Conditionally insert EAIP context. If
m_EAIP.IsEAIP = True(the embeddedclsEAIP.EAIPPeriodSeqis populated),BeforeInsertexecutes SQL-007 to insert an IMAGE_EAIP row. - Conditionally insert agency context. If
ImageFileCode = "AGNCY",BeforeInsertexecutes SQL-008 to insert an IMAGE_AGENCY row. - Conditionally insert group context. If
ImageFileCode = "GROUP",BeforeInsertexecutes SQL-009 to insert an IMAGE_GROUP row. - Verify each secondary insert. Every conditional insert request (EAIP, agency, group) is individually checked for exactly one row affected.
- On failure: an error is raised for the failing secondary insert.
- Retrieve or update an existing index record.
BeforeRetrieveexecutes SQL-028 to load anIMAGErow joined with category/document-type code descriptions;BeforeUpdateexecutes SQL-036 to persist changes to an existing row.- Note:
clsImageIdxexposes aDeleteSQLproperty (SQL-043) but does not implement a liveBeforeDelete/AfterDeletepair, so direct deletion ofIMAGErows through this class is not functional in current code.**
- Note:
Process flow¶
The following diagram visualizes the image indexing operation's control flow, including validation and the conditional sub-record inserts.
flowchart TD
Start([Caller sets image metadata<br>and calls Save]) --> Validate[Validate required fields,<br>document date, cat/type match,<br>external-view visibility]
Validate --> VOk{Rules pass?}
VOk -->|No| Fail([Broken rules returned;<br>no insert attempted])
VOk -->|Yes| GenSeq[BeforeCreate: generate IMAGE_SEQ_NUM]
GenSeq --> InsertImage[BeforeInsert: INSERT IMAGE row]
InsertImage --> RowCheck{AfterInsert:<br>exactly 1 row?}
RowCheck -->|No| Error([Error: insert failed])
RowCheck -->|Yes| EAIPCheck{IsEAIP<br>= True?}
EAIPCheck -->|Yes| InsertEAIP[Insert IMAGE_EAIP]
EAIPCheck -->|No| AgencyCheck{ImageFileCode<br>= AGNCY?}
InsertEAIP --> AgencyCheck
AgencyCheck -->|Yes| InsertAgency[Insert IMAGE_AGENCY]
AgencyCheck -->|No| GroupCheck{ImageFileCode<br>= GROUP?}
InsertAgency --> GroupCheck
GroupCheck -->|Yes| InsertGroup[Insert IMAGE_GROUP]
GroupCheck -->|No| Done([Done: image indexed])
InsertGroup --> Done
Failure and edge-case behavior¶
AfterInsertrequires exactly oneIMAGErow affected; each secondary insert request (EAIP, agency, group) is also individually checked and raises an error on its own if it fails.clsImageIdx.DeleteSQLexists butclsImageIdxdoes not implement a liveBeforeDelete/AfterDeletepair, so direct deletion ofIMAGErows through this class is not functional in current code.**- Validation rules only run
If IsLocalDirty; records loaded from the database and not subsequently modified skip re-validation of required fields, document date, category/type match, and external-view visibility.
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
Business\SAIF.Business.Imaging\clsImageIdx.vbBusiness\SAIF.Business.Imaging\clsImageMsgConst.vbBusiness\SAIF.Business.Imaging\clsEAIP.vb