'required': True, 'empty': False, 'nullable': False }, 'versioncreated': { 'type': 'datetime', 'required': True }, 'firstcreated': { 'type': 'datetime' }, 'firstpublished': { 'type': 'datetime', 'required': False }, 'evolvedfrom': Resource.not_analyzed_field(), 'nextversion': Resource.not_analyzed_field(), 'subscribers': Resource.not_analyzed_field('list'), 'ednote': { 'type': 'string' }, 'signal': { 'type': 'list', 'mapping': { 'type': 'object', 'properties': { 'code': not_analyzed, 'name': not_analyzed, 'scheme': not_analyzed } }
'renditions': {'type': 'dict'}, 'service': {'type': 'list', 'mapping': code_mapping}, 'slugline': {'type': 'string'}, 'source': metadata_schema['source'], 'subject': {'type': 'list', 'mapping': code_mapping}, 'keywords': metadata_schema['keywords'], 'type': metadata_schema['type'], 'urgency': {'type': 'integer'}, 'priority': {'type': 'integer'}, 'uri': metadata_schema['guid'], # we use guid value for uri, so index it in a same way 'usageterms': {'type': 'string'}, 'version': {'type': 'string', 'required': True, 'empty': False, 'nullable': False}, 'versioncreated': {'type': 'datetime', 'required': True}, 'firstcreated': {'type': 'datetime'}, 'firstpublished': {'type': 'datetime', 'required': False}, 'evolvedfrom': Resource.not_analyzed_field(), 'nextversion': Resource.not_analyzed_field(), 'subscribers': Resource.not_analyzed_field('list'), 'ednote': {'type': 'string'}, 'signal': { 'type': 'list', 'mapping': { 'type': 'object', 'properties': { 'code': not_analyzed, 'name': not_analyzed, 'scheme': not_analyzed } } }, 'genre': {'type': 'list', 'mapping': code_mapping},
class AgendaResource(newsroom.Resource): """ Agenda schema """ schema = {} # identifiers schema['guid'] = events_schema['guid'] schema['type'] = { 'type': 'string', 'mapping': not_analyzed, 'default': 'agenda', } schema['event_id'] = events_schema['guid'] schema['recurrence_id'] = { 'type': 'string', 'mapping': not_analyzed, 'nullable': True, } # content metadata schema['name'] = events_schema['name'] schema['slugline'] = not_analyzed schema['definition_short'] = events_schema['definition_short'] schema['definition_long'] = events_schema['definition_long'] schema['headline'] = planning_schema['headline'] schema['firstcreated'] = events_schema['firstcreated'] schema['version'] = events_schema['version'] schema['versioncreated'] = events_schema['versioncreated'] schema['ednote'] = events_schema['ednote'] # aggregated fields schema['subject'] = planning_schema['subject'] schema['urgency'] = planning_schema['urgency'] schema['place'] = planning_schema['place'] schema['service'] = { 'type': 'dict', 'mapping': code_mapping, } schema['state_reason'] = {'type': 'string'} # dates schema['dates'] = { 'type': 'dict', 'schema': { 'start': {'type': 'datetime'}, 'end': {'type': 'datetime'}, 'tz': {'type': 'string'}, } } # additional dates from coverages or planning to be used in searching agenda items schema['display_dates'] = { 'type': 'list', 'nullable': True, 'schema': { 'type': 'dict', 'schema': { 'date': {'type': 'datetime'}, } } } # coverages schema['coverages'] = { 'type': 'list', 'mapping': { 'type': 'nested', 'properties': { 'planning_id': not_analyzed, 'coverage_id': not_analyzed, 'scheduled': {'type': 'date'}, 'coverage_type': not_analyzed, 'workflow_status': not_analyzed, 'coverage_status': not_analyzed, 'coverage_provider': not_analyzed, 'slugline': not_analyzed, 'delivery_id': not_analyzed, # To point ot the latest published item 'delivery_href': not_analyzed, # To point ot the latest published item TO_BE_CONFIRMED_FIELD: {'type': 'boolean'}, 'deliveries': { # All deliveries (incl. updates go here) 'type': 'object', 'properties': { 'planning_id': not_analyzed, 'coverage_id': not_analyzed, 'assignment_id': not_analyzed, 'sequence_no': not_analyzed, 'publish_time': {'type': 'date'}, 'delivery_id': not_analyzed, 'delivery_state': not_analyzed, } }, 'watches': not_analyzed, }, }, } # attachments schema['files'] = { 'type': 'list', 'mapping': not_enabled, } # state schema['state'] = WORKFLOW_STATE_SCHEMA # other searchable fields needed in UI schema['calendars'] = events_schema['calendars'] schema['location'] = events_schema['location'] # update location name to be not_analyzed schema['location']['mapping']['properties']['name'] = not_analyzed # event details schema['event'] = { 'type': 'dict', 'mapping': not_enabled, } # planning details which can be more than one per event schema['planning_items'] = { 'type': 'list', 'mapping': { 'type': 'nested', 'include_in_all': False, 'properties': { '_id': not_analyzed, 'guid': not_analyzed, 'slugline': not_analyzed, 'description_text': {'type': 'string'}, 'headline': {'type': 'string'}, 'abstract': {'type': 'string'}, 'subject': code_mapping, 'urgency': {'type': 'integer'}, 'service': code_mapping, 'planning_date': {'type': 'date'}, 'coverages': not_enabled, 'agendas': { 'type': 'object', 'properties': { 'name': not_analyzed, '_id': not_analyzed, } }, 'ednote': {'type': 'string'}, 'internal_note': not_indexed, 'place': planning_schema['place']['mapping'], 'state': not_analyzed, 'state_reason': {'type': 'string'}, 'products': { 'type': 'object', 'properties': { 'code': not_analyzed, 'name': not_analyzed } } } } } schema['bookmarks'] = Resource.not_analyzed_field('list') # list of user ids who bookmarked this item schema['downloads'] = Resource.not_analyzed_field('list') # list of user ids who downloaded this item schema['shares'] = Resource.not_analyzed_field('list') # list of user ids who shared this item schema['prints'] = Resource.not_analyzed_field('list') # list of user ids who printed this item schema['copies'] = Resource.not_analyzed_field('list') # list of user ids who copied this item schema['watches'] = Resource.not_analyzed_field('list') # list of users following the event # matching products from superdesk schema['products'] = { 'type': 'list', 'mapping': { 'type': 'object', 'properties': { 'code': not_analyzed, 'name': not_analyzed } } } resource_methods = ['GET'] datasource = { 'source': 'agenda', 'search_backend': 'elastic', 'default_sort': [('dates.start', 1)], } item_methods = ['GET']
}, "versioncreated": { "type": "datetime", "required": True }, "firstcreated": { "type": "datetime" }, "firstpublished": { "type": "datetime", "required": False }, "embargoed": { "type": "datetime" }, "evolvedfrom": Resource.not_analyzed_field(), "nextversion": Resource.not_analyzed_field(), "subscribers": Resource.not_analyzed_field("list"), "ednote": { "type": "string" }, "signal": { "type": "list", "mapping": { "type": "object", "properties": { "code": not_analyzed, "name": not_analyzed, "scheme": not_analyzed }, },
'type': 'string' }, 'version': { 'type': 'string', 'required': True, 'empty': False, 'nullable': False }, 'versioncreated': { 'type': 'datetime', 'required': True }, 'firstcreated': { 'type': 'datetime' }, 'evolvedfrom': Resource.not_analyzed_field(), 'subscribers': { 'type': 'list' }, 'ednote': { 'type': 'string' }, 'signal': { 'type': 'list' }, 'genre': { 'type': 'list' }, }
'pubstatus': metadata_schema['pubstatus'], 'renditions': {'type': 'dict'}, 'service': {'type': 'list', 'mapping': code_mapping}, 'slugline': {'type': 'string'}, 'source': metadata_schema['source'], 'subject': {'type': 'list', 'mapping': code_mapping}, 'keywords': metadata_schema['keywords'], 'type': metadata_schema['type'], 'urgency': {'type': 'integer'}, 'priority': {'type': 'integer'}, 'uri': metadata_schema['guid'], # we use guid value for uri, so index it in a same way 'usageterms': {'type': 'string'}, 'version': {'type': 'string', 'required': True, 'empty': False, 'nullable': False}, 'versioncreated': {'type': 'datetime', 'required': True}, 'firstcreated': {'type': 'datetime'}, 'evolvedfrom': Resource.not_analyzed_field(), 'subscribers': Resource.not_analyzed_field('list'), 'ednote': {'type': 'string'}, 'signal': { 'type': 'list', 'mapping': { 'type': 'object', 'properties': { 'code': not_analyzed, 'name': not_analyzed, 'scheme': not_analyzed } } }, 'genre': {'type': 'list', 'mapping': code_mapping}, 'ancestors': Resource.not_analyzed_field('list'),