aggregator_elastic: correct partyid implementation

master
Erik de Vries 6 years ago
parent c047a4a1db
commit f8e4111e70

@ -25,6 +25,7 @@
################################################################################################# #################################################################################################
aggregator_elastic <- function(out, localhost = F, actorids, ver, cores, es_super) { aggregator_elastic <- function(out, localhost = F, actorids, ver, cores, es_super) {
### Generating actor dataframe, unnest by actorsDetail, then by actor ids. Filter out non-relevant actor ids. ### Generating actor dataframe, unnest by actorsDetail, then by actor ids. Filter out non-relevant actor ids.
partyid <- str_sub(actorids[1], end=-3)
actor_df <- out %>% actor_df <- out %>%
unnest() %>% unnest() %>%
unnest(ids, .preserve = colnames(.)) %>% unnest(ids, .preserve = colnames(.)) %>%
@ -33,7 +34,7 @@ aggregator_elastic <- function(out, localhost = F, actorids, ver, cores, es_supe
agg_party_actors <- bind_rows(mclapply(unique(actor_df$`_id`), agg_party_actors <- bind_rows(mclapply(unique(actor_df$`_id`),
mamlr:::aggregator, mamlr:::aggregator,
actor_df = actor_df, actor_df = actor_df,
merge_id = paste0(actor$`_source.partyId`,'_mfsa'), merge_id = paste0(partyid,'_mfsa'),
mc.cores = cores)) mc.cores = cores))
party <- actor_df %>% party <- actor_df %>%
@ -41,7 +42,7 @@ aggregator_elastic <- function(out, localhost = F, actorids, ver, cores, es_supe
agg_party <- bind_rows(mclapply(unique(party$`_id`), agg_party <- bind_rows(mclapply(unique(party$`_id`),
mamlr:::aggregator, mamlr:::aggregator,
actor_df = party, actor_df = party,
merge_id = paste0(actor$`_source.partyId`,'_mfs'), merge_id = paste0(partyid,'_mfs'),
mc.cores = cores)) mc.cores = cores))
actors_only <- actor_df %>% actors_only <- actor_df %>%
@ -49,7 +50,7 @@ aggregator_elastic <- function(out, localhost = F, actorids, ver, cores, es_supe
agg_actors <- bind_rows(mclapply(unique(actors_only$`_id`), agg_actors <- bind_rows(mclapply(unique(actors_only$`_id`),
mamlr:::aggregator, mamlr:::aggregator,
actor_df = actors_only, actor_df = actors_only,
merge_id = paste0(actor$`_source.partyId`,'_ma'), merge_id = paste0(partyid,'_ma'),
mc.cores = cores)) mc.cores = cores))
df_out <- bind_rows(agg_party_actors, agg_party, agg_actors) df_out <- bind_rows(agg_party_actors, agg_party, agg_actors)
doc_ids <- df_out$doc_id doc_ids <- df_out$doc_id

Loading…
Cancel
Save