From 25c6cb131eb907b81279c947fe1eeb87b5f07850 Mon Sep 17 00:00:00 2001 From: mint thompson Date: Wed, 7 Feb 2024 15:32:28 -0500 Subject: [PATCH] collect last_updated_on --- schemavalidator.cpp | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/schemavalidator.cpp b/schemavalidator.cpp index 42d3d3f..514754a 100644 --- a/schemavalidator.cpp +++ b/schemavalidator.cpp @@ -184,7 +184,7 @@ string objectPathToString(list> &objectPath, string lastPart) bool firstSegment = true; if (objectPath.size() == 0) { - return result; + return lastPart; } else { @@ -222,13 +222,6 @@ string objectPathToString(list> &objectPath, string lastPart) return result; } -struct ItemCounter -{ - string schemaName; - list path; - int count; -}; - struct ItemReporter { string schemaName; @@ -243,6 +236,7 @@ struct MessageHandler : public BaseReaderHandler, MessageHandler> static list negotiatedPricePath; static list additionalInfoPath; static list inNetworkProviderGroupsPath; + static list lastUpdatedPath; enum State { @@ -252,7 +246,6 @@ struct MessageHandler : public BaseReaderHandler, MessageHandler> } state_; list objectPath; list> objectPathWithArrayIndices; - list pathsForCounting; list pathsForReporting; ItemReporter *currentReport; string lastKey; @@ -264,12 +257,11 @@ struct MessageHandler : public BaseReaderHandler, MessageHandler> objectPath = {}; state_ = traversingObject; schemaName = name; - // pathsForCounting = {{.schemaName = "in-network-rates", .path = negotiatedPricePath, .count = 0}, - // {.schemaName = "in-network-rates", .path = additionalInfoPath, .count = 0}}; - pathsForCounting = {}; pathsForReporting = {{.schemaName = "in-network-rates", .path = additionalInfoPath}, {.schemaName = "in-network-rates", .path = inNetworkProviderGroupsPath}, {.schemaName = "in-network-rates", .path = providerReferencePath}, + {.schemaName = "in-network-rates", .path = lastUpdatedPath}, + {.schemaName = "allowed-amounts", .path = lastUpdatedPath}, {.schemaName = "table-of-contents", .path = tocAllowedAmountPath}, {.schemaName = "table-of-contents", .path = tocInNetworkPath}}; reportWriter = &reportFile; @@ -297,16 +289,6 @@ struct MessageHandler : public BaseReaderHandler, MessageHandler> bool Key(const Ch *str, SizeType len, bool copy) { lastKey = string(str); - // check all counted things - // when processing a key, we can check paths that end with a key name - // for (auto &ic : pathsForCounting) - // { - // if (schemaName == ic.schemaName && ic.path.back() != "[]" && almostThere(ic.path)) - // { - // printf("found a count item by key! %s\n", objectPathToString(objectPath).c_str()); - // ++(ic.count); - // } - // } // when we get to a key that matches a path up until the end, // we want to stream a report until the path no longer matches. // if currentReport is not null, check if it's still valid. @@ -367,19 +349,6 @@ struct MessageHandler : public BaseReaderHandler, MessageHandler> objectPath.push_back(lastKey); objectPathWithArrayIndices.push_back(make_pair(lastKey, -1)); } - else - { - // lastKey is empty, which means that this object is an element of an array. - // so, check paths that end with "[]", because they want to count up array elements. - for (auto &countPath : pathsForCounting) - { - if (schemaName == countPath.schemaName && countPath.path.back() == "[]" && countPath.path == objectPath) - { - printf("found an item in an array! %s\n", objectPathToString(countPath.path).c_str()); - ++(countPath.count); - } - } - } if (currentReport != NULL) { reportWriter->StartObject(); @@ -620,6 +589,7 @@ list MessageHandler::tocAllowedAmountPath = {"reporting_structure", "[]" // list MessageHandler::negotiatedPricePath = {"in_network", "[]", "negotiated_rates", "[]", "negotiated_prices", "[]"}; list MessageHandler::additionalInfoPath = {"in_network", "[]", "negotiated_rates", "[]", "negotiated_prices", "[]", "additional_information"}; list MessageHandler::inNetworkProviderGroupsPath = {"in_network", "[]", "negotiated_rates", "[]", "provider_groups"}; +list MessageHandler::lastUpdatedPath = {"last_updated_on"}; int main(int argc, char *argv[]) {