Skip to content

Commit 747f4c2

Browse files
committed
Add sample_dt to .CSV cluster export
1 parent 7afca66 commit 747f4c2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/hiv_tx_network.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,7 @@ class HIVTxNetwork {
11551155
**/
11561156

11571157
let entities = this.aggregate_indvidual_level_records(g.node_objects);
1158+
11581159
cluster_detect_size = this.unique_entity_list_from_ids(
11591160
_.map(
11601161
_.filter(g.nodes, (node) => node.added <= g.created),
@@ -1185,6 +1186,9 @@ class HIVTxNetwork {
11851186
person_ident_dt: timeDateUtil.hivtrace_date_or_na_if_missing(
11861187
entity_to_pg_records[eid][0].added
11871188
),
1189+
sample_dt: timeDateUtil.hivtrace_date_or_na_if_missing(
1190+
this.attribute_node_value_by_id(gn, "sample_dt")
1191+
),
11881192
new_linked_case: this.priority_groups_is_new_node(
11891193
entity_to_pg_records[eid][0]
11901194
)
@@ -2765,7 +2769,20 @@ class HIVTxNetwork {
27652769
if (_.size(unique_values) == 1) {
27662770
return [k, values[0][kGlobals.network.NodeAttributeID][k]];
27672771
} else {
2768-
return [k, _.map(unique_values, (d3, k3) => k3).join(";")];
2772+
if (proto.type == "Date") {
2773+
try {
2774+
return [
2775+
k,
2776+
new Date(
2777+
Date.parse(d3.min(_.map(unique_values, (d3, k3) => k3)))
2778+
),
2779+
];
2780+
} catch {
2781+
return [k, null];
2782+
}
2783+
} else {
2784+
return [k, _.map(unique_values, (d3, k3) => k3).join(";")];
2785+
}
27692786
}
27702787
})
27712788
);

0 commit comments

Comments
 (0)