Public API¶
Models¶
Match-able & Hydrate-able Models¶
-
class
digitalarchive.models.
Document
(id, uri, title, description, doc_date, frontend_doc_date, slug, source_created_at, source_updated_at, first_published_at, source, type, rights, pdf_generated_at, date_range_start, sort_string_by_coverage, main_src, model, donors, subjects, transcripts, translations, media_files, languages, contributors, creators, original_coverages, collections, attachments, links, repositories, publishers, classifications)¶ A Document corresponding to a single record page on digitalarchive.wilsoncenter.org.
Note
Avoid constructing Documents directly–use the match function to create Documents by keyword search or by ID.
Attributes present on all Documents:
-
source_created_at
¶ Timestamp of when the Document was first added to the DA.
Type: datetime.datetime
-
source_updated_at
¶ Timestamp of when the Document was last edited.
Type: datetime.datetime
-
first_published_at
¶ Timestamp of when the document was first made publically accessible.
Type: datetime.datetime
Attributes present only on hydrated Documents
These attributes are aliases of
UnhydratedField
untilDocument.hydrate()
is called on the Document.-
type
¶ The type of the document (meeting minutes, report, etc.)
Type: digitalarchive.models.Type
-
rights
¶ A list of entities holding the copyright of the Document.
Type: list
ofdigitalarchive.models.Right
-
pdf_generated_at
¶ The date that the combined source, translations, and transcriptions PDF. was generated.
Type: str
-
date_range_start
¶ A rounded-down date used to standardize approximate dates for date-range matching.
Type: datetime.date
-
sort_string_by_coverage
¶ An alphanumeric identifier used by the API to sort search results.
Type: str
-
donors
¶ A list of donors whose funding make the acquisiton or translation of a document possible.
Type: list
ofdigitalarchive.models.Donor
-
subjects
¶ A list of subjects that the document is tagged with.
Type: list
ofdigitalarchive.models.Subject
-
transcripts
¶ A list of transcripts of the document’s contents.
Type: list
ofdigitalarchive.models.Transcript
-
translations
¶ A list of translations of the original document.
Type: list
ofdigitalarchive.models.Translation
-
media_files
¶ A list of attached original scans of the document.
Type: list
ofdigitalarchive.models.MediaFile
-
languages
¶ A list of langauges contained in the document.
Type: list
ofdigitalarchive.models.Language
-
original_coverages
¶ A list of geographic locations referenced in the document.
Type: list
ofdigitalarchive.models.Coverage
-
collections
¶ A list of Collections that contain this document.
Type: list
ofdigitalarchive.models.Collection
-
attachments
¶ A list of Documents that were attached to the Document.
Type: list
ofdigitalarchive.models.Document
-
links
¶ A list of topically related documents.
Type: list
ofdigitalarchive.models.Document
-
respositories
¶ A list of archives/libraries containing this document.
Type: list
ofdigitalarchive.models.Repository
-
publishers
¶ A list of Publishers that released the document.
Type: list
ofdigitalarchive.models.Publisher
-
classifications
¶ A list of security classification markings present on the document.
Type: list
ofdigitalarchive.models.Publisher
-
hydrate
(recurse: bool = False)¶ Downloads the complete version of the Document with metadata for any related objects.
Parameters: recurse (bool) – If true, also hydrate subordinate and related records.
-
classmethod
match
(**kwargs) → digitalarchive.matching.ResourceMatcher¶ Search for a Document by keyword, or fetch one by ID.
Matching on the Document model runs a full-text search using keywords passed via the title and description keywords. Results can also be limited by dates or by related records, as described below.
Note
Title and description keywords are not searched for individually. All non-date or child record searches are concatenated to single querystring.
Note
Collection and other related record searches use INNER JOIN logic when passed multiple related resources.
Allowed search fields:
Parameters: - title (
str
, optional) – Title search keywords. - description (
str
, optional) – Title search keywords. - start_date (
datetime.date
, optional) – Return only Documents with a doc_date after the passed start_date. - end_date (
datetime.date
, optional) – Return only Documents with a doc_date before the passed end_date. - collections (
list
ofdigitalarchive.models.Collection
, optional) – Restrict results to Documents contained in all of the passed Collections. - publishers (
list
ofdigitalarchive.models.Publisher
, optional) – Restrict results to Documents published by all of the passed Publishers. - repositories (
list
ofdigitalarchive.models.Repository
, optional) – Documents contained in all of the passed Repositories. - coverages (
list
ofdigitalarchive.models.Coverage
, optional) – relating to all of the passed geographical Coverages. - subjects (
list
ofdigitalarchive.models.Subject
) – all of the passed subjects - contributors (
list of :class:`digitalarchive.models.Contributor
) – authors include all of the passed contributors. - donors (list(
digitalarchive.models.Donor
)) – translated with support from all of the passed donors. - languages (
digitalarchive.models.Language
or str) – original document. If passing a string, you must pass an ISO 639-2/B language code. - translation (
digitalarchive.models.Translation
) – is a translation available in the passed Language. - theme (
digitalarchive.models.Theme
) –
Returns: - An instance of (
digitalarchive.matching.ResourceMatcher
) containing any records responsive to the search.
- title (
-
-
class
digitalarchive.models.
Collection
(id, name, slug, uri, parent, model, value, description, short_description, main_src, no_of_documents, is_inactive, source_created_at, source_updated_at, first_published_at)¶ A collection of Documents on a single topic
-
parent
¶ A Collection containing the Collection.
Type: digitalarchive.models.Collection
-
model
¶ A sting name of the model used to differentiate Collection and Document searches in the DA API.
Type: str
-
source_created_at
¶ Timestamp of when the Document was first added to the DA.
Type: datetime.datetime
-
source_updated_at
¶ Timestamp of when the Document was last edited.
Type: datetime.datetime
-
first_published_at
¶ Timestamp of when the document was first made publically accessible.
Type: datetime.datetime
-
hydrate
()¶ Populate all unhydrated fields of a resource.
-
classmethod
match
(**kwargs) → digitalarchive.matching.ResourceMatcher¶ Find a resource using passed keyword arguments.
Note
If called without arguments, returns all records in the DA .
-
-
class
digitalarchive.models.
Subject
(id, name, uri, value)¶ A historical topic to which documents can be related.
-
hydrate
()¶ Populate all unhydrated fields of a resource.
-
classmethod
match
(**kwargs) → digitalarchive.matching.ResourceMatcher¶ Find a resource using passed keyword arguments.
Note
If called without arguments, returns all records in the DA .
-
-
class
digitalarchive.models.
Coverage
(id, name, uri, value, parent, children)¶ A geographical area referenced by a Document.
-
children
¶ (list of
Covereage
): Subordinate geographical areas, if any.
-
hydrate
()¶ Populate all unhydrated fields of a resource.
-
classmethod
match
(**kwargs) → digitalarchive.matching.ResourceMatcher¶ Find a resource using passed keyword arguments.
Note
If called without arguments, returns all records in the DA .
-
-
class
digitalarchive.models.
Contributor
(id, name, value, uri)¶ An individual person or organization that contributed to the creation of the document.
Contributors are typically the Document’s author, but for meeting minutes and similar documents, a Contributor may simply be somebody who was in attendance at the meeting.
-
hydrate
()¶ Populate all unhydrated fields of a resource.
-
classmethod
match
(**kwargs) → digitalarchive.matching.ResourceMatcher¶ Find a resource using passed keyword arguments.
Note
If called without arguments, returns all records in the DA .
-
-
class
digitalarchive.models.
Repository
(id, name, value, uri)¶ The archive or library possessing the original, physical Document.
-
hydrate
()¶ Populate all unhydrated fields of a resource.
-
classmethod
match
(**kwargs) → digitalarchive.matching.ResourceMatcher¶ Find a resource using passed keyword arguments.
Note
If called without arguments, returns all records in the DA .
-
Hydrate-able Models¶
-
class
digitalarchive.models.
Transcript
(id, filename, content_type, extension, asset_id, source_created_at, source_updated_at, url, html, pdf, raw)¶ A transcript of a document in its original language.
-
hydrate
()¶ Populate all unhydrated fields of a
digitalarchive.models._Asset
.
-
-
class
digitalarchive.models.
Translation
(id, filename, content_type, extension, asset_id, source_created_at, source_updated_at, url, html, pdf, raw, language)¶ A translation of a Document into a another language.
-
language
¶ Type: digitalarchive.models.Language
-
hydrate
()¶ Populate all unhydrated fields of a
digitalarchive.models._Asset
.
-
-
class
digitalarchive.models.
MediaFile
(id, filename, content_type, extension, asset_id, source_created_at, source_updated_at, path, html, pdf, raw)¶ An original scan of a Document.
-
hydrate
()¶ Populate all unhydrated fields of a
digitalarchive.models._Asset
.
-
-
class
digitalarchive.models.
Theme
(id, slug, title, value, description, main_src, uri, featured_resources, has_map, has_timeline, featured_collections, dates_with_events)¶ A parent container for collections on a single geopolitical topic.
Note
Themes never appear on any record model, but can be passed as a search param to Document.
-
main_src
¶ A URI for the Theme’s banner image on the Digital Archive website.
-
has_map
¶ A boolean value for whether the Theme has an accompanying map on the Digital Archive website.
Type: str
-
has_timeline
¶ A boolean value for whether the Theme has a Timeline on the Digital Archive website.
Type: str
-
featured_collections
¶ A list of related collections.
Type: list of Collection
-
hydrate
()¶ Populate all unhydrated fields of a resource.
-
Other Models¶
-
class
digitalarchive.models.
Language
(id, name)¶ The original language of a resource.
-
class
digitalarchive.models.
Donor
(id, name)¶ An entity whose resources helped publish or translate a document.
-
class
digitalarchive.models.
Type
(id, name)¶ The type of a document (memo, report, etc).
-
class
digitalarchive.models.
Right
(id, name)¶ A copyright notice attached to the Document.
-
class
digitalarchive.models.
Classification
(id, name)¶ A classification marking applied to the original Document.
,,,
Matching¶
-
class
digitalarchive.matching.
ResourceMatcher
(resource_model: digitalarchive.models.Resource, items_per_page=200, **kwargs)¶ Runs a search against the DA API for the provided DA model and keywords.
ResourceMatcher wraps search results and exposes methods for interacting with the resultant set of resources.
-
list
¶ search results. Handles pagination of the DA API.
Type: Generator
ofdigitalarchive.models.Resource
-
count
¶ The number of respondant records to the given search.
-
all
() → List[digitalarchive.models.Resource]¶ Exhaust the results generator and return a list of all search results.
-
first
() → digitalarchive.models.Resource¶ Return only the first record from a search result.
-
hydrate
(recurse: bool = False)¶ Hydrate all of the resources in a search result.
-