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
base: main
Are you sure you want to change the base?
Conversation
"data" is plural so there is no "metadatas" |
There was a problem hiding this 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/toolkit/metadatas.h
Outdated
|
||
class UsageMetadatas: public Metadatas { | ||
public: | ||
/// The default constructor for Metadatas. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// The default constructor for Metadatas. | |
/// The default constructor for UsageMetadatas. |
9657680
to
29b5307
Compare
There was a problem hiding this 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/toolkit/metadata.cycpp.h
Outdated
@@ -0,0 +1,33 @@ | |||
|
|||
// This includes the required header to add geographic coordinates to a |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"
src/toolkit/metadata.cc
Outdated
} | ||
|
||
void Metadata::LoadData( | ||
std::map<std::string, std::map<std::string, double>> datas) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datas
should be singular
src/toolkit/metadata.cc
Outdated
|
||
void Metadata::LoadData( | ||
std::map<std::string, std::map<std::string, double>> datas) { | ||
for (auto keyword_datas : datas) { |
There was a problem hiding this comment.
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
Co-Authored-By: Katy Huff <katyhuff@users.noreply.github.com>
Co-Authored-By: Katy Huff <katyhuff@users.noreply.github.com>
Co-Authored-By: Katy Huff <katyhuff@users.noreply.github.com>
Co-Authored-By: Katy Huff <katyhuff@users.noreply.github.com>
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
, theValue
will be written as astring
, theType
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:
The big questions are: