ci_mapping/analysis/descriptive_analysis.py
def open_access_publications(
    data, journals, open_access, filename="open_access_publications"
):
    """Adoption of open access by CI, AI+CI.

    Args:
        data (`pd.DataFrame`): MAG paper data.
        journals (`pd.DataFrame`): Academic journals.
        conferences (`pd.DataFrame`): Academic conferences.
        filename (str): Name of the HTML file to store the plot.

    """
    paper_journal = (
        data[["id", "year", "type"]]
        .merge(journals, left_on="id", right_on="paper_id")
        .merge(open_access, left_on="id_y", right_on="id")
    )

    frames = []
    for (num, comp) in zip([0, 1], ["Paywalled", "Preprints"]):
        for cat in paper_journal.type.unique():
            df = paper_journal[paper_journal.open_access == num].drop_duplicates(
                "paper_id"
            )
            nominator = df[df.type == cat].groupby("year")["paper_id"].count()
            denominator = df[df.type == cat].groupby("year")["paper_id"].count().iloc[0]
            frame = pd.DataFrame(nominator / denominator).reset_index()
            frame = pd.DataFrame(frame).rename(index=str, columns={"paper_id": "value"})
            frame["type"] = cat
            frame["category"] = comp
            frames.append(frame)

    df = pd.concat(frames)

    alt.Chart(df).mark_point(opacity=1, filled=True, size=80).encode(
        alt.X("category:N", title=None),
        alt.Y("value:Q"),
        alt.Color("type:N", legend=alt.Legend(title="Category")),
        column="year",
    ).properties(width=25).configure_facet(spacing=15).configure_legend(
        titleFontSize=12, labelFontSize=12
    ).configure_axis(
        labelFontSize=12, titleFontSize=12
    ).save(
        f"{ci_mapping.project_dir}/reports/figures/{filename}.html"
    )
    logger.info(f"Stored {filename} plot.")
Adoption of open access by CI, AI+CI.

    Args:
        data (`pd.DataFrame`): MAG paper data.
        journals (`pd.DataFrame`): Academic journals.
        conferences (`pd.DataFrame`): Academic conferences.
        filename (str): Name of the HTML file to store the plot.

    
Adoption of open access by CI, AI+CI.
Adoption of open access by CI AI + CI .
def open_access_publications(
    data, journals, open_access, filename="open_access_publications"
):
    paper_journal = (
        data[["id", "year", "type"]]
        .merge(journals, left_on="id", right_on="paper_id")
        .merge(open_access, left_on="id_y", right_on="id")
    )
    frames = []
    for (num, comp) in zip([0, 1], ["Paywalled", "Preprints"]):
        for cat in paper_journal.type.unique():
            df = paper_journal[paper_journal.open_access == num].drop_duplicates(
                "paper_id"
            )
            nominator = df[df.type == cat].groupby("year")["paper_id"].count()
            denominator = df[df.type == cat].groupby("year")["paper_id"].count().iloc[0]
            frame = pd.DataFrame(nominator / denominator).reset_index()
            frame = pd.DataFrame(frame).rename(index=str, columns={"paper_id": "value"})
            frame["type"] = cat
            frame["category"] = comp
            frames.append(frame)
    df = pd.concat(frames)
    alt.Chart(df).mark_point(opacity=1, filled=True, size=80).encode(
        alt.X("category:N", title=None),
        alt.Y("value:Q"),
        alt.Color("type:N", legend=alt.Legend(title="Category")),
        column="year",
    ).properties(width=25).configure_facet(spacing=15).configure_legend(
        titleFontSize=12, labelFontSize=12
    ).configure_axis(
        labelFontSize=12, titleFontSize=12
    ).save(
        f"{ci_mapping.project_dir}/reports/figures/{filename}.html"
    )
    logger.info(f"Stored {filename} plot.")
def open_access_publications ( data , journals , open_access , filename = "open_access_publications" ) : paper_journal = ( data [ [ "id" , "year" , "type" ] ] . merge ( journals , left_on = "id" , right_on = "paper_id" ) . merge ( open_access , left_on = "id_y" , right_on = "id" ) ) frames = [ ] for ( num , comp ) in zip ( [ 0 , 1 ] , [ "Paywalled" , "Preprints" ] ) : for cat in paper_journal . type . unique ( ) : df = paper_journal [ paper_journal . open_access == num ] . drop_duplicates ( "paper_id" ) nominator = df [ df . type == cat ] . groupby ( "year" ) [ "paper_id" ] . count ( ) denominator = df [ df . type == cat ] . groupby ( "year" ) [ "paper_id" ] . count ( ) . iloc [ 0 ] frame = pd . DataFrame ( nominator / denominator ) . reset_index ( ) frame = pd . DataFrame ( frame ) . rename ( index = str , columns = { "paper_id" : "value" } ) frame [ "type" ] = cat frame [ "category" ] = comp frames . append ( frame ) df = pd . concat ( frames ) alt . Chart ( df ) . mark_point ( opacity = 1 , filled = True , size = 80 ) . encode ( alt . X ( "category:N" , title = None ) , alt . Y ( "value:Q" ) , alt . Color ( "type:N" , legend = alt . Legend ( title = "Category" ) ) , column = "year" , ) . properties ( width = 25 ) . configure_facet ( spacing = 15 ) . configure_legend ( titleFontSize = 12 , labelFontSize = 12 ) . configure_axis ( labelFontSize = 12 , titleFontSize = 12 ) . save ( f"{ci_mapping.project_dir}/reports/figures/{filename}.html" ) logger . info ( f"Stored {filename} plot." )
Adoption of open access by CI, AI+CI.
Adoption of open access by CI AI + CI .
"""Adoption of open access by CI, AI+CI.

    Args:
        data (`pd.DataFrame`): MAG paper data.
        journals (`pd.DataFrame`): Academic journals.
        conferences (`pd.DataFrame`): Academic conferences.
        filename (str): Name of the HTML file to store the plot.

    """
data
MAG paper data.
MAG paper data .
journals
None
open_access
filename
Name of the HTML file to store the plot.
Name of the HTML file to store the plot .
conferences
None