DiseaseImporter
Internal members (not exported)
Operations
MergeDisease #
Import disease data, merging when requested.
Signature:
Public Function MergeDisease(ByVal targetTable As ListObject, ByVal sourceTable As ListObject, _
Optional ByVal mergeValues As Boolean = True, _
Optional ByVal priority As DiseaseImportPriority = DiseaseImportPriority_Foreign, _
Optional ByVal logger As IDiseaseLogger = Nothing) As IDiseaseImportSummary
Replacement
ReplaceTable #
Replace the target table with the source content.
Signature:
Private Sub ReplaceTable(ByVal targetTable As ListObject, ByVal sourceTable As ListObject, ByVal summary As DiseaseImportSummary, ByVal logger As IDiseaseLogger)
Merge
MergeTables #
Merge the source data into the target according to the priority.
Signature:
Private Sub MergeTables(ByVal targetTable As ListObject, ByVal sourceTable As ListObject, ByVal priority As DiseaseImportPriority, ByVal summary As DiseaseImportSummary, ByVal logger As IDiseaseLogger)
BuildTargetIndex #
Build lookup structures for target variables.
Signature:
Private Function BuildTargetIndex(ByVal targetData As Variant, ByVal targetRows As Long, ByRef targetIndex As Collection) As String()
ApplyMerge #
Perform the merge between target and source matrices.
Signature:
Private Sub ApplyMerge(ByRef targetData As Variant, ByRef sourceData As Variant, ByVal targetRows As Long, ByVal sourceRows As Long, _
ByVal columnCount As Long, ByVal priority As DiseaseImportPriority, ByVal targetIndex As Collection, _
ByVal seenSource As Collection, ByVal appendedRows As BetterArray, ByVal summary As DiseaseImportSummary, ByVal logger As IDiseaseLogger)
AppendImportedRows #
Append merged rows to the target ListObject.
Signature:
Private Sub AppendImportedRows(ByVal targetTable As ListObject, ByVal appendedRows As BetterArray, ByVal logger As IDiseaseLogger)
RegisterMissingVariables #
Determine which existing variables were missing from the import.
Signature:
Private Sub RegisterMissingVariables(ByVal targetData As Variant, ByVal targetRows As Long, ByVal targetNames() As String, ByVal seenSource As Collection, ByVal summary As DiseaseImportSummary, ByVal logger As IDiseaseLogger)
Table Utilities
ClearTable #
Remove all rows from the ListObject.
Signature:
Private Sub ClearTable(ByVal targetTable As ListObject)
AppendBlankRows #
Append blank rows to the target table.
Signature:
Private Sub AppendBlankRows(ByVal targetTable As ListObject, ByVal rowCount As Long)
BuildRow #
Create a row array from the source matrix.
Signature:
Private Function BuildRow(ByRef sourceData As Variant, ByVal rowIndex As Long, ByVal columnCount As Long) As Variant
ConvertRowsToMatrix #
Convert a BetterArray of rows into a contiguous matrix.
Signature:
Private Function ConvertRowsToMatrix(ByVal rows As BetterArray, ByVal appendCount As Long, ByVal columnCount As Long) As Variant
Ensure2D #
Convert single values into 2D matrices when necessary.
Signature:
Private Function Ensure2D(ByVal values As Variant, ByVal columnCount As Long) As Variant
Collections
AddIfMissing #
Add row index to collection if the key is missing.
Signature:
Private Sub AddIfMissing(ByVal index As Collection, ByVal key As String, ByVal rowIndex As Long)
AddIfMissingValue #
Register presence of a source variable.
Signature:
Private Sub AddIfMissingValue(ByVal seenSource As Collection, ByVal key As String)
LookupRow #
Read a row index from the collection.
Signature:
Private Function LookupRow(ByVal index As Collection, ByVal key As String) As Long
CollectionContains #
Test whether the collection contains the supplied key.
Signature:
Private Function CollectionContains(ByVal values As Collection, ByVal key As String) As Boolean
Validation
ValidateTable #
Guard against invalid ListObject references.
Signature:
Private Sub ValidateTable(ByVal table As ListObject, ByVal argumentName As String)
Text Helpers
Normalize #
Normalise identifiers for comparison.
Signature:
Private Function Normalize(ByVal value As String) As String
ErrorHandling
ThrowError #
Centralised error raising aligned with ProjectError codes.
Signature:
Private Sub ThrowError(ByVal errNumber As ProjectError, ByVal errMessage As String)