Beispiel #1
0
def export_users():
    """Export all users and their proposal rates to csv file.

    usage::

        bin/export_mercator_users etc/development.ini  10
    """
    docstring = inspect.getdoc(export_users)
    parser = argparse.ArgumentParser(description=docstring)
    parser.add_argument('ini_file',
                        help='path to the adhocracy backend ini file')
    parser.add_argument('min_rate',
                        type=int,
                        help='minimal rate to restrict listed proposals')
    parser.add_argument('-p',
                        '--include-passwords',
                        help='export passwords (in bcrypted form)',
                        action='store_true')
    args = parser.parse_args()
    env = bootstrap(args.ini_file)
    filename = create_filename(directory='./var/export/',
                               prefix='adhocracy-users',
                               suffix='.csv')
    _export_users_and_proposals_rates(env['root'], filename, args)
    env['closer']()
Beispiel #2
0
def export_users():
    """Export all users and their proposal rates to csv file.

    usage::

        bin/export_mercator_users etc/development.ini  10
    """
    docstring = inspect.getdoc(export_users)
    parser = argparse.ArgumentParser(description=docstring)
    parser.add_argument('ini_file',
                        help='path to the adhocracy backend ini file')
    parser.add_argument('min_rate',
                        type=int,
                        help='minimal rate to restrict listed proposals')
    parser.add_argument('-p',
                        '--include-passwords',
                        help='export passwords (in bcrypted form)',
                        action='store_true')
    args = parser.parse_args()
    env = bootstrap(args.ini_file)
    filename = create_filename(directory='./var/export/',
                               prefix='adhocracy-users',
                               suffix='.csv')
    _export_users_and_proposals_rates(env['root'], filename, args)
    env['closer']()
Beispiel #3
0
def _export_comments(root: IResource, registry: Registry):
    catalogs = find_service(root, 'catalogs')
    query = search_query._replace(interfaces=IMercatorProposal,
                                  resolve=True,
                                  )
    proposals = catalogs.search(query).elements

    filename = create_filename(directory='./var/export',
                               prefix='ae-2016-comments',
                               suffix='.csv')
    result_file = open(filename, 'w', newline='')
    wr = csv.writer(result_file, delimiter=';', quotechar='"',
                    quoting=csv.QUOTE_MINIMAL)

    fields = \
        [('URL',
          partial(_get_url, registry)),
         ('Title',
          partial(get_sheet_field_for_partial, ITitle, 'title')),
         ('Comments',
          partial(_get_comments, registry))]

    wr.writerow([name for (name, _) in fields])

    for proposal in proposals:

        result = []
        append_field = partial(append_cvs_field, result)

        for name, get_field in fields:
            append_field(get_field(proposal))

        wr.writerow(result)

    print('Exported mercator comments to %s' % filename)
Beispiel #4
0
def main():  # pragma: no cover
    """Export all users to csv."""
    docstring = inspect.getdoc(main)
    parser = argparse.ArgumentParser(description=docstring)
    parser.add_argument('ini_file',
                        help='path to the adhocracy backend ini file')
    args = parser.parse_args()
    env = bootstrap(args.ini_file)
    filename = create_filename(directory='./var/export/',
                               prefix='adhocracy-users',
                               suffix='.csv')
    export_users(env['root'], env['registry'], filename)
    env['closer']()
Beispiel #5
0
def main():  # pragma: no cover
    """Export all users to csv."""
    docstring = inspect.getdoc(main)
    parser = argparse.ArgumentParser(description=docstring)
    parser.add_argument('ini_file',
                        help='path to the adhocracy backend ini file')
    args = parser.parse_args()
    env = bootstrap(args.ini_file)
    filename = create_filename(directory='./var/export/',
                               prefix='adhocracy-users',
                               suffix='.csv')
    export_users(env['root'], env['registry'], filename)
    env['closer']()
def main():
    """Export all proposals and count 'lost' rates of older versions."""
    docstring = inspect.getdoc(main)
    parser = argparse.ArgumentParser(description=docstring)
    parser.add_argument('ini_file',
                        help='path to the adhocracy backend ini file')
    parser.add_argument('min_rate',
                        type=int,
                        help='minimal rate to restrict listed proposals')
    args = parser.parse_args()
    env = bootstrap(args.ini_file)
    filename = create_filename(directory='./var/export/',
                               prefix='adhocracy-lost-rates',
                               suffix='.csv')
    _export_lost_rates(env['root'], filename, env['registry'],
                       min_rate=args.min_rate)
    env['closer']()
Beispiel #7
0
def main():
    """Export all proposals and count 'lost' rates of older versions."""
    docstring = inspect.getdoc(main)
    parser = argparse.ArgumentParser(description=docstring)
    parser.add_argument('ini_file',
                        help='path to the adhocracy backend ini file')
    parser.add_argument('min_rate',
                        type=int,
                        help='minimal rate to restrict listed proposals')
    args = parser.parse_args()
    env = bootstrap(args.ini_file)
    filename = create_filename(directory='./var/export/',
                               prefix='adhocracy-lost-rates',
                               suffix='.csv')
    _export_lost_rates(env['root'],
                       filename,
                       env['registry'],
                       min_rate=args.min_rate)
    env['closer']()
Beispiel #8
0
def export_proposals():
    """Export all proposals from database and write them to csv file."""
    doc = textwrap.dedent(inspect.getdoc(export_proposals))
    parser = argparse.ArgumentParser(description=doc)
    parser.add_argument('config')
    args = parser.parse_args()

    env = bootstrap(args.config)

    root = env['root']
    registry = env['registry']
    catalogs = find_service(root, 'catalogs')
    query = search_query._replace(
        interfaces=IMercatorProposalVersion,
        sort_by='rates',
        reverse=True,
        indexes={'tag': 'LAST'},
        resolve=True,
    )
    proposals = catalogs.search(query).elements

    filename = create_filename(directory='./var/export',
                               prefix='MercatorProposalExport',
                               suffix='.csv')
    result_file = open(filename, 'w', newline='')
    wr = csv.writer(result_file,
                    delimiter=';',
                    quotechar='"',
                    quoting=csv.QUOTE_MINIMAL)

    wr.writerow([
        'URL', 'Creation date', 'Title', 'Username', 'First name', 'Last name',
        'Creator email', 'Creator country', 'Organisation status',
        'Organisation name', 'Organisation country', 'Rates (Votes)',
        'Number of Comments', 'Budget', 'Requested Funding', 'Other Funding',
        'Granted?', 'Location Places', 'Location Online',
        'Location Ruhr-Connection', 'Proposal Pitch', 'Description',
        'How do you want to get there?', 'Story', 'Outcome', 'Value',
        'Partners', 'Experience', 'Heard from'
    ])

    for proposal in proposals:

        result = []

        result.append(_get_proposal_url(proposal, registry))

        # Creationdate
        creation_date = get_sheet_field(proposal, IMetadata,
                                        'item_creation_date')
        date = creation_date.date().strftime('%d.%m.%Y')
        result.append(date)
        result.append(get_sheet_field(proposal, ITitle, 'title'))
        creator = get_sheet_field(proposal, IMetadata, 'creator')
        if creator is None:
            name = ''
            email = ''
        else:
            name = get_sheet_field(creator, IUserBasic, 'name')
            email = get_sheet_field(creator, IUserExtended, 'email')
        result.append(name)
        result.append(get_sheet_field(proposal, IUserInfo, 'personal_name'))
        result.append(get_sheet_field(proposal, IUserInfo, 'family_name'))
        result.append(email)
        result.append(get_sheet_field(proposal, IUserInfo, 'country'))

        # Organisation
        organization_info = get_sheet_field(proposal, IMercatorSubResources,
                                            'organization_info')

        # status
        status = get_sheet_field(organization_info, IOrganizationInfo,
                                 'status')
        result.append(status)

        # name
        result.append(
            get_sheet_field(organization_info, IOrganizationInfo, 'name'))

        # country
        if status == 'other':
            result.append('')
        else:
            organization_country = get_sheet_field(organization_info,
                                                   IOrganizationInfo,
                                                   'country')
            result.append(organization_country)

        # Rates
        rates = index_rates(proposal, None)
        result.append(rates)

        # Comments
        comments = index_comments(proposal, None)
        result.append(comments)

        # requested funding
        finance = get_sheet_field(proposal, IMercatorSubResources, 'finance')
        budget = get_sheet_field(finance, IFinance, 'budget')
        result.append(str(budget))
        requested_funding = get_sheet_field(finance, IFinance,
                                            'requested_funding')
        result.append(str(requested_funding))
        other_funding = get_sheet_field(finance, IFinance, 'other_sources')
        result.append(other_funding)
        if other_funding:
            granted = get_sheet_field(finance, IFinance, 'granted')
        else:
            granted = ''

        result.append(granted)

        location = get_sheet_field(proposal, IMercatorSubResources, 'location')

        # Location Places

        location_is_specific = get_sheet_field(location, ILocation,
                                               'location_is_specific')

        locations = []

        if location_is_specific:
            location1 = locations.append(
                get_sheet_field(location, ILocation, 'location_specific_1'))
            if location1:
                locations.append(location1)

            location2 = locations.append(
                get_sheet_field(location, ILocation, 'location_specific_2'))
            if location2:
                locations.append(location2)

            location3 = locations.append(
                get_sheet_field(location, ILocation, 'location_specific_3'))
            if location3:
                locations.append(location3)

        result.append('  '.join(locations))

        is_online = get_sheet_field(location, ILocation, 'location_is_online')
        result.append(is_online)

        # Ruhr-Connection

        ruhr_connection = get_sheet_field(location, ILocation,
                                          'location_is_linked_to_ruhr')
        result.append(ruhr_connection)

        # Proposal Pitch
        introduction = get_sheet_field(proposal, IMercatorSubResources,
                                       'introduction')
        teaser = get_sheet_field(introduction, IIntroduction, 'teaser')
        result.append(teaser)

        result.append(
            get_text_from_sheet(proposal, 'description', IDescription))
        result.append(get_text_from_sheet(proposal, 'steps', ISteps))
        result.append(get_text_from_sheet(proposal, 'story', IStory))
        result.append(get_text_from_sheet(proposal, 'outcome', IOutcome))
        result.append(get_text_from_sheet(proposal, 'value', IValue))
        result.append(get_text_from_sheet(proposal, 'partners', IPartners))
        result.append(get_text_from_sheet(proposal, 'experience', IExperience))

        # Heard from
        heard_from = get_sheet(proposal, IHeardFrom)
        result.append(get_heard_from_text(heard_from.get()))

        wr.writerow(result)

    env['closer']()
    print('Exported mercator proposals to %s' % filename)
def _export_proposals(root, registry, limited):
    catalogs = find_service(root, 'catalogs')
    query = search_query._replace(interfaces=IMercatorProposal,
                                  resolve=True,
                                  )
    proposals = catalogs.search(query).elements

    filename = create_filename(directory='./var/export',
                               prefix='ae-2016-proposals',
                               suffix='.csv')
    result_file = open(filename, 'w', newline='')
    wr = csv.writer(result_file, delimiter=';', quotechar='"',
                    quoting=csv.QUOTE_MINIMAL)

    include_field = True
    exclude_field = False
    get_sheet_field = registry.content.get_sheet_field
    fields = \
        [('URL', include_field,
          partial(_get_proposal_url, registry)),
         ('Creation date', include_field,
          partial(_get_creation_date)),
         ('Title', include_field,
          partial(get_sheet_field_for_partial, ITitle, 'title')),
         ('Creator name', include_field,
          partial(_get_creator_name)),
         ('Creator email', include_field,
          partial(_get_creator_email)),
         ('First name', include_field,
          partial(get_sheet_field_for_partial, IUserInfo, 'first_name')),
         ('Last name', include_field,
          partial(get_sheet_field_for_partial, IUserInfo, 'last_name')),
         ('Organisation name', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'name')),
         ('Organisation city', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'city')),
         ('Organisation country', include_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'country')),
         ('Organisation help request', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo,
                  'help_request')),
         ('Organisation registration date', exclude_field,
          partial(_get_date, IOrganizationInfo, 'registration_date')),
         ('Organisation website', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'website')),
         ('Organisation status', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'status')),
         ('Organisation status other', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo,
                  'status_other')),
         ('Pitch', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPitch, 'pitch', 'pitch')),
         ('Partner1 name', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner1_name')),
         ('Partner1 website', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner1_website')),
         ('Partner1 country', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner1_country')),
         ('Partner2 name', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner2_name')),
         ('Partner2 website', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner2_website')),
         ('Partner2 country', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner2_country')),
         ('Partner3 name', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner3_name')),
         ('Partner3 website', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner3_website')),
         ('Partner3 country', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner3_country')),
         ('Others partners', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'other_partners')),
         ('Topics', exclude_field,
          lambda proposal: ' '.join(
              get_sheet_field(proposal, ITopic, 'topic'))),
         ('Topic other', exclude_field,
          partial(get_sheet_field_for_partial, ITopic, 'topic_other')),
         ('Duration', exclude_field,
          lambda proposal: str(_get_sheet_field_from_subresource(
              IDuration, 'duration', 'duration', proposal))),
         ('Location', exclude_field,
          partial(get_sheet_field_for_partial, ILocation, 'location')),
         ('Is online', exclude_field,
          lambda proposal: str(
              get_sheet_field(proposal, ILocation, 'is_online'))),
         ('Link to Ruhr', exclude_field,
          partial(get_sheet_field_for_partial, ILocation, 'link_to_ruhr')),
         ('Status', exclude_field,
          partial(get_sheet_field_for_partial, IStatus, 'status')),
         ('Challenge', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IChallenge, 'challenge', 'challenge')),
         ('Goal', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IGoal, 'goal', 'goal')),
         ('Plan', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPlan, 'plan', 'plan')),
         ('Target', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  ITarget, 'target', 'target')),
         ('Team', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  ITeam, 'team', 'team')),
         ('Extra info', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IExtraInfo, 'extrainfo', 'extrainfo')),
         ('Connection cohesion', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IConnectionCohesion,
                  'connectioncohesion', 'connection_cohesion')),
         ('Difference', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IDifference,
                  'difference', 'difference')),
         ('Practical relevance', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPracticalRelevance,
                  'practicalrelevance', 'practicalrelevance')),
         ('Budget', exclude_field,
          lambda proposal: str(get_sheet_field(
              proposal, IFinancialPlanning, 'budget'))),
         ('Requested funding', exclude_field,
          lambda proposal: str(get_sheet_field(
              proposal, IFinancialPlanning, 'requested_funding'))),
         ('Major expenses', exclude_field,
          partial(get_sheet_field_for_partial,
                  IFinancialPlanning, 'major_expenses')),
         ('Other sources of income', exclude_field,
          partial(get_sheet_field_for_partial, IExtraFunding,
                  'other_sources')),
         ('Secured', exclude_field,
          lambda proposal: str(get_sheet_field(
              proposal, IExtraFunding, 'secured'))),
         ('Reach out', exclude_field,
          partial(get_sheet_field_for_partial, ICommunity,
                  'expected_feedback')),
         ('Heard from', exclude_field,
          lambda proposal: ' '.join(get_sheet_field(
              proposal, ICommunity, 'heard_froms'))),
         ('Heard from other', exclude_field,
          lambda proposal: ' '.join(get_sheet_field(
              proposal, ICommunity, 'heard_from_other')))]

    wr.writerow([name for (name, is_included, _) in fields
                 if is_included or not limited])

    for proposal in proposals:

        result = []
        append_field = partial(append_cvs_field, result)

        for name, is_included, get_field in fields:
            if is_included or not limited:
                append_field(get_field(proposal))

        wr.writerow(result)

    print('Exported mercator proposals to %s' % filename)
def main():
    """Export all proposals from database and write them to csv file."""
    doc = textwrap.dedent(inspect.getdoc(main))
    parser = argparse.ArgumentParser(description=doc)
    parser.add_argument('config')
    args = parser.parse_args()

    env = bootstrap(args.config)

    root = env['root']
    registry = env['registry']
    catalogs = find_service(root, 'catalogs')
    query = search_query._replace(interfaces=IMercatorProposalVersion,
                                  sort_by='rates',
                                  reverse=True,
                                  indexes={'tag': 'LAST'},
                                  resolve=True,
                                  )
    proposals = catalogs.search(query).elements

    filename = create_filename(directory='./var/export',
                               prefix='MercatorProposalExport',
                               suffix='.csv')
    result_file = open(filename, 'w', newline='')
    wr = csv.writer(result_file, delimiter=';', quotechar='"',
                    quoting=csv.QUOTE_MINIMAL)

    wr.writerow(['URL',
                 'Creation date',
                 'Title',
                 'Username',
                 'First name',
                 'Last name',
                 'Creator email',
                 'Creator country',
                 'Organisation status',
                 'Organisation name',
                 'Organisation country',
                 'Rates (Votes)',
                 'Number of Comments',
                 'Budget',
                 'Requested Funding',
                 'Other Funding',
                 'Granted?',
                 'Location Places',
                 'Location Online',
                 'Location Ruhr-Connection',
                 'Proposal Pitch',
                 'Description',
                 'How do you want to get there?',
                 'Story',
                 'Outcome',
                 'Value',
                 'Partners',
                 'Experience',
                 'Heard from'])

    get_sheet_field = registry.content.get_sheet_field
    for proposal in proposals:

        result = []

        result.append(_get_proposal_url(proposal, registry))

        # Creationdate
        creation_date = get_sheet_field(
            proposal,
            IMetadata,
            'item_creation_date',
        )
        date = creation_date.date().strftime('%d.%m.%Y')
        result.append(date)
        result.append(get_sheet_field(proposal, ITitle, 'title'))
        creator = get_sheet_field(proposal, IMetadata, 'creator')
        if creator is None:
            name = ''
            email = ''
        else:
            name = get_sheet_field(creator, IUserBasic, 'name')
            email = get_sheet_field(creator, IUserExtended, 'email')
        result.append(name)
        result.append(get_sheet_field(proposal, IUserInfo, 'personal_name'))
        result.append(get_sheet_field(proposal, IUserInfo, 'family_name'))
        result.append(email)
        result.append(get_sheet_field(proposal, IUserInfo, 'country'))

        # Organisation
        organization_info = get_sheet_field(proposal,
                                            IMercatorSubResources,
                                            'organization_info')

        # status
        status = get_sheet_field(organization_info, IOrganizationInfo,
                                 'status')
        result.append(status)

        # name
        result.append(get_sheet_field(organization_info,
                                      IOrganizationInfo,
                                      'name'))

        # country
        if status == 'other':
            result.append('')
        else:
            organization_country = get_sheet_field(organization_info,
                                                   IOrganizationInfo,
                                                   'country')
            result.append(organization_country)

        # Rates
        rates = index_rates(proposal, None)
        result.append(rates)

        # Comments
        comments = index_comments(proposal, None)
        result.append(comments)

        # requested funding
        finance = get_sheet_field(proposal,
                                  IMercatorSubResources,
                                  'finance')
        budget = get_sheet_field(finance, IFinance, 'budget')
        result.append(str(budget))
        requested_funding = get_sheet_field(finance, IFinance,
                                            'requested_funding')
        result.append(str(requested_funding))
        other_funding = get_sheet_field(finance, IFinance,
                                        'other_sources')
        result.append(other_funding)
        if other_funding:
            granted = get_sheet_field(finance, IFinance,
                                      'granted')
        else:
            granted = ''

        result.append(granted)

        location = get_sheet_field(proposal,
                                   IMercatorSubResources,
                                   'location')

        # Location Places

        location_is_specific = get_sheet_field(
            location,
            ILocation,
            'location_is_specific')

        locations = []

        if location_is_specific:
            location1 = locations.append(get_sheet_field(
                location,
                ILocation,
                'location_specific_1'))
            if location1:
                locations.append(location1)

            location2 = locations.append(get_sheet_field(
                location,
                ILocation,
                'location_specific_2'))
            if location2:
                locations.append(location2)

            location3 = locations.append(get_sheet_field(
                location,
                ILocation,
                'location_specific_3'))
            if location3:
                locations.append(location3)

        result.append('  '.join(locations))

        is_online = get_sheet_field(
            location,
            ILocation,
            'location_is_online')
        result.append(is_online)

        # Ruhr-Connection

        ruhr_connection = get_sheet_field(
            location,
            ILocation,
            'location_is_linked_to_ruhr')
        result.append(ruhr_connection)

        # Proposal Pitch
        introduction = get_sheet_field(
            proposal,
            IMercatorSubResources,
            'introduction')
        teaser = get_sheet_field(introduction,
                                 IIntroduction,
                                 'teaser')
        result.append(teaser)

        result.append(
            get_text_from_sheet(
                proposal,
                'description',
                IDescription,
                registry,
            ))
        result.append(get_text_from_sheet(proposal, 'steps', ISteps, registry))
        result.append(get_text_from_sheet(proposal, 'story', IStory, registry))
        result.append(get_text_from_sheet(proposal, 'outcome', IOutcome,
                                          registry))
        result.append(get_text_from_sheet(proposal, 'value', IValue, registry))
        result.append(get_text_from_sheet(proposal, 'partners', IPartners,
                                          registry))
        result.append(get_text_from_sheet(proposal, 'experience', IExperience,
                                          registry))

        # Heard from
        heard_from = registry.content.get_sheet(proposal, IHeardFrom)
        result.append(get_heard_from_text(heard_from.get()))

        wr.writerow(result)

    env['closer']()
    print('Exported mercator proposals to %s' % filename)
def _export_proposals(root, registry, limited):
    catalogs = find_service(root, 'catalogs')
    query = search_query._replace(interfaces=IMercatorProposal,
                                  resolve=True,
                                  )
    proposals = catalogs.search(query).elements

    filename = create_filename(directory='./var/export',
                               prefix='ae-2016-proposals',
                               suffix='.csv')
    result_file = open(filename, 'w', newline='')
    wr = csv.writer(result_file, delimiter=';', quotechar='"',
                    quoting=csv.QUOTE_MINIMAL)

    include_field = True
    exclude_field = False
    get_sheet_field = registry.content.get_sheet_field
    fields = \
        [('URL', include_field,
          partial(_get_proposal_url, registry)),
         ('Creation date', include_field,
          partial(_get_creation_date)),
         ('Title', include_field,
          partial(get_sheet_field_for_partial, ITitle, 'title')),
         ('Creator name', include_field,
          partial(_get_creator_name)),
         ('Creator email', include_field,
          partial(_get_creator_email)),
         ('First name', include_field,
          partial(get_sheet_field_for_partial, IUserInfo, 'first_name')),
         ('Last name', include_field,
          partial(get_sheet_field_for_partial, IUserInfo, 'last_name')),
         ('Organisation name', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'name')),
         ('Organisation city', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'city')),
         ('Organisation country', include_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'country')),
         ('Organisation help request', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo,
                  'help_request')),
         ('Organisation registration date', exclude_field,
          partial(_get_date, IOrganizationInfo, 'registration_date')),
         ('Organisation website', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'website')),
         ('Organisation status', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo, 'status')),
         ('Organisation status other', exclude_field,
          partial(get_sheet_field_for_partial, IOrganizationInfo,
                  'status_other')),
         ('Pitch', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPitch, 'pitch', 'pitch')),
         ('Partner1 name', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner1_name')),
         ('Partner1 website', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner1_website')),
         ('Partner1 country', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner1_country')),
         ('Partner2 name', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner2_name')),
         ('Partner2 website', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner2_website')),
         ('Partner2 country', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner2_country')),
         ('Partner3 name', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner3_name')),
         ('Partner3 website', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner3_website')),
         ('Partner3 country', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'partner3_country')),
         ('Others partners', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPartners, 'partners', 'other_partners')),
         ('Topics', exclude_field,
          lambda proposal: ' '.join(
              get_sheet_field(proposal, ITopic, 'topic'))),
         ('Topic other', exclude_field,
          partial(get_sheet_field_for_partial, ITopic, 'topic_other')),
         ('Duration', exclude_field,
          lambda proposal: str(_get_sheet_field_from_subresource(
              IDuration, 'duration', 'duration', proposal))),
         ('Location', exclude_field,
          partial(get_sheet_field_for_partial, ILocation, 'location')),
         ('Is online', exclude_field,
          lambda proposal: str(
              get_sheet_field(proposal, ILocation, 'is_online'))),
         ('Link to Ruhr', exclude_field,
          partial(get_sheet_field_for_partial, ILocation, 'link_to_ruhr')),
         ('Status', exclude_field,
          partial(get_sheet_field_for_partial, IStatus, 'status')),
         ('Challenge', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IChallenge, 'challenge', 'challenge')),
         ('Goal', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IGoal, 'goal', 'goal')),
         ('Plan', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPlan, 'plan', 'plan')),
         ('Target', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  ITarget, 'target', 'target')),
         ('Team', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  ITeam, 'team', 'team')),
         ('Extra info', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IExtraInfo, 'extrainfo', 'extrainfo')),
         ('Connection cohesion', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IConnectionCohesion,
                  'connectioncohesion', 'connection_cohesion')),
         ('Difference', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IDifference,
                  'difference', 'difference')),
         ('Practical relevance', exclude_field,
          partial(_get_sheet_field_from_subresource,
                  IPracticalRelevance,
                  'practicalrelevance', 'practicalrelevance')),
         ('Budget', exclude_field,
          lambda proposal: str(get_sheet_field(
              proposal, IFinancialPlanning, 'budget'))),
         ('Requested funding', exclude_field,
          lambda proposal: str(get_sheet_field(
              proposal, IFinancialPlanning, 'requested_funding'))),
         ('Major expenses', exclude_field,
          partial(get_sheet_field_for_partial,
                  IFinancialPlanning, 'major_expenses')),
         ('Other sources of income', exclude_field,
          partial(get_sheet_field_for_partial, IExtraFunding,
                  'other_sources')),
         ('Secured', exclude_field,
          lambda proposal: str(get_sheet_field(
              proposal, IExtraFunding, 'secured'))),
         ('Reach out', exclude_field,
          partial(get_sheet_field_for_partial, ICommunity,
                  'expected_feedback')),
         ('Heard from', exclude_field,
          lambda proposal: ' '.join(get_sheet_field(
              proposal, ICommunity, 'heard_froms'))),
         ('Heard from other', exclude_field,
          lambda proposal: ' '.join(get_sheet_field(
              proposal, ICommunity, 'heard_from_other')))]

    wr.writerow([name for (name, is_included, _) in fields
                 if is_included or not limited])

    for proposal in proposals:

        result = []
        append_field = partial(append_cvs_field, result)

        for name, is_included, get_field in fields:
            if is_included or not limited:
                append_field(get_field(proposal))

        wr.writerow(result)

    print('Exported mercator proposals to %s' % filename)