Giter VIP home page Giter VIP logo

crawl-db's Introduction

UKWA (prototype)

This is the initial prototype for the updated UKWA website.

crawl-db's People

Contributors

anjackson avatar gilhoggarth avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

uk-gov-mirror

crawl-db's Issues

Review Parquet schema

The Parquet version is proving quite useful. But the schema could use a few tweaks to make it even more useful/speedy.

The current schema looks like this (where the types are defined as Parquet Logical Types:


┌──────────────────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐
│       column_name        │ column_type │  null   │   key   │ default │  extra  │
│         varchar          │   varchar   │ varchar │ varchar │ varchar │ varchar │
├──────────────────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤
│ id                       │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ url                      │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ host                     │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ domain                   │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ ip                       │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ timestamp                │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ status_code              │ BIGINT      │ YES     │ NULL    │ NULL    │ NULL    │
│ content_type             │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ content_length           │ BIGINT      │ YES     │ NULL    │ NULL    │ NULL    │
│ hop_path                 │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ annotations              │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ content_digest           │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ via                      │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ start_time_plus_duration │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ seed                     │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ start_time               │ TIMESTAMP   │ YES     │ NULL    │ NULL    │ NULL    │
│ duration                 │ BIGINT      │ YES     │ NULL    │ NULL    │ NULL    │
│ warc_type                │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ warc_filename            │ VARCHAR     │ YES     │ NULL    │ NULL    │ NULL    │
│ warc_offset              │ BIGINT      │ YES     │ NULL    │ NULL    │ NULL    │
│ warc_length              │ BIGINT      │ YES     │ NULL    │ NULL    │ NULL    │
│ wire_bytes               │ BIGINT      │ YES     │ NULL    │ NULL    │ NULL    │
├──────────────────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┤
│ 22 rows                                                              6 columns │
└────────────────────────────────────────────────────────────────────────────────┘

Of these:

  • The id is 'timestamp_14/url` so seems a bit pointless to store, as it could be regenerated easily.
  • Store ip as a binary IPv4 value?
  • Store timestamp as an actual TIMESTAMP to avoid the slow-down of having to parse it. Maybe add timestamp_14 to store the timestamp as a Wayback-style 14-digit string?
  • Store annotations as a LIST[STRING] embedded type.
  • Store content_digest in binary?
  • Drop start_time_plus_duration?x
  • Add other fields? Public Suffix? SURT (as the index/sorted column for lookup?*)

Related questions:

From Common Crawl, the columns are:

url_surtkey: Canonical form of URL with host name reversed
url: URL that was archived
url_host_name: The host name
url_host_tld: The TLD (e.g. au)
url_host_2nd_last_part, … url_host_5th_last_part: The parts of the host name separated by .
url_host_registry_suffix: e.g. .com.au
url_host_private_domain
url_protocol: e.g. https
url_port: The port accesed, it seems to be blank for default ports (80 for http, 443 for https).
url_path: The path of the URL (everything from the first / to the query parameter starting at ?)
url_query: Query parameter; everything after the ?
fetch_time: When the page was retrieved
fetch_status: The HTTP status of the request (e.g. 200 is OK)
content_digest: A digest to uniquely identify the content
content_mime_type: The type of content in the header
content_mime_detected: The type of content detected
content_charset: The characterset of the data (e.g. UTF-8)
content_languages: Languages declared of the content
warc_filename: The filename the archived data is in (ANJ: Actually the full file path)
warc_record_offset: The offset in bytes in the archived file where the corresponding data starts
warc_record_length: The length of the archived data in bytes
warc_segment: The segment the data is archived in; this is part of the filename (ANJ: path)
crawl: The id of the crawl (e.g. CC-MAIN-YYYY-WW where YYYY is the year and WW is the ISO week of the year).
subset: Is this the ‘warc’, or ‘robotstxt’, or ‘crawldiagnostics’

*I've found the Parquet documentation very difficult to pin down in terms of how sorted data can be used as an index. It seems the system does support using one column as a sorted index, making binary search possible. Presumably, we could aim to support URL lookup in this way, via a primary SURT column, and this is probably what CC are doing with url_surtkey as the first column. But it's a bit difficult to work out how to ensure fastparquet does this and I don't know how to look at a Parquet file and tell the chunks are indexed.

Add Solr Kevals implementation, and set up tools to import crawl logs

Building on the shared kevals library, add hooks to pull data from Kafka or local files and push to a crawl log database.

For crawl streams from Kafka, some field mapping is required to map Heritrix's fields to the warcprox ones:

  • size > wire_bytes
  • mimetype > content_type
  • seed > source

Also:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.