@finsys/core 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +19 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9461,7 +9461,7 @@ function formatValue(value, numeric) {
|
|
|
9461
9461
|
}
|
|
9462
9462
|
return String(value);
|
|
9463
9463
|
}
|
|
9464
|
-
function buildTableForGroup(groupName, fields, ihsData) {
|
|
9464
|
+
function buildTableForGroup(groupName, fields, ihsData, fieldProvenance) {
|
|
9465
9465
|
const allColumns = [];
|
|
9466
9466
|
for (const field of fields) {
|
|
9467
9467
|
if (field.ihs_column_names) {
|
|
@@ -9480,11 +9480,20 @@ function buildTableForGroup(groupName, fields, ihsData) {
|
|
|
9480
9480
|
const numeric = isNumericField(baseName);
|
|
9481
9481
|
const data = {};
|
|
9482
9482
|
const formattedData = {};
|
|
9483
|
+
const confidence = {};
|
|
9484
|
+
const provenance = {};
|
|
9483
9485
|
for (const period of periods) {
|
|
9484
9486
|
const colName = periodMap[period];
|
|
9485
9487
|
const value = colName ? ihsData[colName] ?? null : null;
|
|
9486
9488
|
data[period] = value;
|
|
9487
9489
|
formattedData[period] = formatValue(value, numeric);
|
|
9490
|
+
const prov = colName ? fieldProvenance?.[colName] : void 0;
|
|
9491
|
+
if (prov) {
|
|
9492
|
+
provenance[period] = prov;
|
|
9493
|
+
if (prov.origin === "extracted" && typeof prov.confidence === "number" && !Number.isNaN(prov.confidence)) {
|
|
9494
|
+
confidence[period] = prov.confidence;
|
|
9495
|
+
}
|
|
9496
|
+
}
|
|
9488
9497
|
}
|
|
9489
9498
|
items.push({
|
|
9490
9499
|
displayName: getDisplayName(baseName),
|
|
@@ -9492,7 +9501,9 @@ function buildTableForGroup(groupName, fields, ihsData) {
|
|
|
9492
9501
|
data,
|
|
9493
9502
|
formattedData,
|
|
9494
9503
|
type: tableType,
|
|
9495
|
-
isNumeric: numeric
|
|
9504
|
+
isNumeric: numeric,
|
|
9505
|
+
...Object.keys(confidence).length ? { confidence } : {},
|
|
9506
|
+
...Object.keys(provenance).length ? { provenance } : {}
|
|
9496
9507
|
});
|
|
9497
9508
|
}
|
|
9498
9509
|
const hasData = items.some(
|
|
@@ -9504,13 +9515,16 @@ function buildTableForGroup(groupName, fields, ihsData) {
|
|
|
9504
9515
|
for (const colName of allColumns) {
|
|
9505
9516
|
const value = ihsData[colName] ?? null;
|
|
9506
9517
|
const numeric = isNumericField(colName);
|
|
9518
|
+
const prov = fieldProvenance?.[colName];
|
|
9507
9519
|
items.push({
|
|
9508
9520
|
displayName: getDisplayName(colName),
|
|
9509
9521
|
timePeriods: [],
|
|
9510
9522
|
data: { value },
|
|
9511
9523
|
formattedData: { value: formatValue(value, numeric) },
|
|
9512
9524
|
type: tableType,
|
|
9513
|
-
isNumeric: numeric
|
|
9525
|
+
isNumeric: numeric,
|
|
9526
|
+
...prov && prov.origin === "extracted" && typeof prov.confidence === "number" && !Number.isNaN(prov.confidence) ? { confidence: { value: prov.confidence } } : {},
|
|
9527
|
+
...prov ? { provenance: { value: prov } } : {}
|
|
9514
9528
|
});
|
|
9515
9529
|
}
|
|
9516
9530
|
const hasData = items.some((item) => {
|
|
@@ -9520,13 +9534,13 @@ function buildTableForGroup(groupName, fields, ihsData) {
|
|
|
9520
9534
|
return { name: groupName, displayName: groupDisplayName, type: tableType, items, hasData };
|
|
9521
9535
|
}
|
|
9522
9536
|
}
|
|
9523
|
-
function buildFileFieldTables(ihsData) {
|
|
9537
|
+
function buildFileFieldTables(ihsData, fieldProvenance) {
|
|
9524
9538
|
const specs = getBaseFieldSpecs();
|
|
9525
9539
|
const fileFields = specs.filter((f) => f.type === "file" && f.ihs_column_names?.length);
|
|
9526
9540
|
const grouped = groupFieldsByPattern(fileFields);
|
|
9527
9541
|
const tables = {};
|
|
9528
9542
|
for (const [groupName, fields] of Object.entries(grouped)) {
|
|
9529
|
-
const table = buildTableForGroup(groupName, fields, ihsData);
|
|
9543
|
+
const table = buildTableForGroup(groupName, fields, ihsData, fieldProvenance);
|
|
9530
9544
|
if (table && table.hasData) {
|
|
9531
9545
|
tables[groupName] = table;
|
|
9532
9546
|
}
|