Skip to content

Commit

Permalink
updated set_data with payload
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Staar <[email protected]>
  • Loading branch information
PeterStaar-IBM committed Dec 3, 2024
1 parent 07df129 commit a7b88fa
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,14 @@ namespace andromeda

std::string base = parts.at(1);
std::size_t index = std::stoi(parts.at(2));

auto& item = orig.at(base).at(index);

if(is_text.count(prov->get_type()))
{
std::stringstream ss;
ss << doc_name << "#/" << doc_type::texts_lbl << "/" << texts.size();

std::string dloc = ss.str();

auto subj = std::make_shared<subject<TEXT> >(doc.get_hash(), dloc, prov);
Expand Down
9 changes: 9 additions & 0 deletions src/andromeda/tooling/structs/subjects/figure.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ namespace andromeda
{
base_subject::valid = true;

if(data.count(payload_lbl))
{
payload = data.value(payload_lbl, payload);
}
else
{
payload = nlohmann::json::value_t::null;
}

return base_subject::valid;
}

Expand Down
9 changes: 9 additions & 0 deletions src/andromeda/tooling/structs/subjects/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ namespace andromeda

data.clear();

if(item.count(payload_lbl))
{
payload = item.value(payload_lbl, payload);
}
else
{
payload = nlohmann::json::value_t::null;
}

{
conf = item.value(base_subject::confidence_lbl, conf);
created_by = item.value(base_subject::created_by_lbl, created_by);
Expand Down
9 changes: 9 additions & 0 deletions src/andromeda/tooling/structs/subjects/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ namespace andromeda
return false;
}

if(item.count(payload_lbl))
{
payload = item.value(payload_lbl, payload);
}
else
{
payload = nlohmann::json::value_t::null;
}

for(auto& prov:provs)
{
labels.insert(prov->get_name());
Expand Down

0 comments on commit a7b88fa

Please sign in to comment.