Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Metadata, and some other change #1509

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

Conversation

bam241
Copy link
Member

@bam241 bam241 commented May 16, 2019

This is an attempt to allow agent to have metadata.
I inspired myself from the position.cc/.h, and I had some though on how to improve it....
Those inspiration lead to #1510 PR, to change a little bit the way we dealt with position...

Metadatas:

  • Metadata:
    Allows user to add metadata as it is done in the pyne::Material, mapping a keyword (string) with almost any value and record them in a Metadata table for the output file that looks like:
    SimId | AgentId | Keyword | Value | Type, the Value will be written as a string, the Type column allows to identify it,
  • UsageMetadatas:
    Yet some kind of metadata (but the more I think about it, the less I believe it should inherit from Metadata).
    The UsageMetadata are supposed to record the amount of some usage of any kind per deployment, per decomission, per timestep and per throughput. Each type of usage will have its own keyword (user defined) and to each keyword 4 different usages could be associated.
    example of usage: manpower, CO2, water, lollipop, electricity, truck, pretzels,...
    the UsageMetadata Table will look like:
    SimId | AgentId | Keyword | Value | Usage (I might add a unit here...)

For the RecordMetadata and RecordUsageMetadata, I plan to implement it the same way I did for Position, (already did it for the UsageMetadata...)

this will be followed by a PR on the cycamore side.

To be added to this PR:

  • add Metadata to Cyclus::Agent
  • unit test for all

The big questions are:

  • Do you like the implementation change I am introducing ???
  • Is it CEP worthy ?

@gonuke
Copy link
Member

gonuke commented May 29, 2019

"data" is plural so there is no "metadatas"

Copy link
Member

@katyhuff katyhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a draft, comments included anyway. Consider more documentation everywhere, and maybe there is some way to make these case switches more concise (functor map?)

src/agent.cc Outdated Show resolved Hide resolved
src/agent.cc Outdated Show resolved Hide resolved
src/agent.h Outdated Show resolved Hide resolved
src/agent.h Outdated Show resolved Hide resolved
src/agent.h Outdated Show resolved Hide resolved
src/toolkit/metadatas.cc Outdated Show resolved Hide resolved
src/toolkit/metadatas.cc Outdated Show resolved Hide resolved

class UsageMetadatas: public Metadatas {
public:
/// The default constructor for Metadatas.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The default constructor for Metadatas.
/// The default constructor for UsageMetadatas.

src/toolkit/metadatas.h Outdated Show resolved Hide resolved
src/toolkit/metadatas.h Outdated Show resolved Hide resolved
@bam241 bam241 force-pushed the metadata branch 2 times, most recently from 9657680 to 29b5307 Compare June 13, 2019 22:20
@bam241 bam241 marked this pull request as ready for review August 2, 2019 15:04
@bam241 bam241 changed the title [WIP] adding Metadata, and some other change Adding Metadata, and some other change Aug 5, 2019
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem quite complete, but I've added a few comments/requests.

src/query_backend.h Show resolved Hide resolved
src/query_backend.h Show resolved Hide resolved
@@ -0,0 +1,33 @@

// This includes the required header to add geographic coordinates to a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a cut & paste error - this comment is about metadata and not geo coordinates

Metadata::Metadata() {}
Metadata::~Metadata() {}

void Metadata::RecordMetadata(Agent* agent) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the best function name. Maybe RegisterMetadata? No recording of metadata happens here, this function simply adds it to the output tables to be recorded in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose you are basing it on the naming of Datum::Record() which is perhaps also poorly named... Although in that case one can interpret it as "start recording"

}

void Metadata::LoadData(
std::map<std::string, std::map<std::string, double>> datas) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datas should be singular


void Metadata::LoadData(
std::map<std::string, std::map<std::string, double>> datas) {
for (auto keyword_datas : datas) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyword_datas should be singular

@gonuke gonuke added the Feature label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants