Skip to content
Snippets Groups Projects
__init__.py 2.33 KiB
Newer Older
Tiago Peixoto's avatar
Tiago Peixoto committed
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
Tiago Peixoto's avatar
Tiago Peixoto committed
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
Tiago Peixoto's avatar
Tiago Peixoto committed
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
# details.
Tiago Peixoto's avatar
Tiago Peixoto committed
#
# You should have received a copy of the GNU Affero General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>.
Tiago Peixoto's avatar
Tiago Peixoto committed

from .. import *

title = "Within-organization Facebook friendships (2013)"
description = """Six networks of friendships among users on Facebook who indicated employment at one of the target corporation. Companies range in size from small to large. Only edges between employees at the same company are included in a given snapshot.[^icon]
[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Social', 'Online', 'Unweighted']
url = 'https://data4goodlab.github.io/MichaelFire/#section3'
Tiago Peixoto's avatar
Tiago Peixoto committed
citation = [('M. Fire, and R. Puzis, "Organization mining using online social networks." Networks and Spatial Economics 16(2), 545-578 (2016)', 'https://arxiv.org/abs/1303.3741')]
icon_hash = '5a009c80ee01e9ab21acb3c1'
ustream_license = None
upstream_prefix = 'https://data4goodlab.github.io/MichaelFire/datasets'
Tiago Peixoto's avatar
Tiago Peixoto committed
files = [(f'organizations.zip:organizations/{d}Anonymized.csv', d, 'csv')
         for d in ["S1", "S2", "M1", "M2", "L1", "L2"]]

def fetch_upstream(force=False):
    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
                                force)

@cache_network()
@coerce_props()
@annotate()
def parse(alts=None):
    global files
    name = __name__.split(".")[-1]
    for fnames, alt, fmt in files:
        if alts is not None and alt not in alts:
            continue
        if isinstance(fnames, str):
            fnames = [fnames]
        with ExitStack() as stack:
            fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
            g = parse_graph(fs, fmt, directed=False)
        yield alt, g