Skip to content

Commit 9ad5959

Browse files
committed
Added option to retrieve attributes
1 parent 461da16 commit 9ad5959

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

Internal/MedPyExport/MedPyExport/MPSamples.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,20 @@ std::vector<string> MPSamples::get_str_attributes() {
394394
return str_attr;
395395
};
396396

397+
std::vector<string> MPSamples::get_str_attributes_by_name(const string &attr_name) {
398+
std::vector<string> res;
399+
for (size_t i = 0; i < o->idSamples.size(); ++i)
400+
{
401+
for (size_t j = 0; j < o->idSamples[i].samples.size(); ++j)
402+
{
403+
if (o->idSamples[i].samples[j].str_attributes.find(attr_name) != o->idSamples[i].samples[j].str_attributes.end())
404+
res.push_back(o->idSamples[i].samples[j].str_attributes[attr_name]);
405+
else
406+
res.push_back("");
407+
}
408+
}
409+
return res;
410+
}
397411

398412
void MPSamples::dilute(float prob) { return o->dilute((float)prob); };
399413
int MPSamples::MEDPY_GET_time_unit() { return o->time_unit; };

Internal/MedPyExport/MedPyExport/MPSamples.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class MPSamples {
167167
//temporary solution to inability to return two string lists:
168168
std::vector<string> get_attributes();
169169
std::vector<string> get_str_attributes();
170+
std::vector<string> get_str_attributes_by_name(const string &attr_name);
170171

171172
void dilute(float prob);
172173
void insertRec(int pid, int time, float outcome, int outcomeTime);

Internal/MedPyExport/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Medial Python Binding
22

3+
## Relase Notes - 1.1.2
4+
* Feature: Retreive string attributes from samples
5+
36
## Relase Notes - 1.1.1
47
* Bugfix: get_sig when using PidRepository data from json
58
* Feature: add support to retrieve model arch as json

Internal/MedPyExport/generate_binding/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "medpython"
7-
version = "1.1.1"
7+
version = "1.1.2"
88
description = "Medial EarlySign Python"
99
readme = "README.md"
1010
license = "MIT"

0 commit comments

Comments
 (0)