ci_mapping/data/parse_mag_data.py
def parse_fos(response, paper_id):
    """Parse the fields of study of a paper from a MAG API response.

    Args:
        response (json): Response from MAG API in JSON format. Contains all paper information.
        paper_id (int): Paper ID.

    Returns:
        fields_of_study (:obj:`list` of :obj:`dict`): List of dictionaries with fields of study information.
            There's one dictionary per field of study.
        paper_with_fos (:obj:`list` of :obj:`dict`): Matching fields of study and paper IDs.

    """
    # two outputs: fos_id with fos_name, fos_id with paper_id
    paper_with_fos = []
    fields_of_study = []
    for fos in response["F"]:
        # mag_fields_of_study
        fields_of_study.append(
            {"id": fos["FId"], "name": fos["DFN"], "norm_name": fos["FN"]}
        )
        # mag_paper_fields_of_study
        paper_with_fos.append({"field_of_study_id": fos["FId"], "paper_id": paper_id})

    return paper_with_fos, fields_of_study
Parse the fields of study of a paper from a MAG API response.

    Args:
        response (json): Response from MAG API in JSON format. Contains all paper information.
        paper_id (int): Paper ID.

    Returns:
        fields_of_study (:obj:`list` of :obj:`dict`): List of dictionaries with fields of study information.
            There's one dictionary per field of study.
        paper_with_fos (:obj:`list` of :obj:`dict`): Matching fields of study and paper IDs.

    
Parse the fields of study of a paper from a MAG API response.
Parse the fields of study of a paper from a MAG API response .
def parse_fos(response, paper_id):
    paper_with_fos = []
    fields_of_study = []
    for fos in response["F"]:
        fields_of_study.append(
            {"id": fos["FId"], "name": fos["DFN"], "norm_name": fos["FN"]}
        )
        paper_with_fos.append({"field_of_study_id": fos["FId"], "paper_id": paper_id})
    return paper_with_fos, fields_of_study
def parse_fos ( response , paper_id ) : paper_with_fos = [ ] fields_of_study = [ ] for fos in response [ "F" ] : fields_of_study . append ( { "id" : fos [ "FId" ] , "name" : fos [ "DFN" ] , "norm_name" : fos [ "FN" ] } ) paper_with_fos . append ( { "field_of_study_id" : fos [ "FId" ] , "paper_id" : paper_id } ) return paper_with_fos , fields_of_study
Parse the fields of study of a paper from a MAG API response.
Parse the fields of study of a paper from a MAG API response .
"""Parse the fields of study of a paper from a MAG API response.

    Args:
        response (json): Response from MAG API in JSON format. Contains all paper information.
        paper_id (int): Paper ID.

    Returns:
        fields_of_study (:obj:`list` of :obj:`dict`): List of dictionaries with fields of study information.
            There's one dictionary per field of study.
        paper_with_fos (:obj:`list` of :obj:`dict`): Matching fields of study and paper IDs.

    """ # two outputs: fos_id with fos_name, fos_id with paper_id # mag_fields_of_study # mag_paper_fields_of_study
fields_of_study (:obj:`list` of :obj:`dict`): List of dictionaries with fields of study information.
There's one dictionary per field of study.
paper_with_fos (:obj:`list` of :obj:`dict`): Matching fields of study and paper IDs.
fields_of_study ( : obj : ` list ` of : obj : ` dict ` ) : List of dictionaries with fields of study information . There ' s one dictionary per field of study . paper_with_fos ( : obj : ` list ` of : obj : ` dict ` ) : Matching fields of study and paper IDs .
response
Response from MAG API in JSON format. Contains all paper information.
Response from MAG API in JSON format . Contains all paper information .
paper_id
None