# 存 GeneralBrowserActionInstance
        if save_doc:
            general_browser_action_doc = GeneralBrowserActionInstance(
                uuid=action_uuid,
                related_articles=related_articles,
                new_found_articles=new_found_articles,
                pdf_page_snapshot=BinaryAttachment(uuid=orig_pdf_bin_uuid),
                img_page_snapshot=BinaryAttachment(uuid=orig_png_bin_uuid))
            upsert_document(general_browser_action_doc, False)


if __name__ == "__main__":

    from gs_research_workflow.common.mongo_resource import mongo_db_conn, used_db_position, db_nlp

    mongo_db_conn(used_db_position, db_nlp)

    pd.set_option("display.max_rows", 20)
    pd.set_option("display.max_columns", None)
    # GeneralBrowserBackendProcess.process_action_result(
    #     "/tmp/laigen/debug_data/general_desktop_browser_backend_action/xueqiu", "", False)

    GeneralBrowserBackendProcess.process_action_result(
        "/tmp/laigen/debug_data/general_desktop_browser_backend_action/google_news_tab",
        "debug_batch_uuid", "debug_action_uuid_1", True)

    # import dateparser
    #
    # ls_s = ["3 hours ago", "22-Jun-20", "05-29 23:24 ", "Thu, Mar. 19", "Fri, May 22", "Aug. 19, 2019",
    #         "1分钟前", "3天前", "5小时前", "57m", "5h", "Yesterday, 2:07 PM", "Today, 12:58 AM", "5 years ago"]
    # for s in ls_s:
Пример #2
0
        "pred_val": df_y_pred_orig_val.iloc[-1]
    }).dropna()
    df_pred_summary[
        "delta_v"] = df_pred_summary["true_val"] - df_pred_summary["pred_val"]
    df_pred_summary["delta_percentage"] = (df_pred_summary["true_val"] - df_pred_summary["pred_val"]) * 100. / \
                                          df_pred_summary["true_val"]

    df_pred_zscore = pd.DataFrame({
        "true_val": df_zscore.iloc[-1],
        "pred_val": df_y_pred.iloc[-1]
    }).dropna()

    print(df_pred_summary)


mongo_db_conn("intranet", db_nlp)

import pandas as pd
news_objs = NewsIndex.objects(from_keyword__in=SearchKeyword.objects(
    agent__in=AgentWithTag.objects(tags="govt_central")))
df = pd.DataFrame(data=[{
    "title": news.title,
    "pub_time": news.publish_time,
    "abstract": news.abstract,
    "url": news.url,
    "from_kw": news.from_keyword.search_keyword
} for news in news_objs])
print(df)
# print(news_objs)

# news_objs = NewsIndex.objects(from_keyword__in=SearchKeyword.objects(agent="Trump"))