arche icon indicating copy to clipboard operation
arche copied to clipboard

Better results API

Open manycoding opened this issue 5 years ago • 0 comments

To allow report customization, results can have a better API. The current one looks like:

arche.report.results.get("JSON Schema Validation")

Result(
    name='JSON Schema Validation',
    messages={
        <Level.ERROR: 2>:[
            Message(summary='34021 items were checked, 3 error(s)',
                            detailed=None,
                            errors=defaultdict(<class 'set'>, {
                                "'FRANCHISE' is a required property": {
                                    '2235/1375/40/347696',...'2235/1375/40/477297'}}))
        ],
        <Level.ERROR: 1>:[
            Message(summary=...)]},
    items_count=34021,
    err_items_count=16282,
    _stats=_pd.Series and pd.DataFrames_,
    _figures=_plotly figures from _stats_
)
{
  "field": "FRANCHISE",
  "items_affected": 16282,
  "items_sample": [
    {
      "id": 367187,
      "url": "https://app.scrapinghub.com/p/1/1375/40/item/367187"
    },
    "..."
  ],
  "items_total": 34021,
  "reason": "is a required property"
}
  1. Expose error field
  2. Keep both id and url?

manycoding avatar May 27 '19 16:05 manycoding