Example #1
0
def parse_record(record, service):
    geom = parse_geom(record)

    links = [
        ResourceLink('service', service['ServiceDescriptionURL'])
    ]

    details_url = parse_details_url(record)
    if details_url:
        links.append(ResourceLink('details', details_url))

    return CuahsiResource(
        id=record['location'],
        title=record['site_name'],
        description=service['aabstract'],
        author=None,
        links=links,
        created_at=record['begin_date'],
        updated_at=None,
        geom=geom,
        details_url=details_url,
        sample_mediums=record['sample_mediums'],
        variables=record['variables'],
        service_org=service['organization'],
        service_code=record['serv_code'],
        service_url=service['ServiceDescriptionURL'],
        service_title=service['Title'],
        service_citation=service['citation'],
        begin_date=record['begin_date'],
        end_date=record['end_date']
    )
def parse_record(item):
    return Resource(id=item['resource_id'],
                    title=item['resource_title'],
                    description=None,
                    author=item['creator'],
                    links=[ResourceLink('details', item['resource_url'])],
                    created_at=parse_date(item['date_created']),
                    updated_at=parse_date(item['date_last_updated']),
                    geom=None)
Example #3
0
def parse_record(record, service):
    geom = parse_geom(record)

    links = [
        ResourceLink('service', service['ServiceDescriptionURL'])
    ]

    details_url = parse_details_url(record)
    if details_url:
        links.append(ResourceLink('details', details_url))

    return Resource(
        id=record['location'],
        title=record['Sitename'],
        description=service['aabstract'],
        author=None,
        links=links,
        created_at=record['beginDate'],
        updated_at=None,
        geom=geom)
def parse_record(item):
    start, end = parse_coverage_period(item['coverages'])

    return HydroshareResource(
        id=item['resource_id'],
        title=item['resource_title'],
        description=None,
        author=item['creator'],
        links=[ResourceLink('details', item['resource_url'])],
        created_at=parse_date(item['date_created']),
        updated_at=parse_date(item['date_last_updated']),
        geom=parse_geom(item['coverages']),
        begin_date=parse_date(start) if start else None,
        end_date=parse_date(end) if end else None)
Example #5
0
def parse_links(source):
    """
    Parse "links" from item source.

    - links_s may be absent, a string, or list of strings
    """
    result = []
    links = source.get('links_s', [])

    if isinstance(links, basestring):
        links = [links]

    for url in links:
        result.append(ResourceLink('details', url))

    return result