API Reference
Core search functions
- class adamsnrc.main.SearchResult(meta, results)[source]
Bases:
objectContainer for search results with metadata.
- Parameters:
meta (dict[str, str])
results (list[dict[str, str]])
- meta: dict[str, str]
- results: list[dict[str, str]]
- property count: int
Return the count as an integer.
- property matches: int
Return the matches as an integer.
- exception adamsnrc.main.ADAMSRequestError[source]
Bases:
ADAMSErrorException raised for request-related errors.
- exception adamsnrc.main.ADAMSValidationError[source]
Bases:
ADAMSErrorException raised for validation errors.
- exception adamsnrc.main.ADAMSParseError[source]
Bases:
ADAMSErrorException raised for parsing errors.
- adamsnrc.main.validate_sort_order(order)[source]
Validate that the sort order parameter is valid.
- Parameters:
order (str) – The sort order to validate (should be ‘ASC’ or ‘DESC’)
- Raises:
ADAMSValidationError – If the sort order is not in the list of valid orders
- Return type:
None
- adamsnrc.main.validate_sort_field(sort)[source]
Validate that the sort field parameter is valid.
- Parameters:
sort (str) – The sort field to validate
- Return type:
None
Note
This function only logs a warning if the sort field is not recognized, rather than raising an exception, as the API may accept additional fields.
- adamsnrc.main.validate_property_tuple(prop_tuple)[source]
Validate that a property search tuple has the correct format.
- Parameters:
prop_tuple (tuple) – A tuple containing (property, operator, value)
- Raises:
ADAMSValidationError – If the tuple format is invalid or contains wrong types
- Return type:
None
- adamsnrc.main.validate_date_range(date_range)[source]
Validate that a date range tuple has the correct format.
- Parameters:
date_range (tuple[str, str]) – A tuple containing (start_date, end_date)
- Raises:
ADAMSValidationError – If the date range format is invalid or contains wrong types
- Return type:
None
- adamsnrc.main.content_search(properties_search=None, properties_search_any=None, single_content_search='', sort='DocumentDate', order='DESC')[source]
Perform a content search in the ADAMS public library.
This function searches for documents using property-based filters and full-text search. Properties can be combined with AND logic (properties_search) or OR logic (properties_search_any).
- Parameters:
properties_search (Optional[list[tuple[str, str, Any]]], optional) – List of property tuples (property, operator, value) for AND conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
properties_search_any (Optional[list[tuple[str, str, Any]]], optional) – List of property tuples (property, operator, value) for OR conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
single_content_search (str, optional) – Full-text search string to search within document content. Defaults to “”.
sort (str, optional) – Field to sort results by. Defaults to “DocumentDate”.
order (str, optional) – Sort order - “ASC” for ascending, “DESC” for descending. Defaults to “DESC”.
- Returns:
Object containing search metadata and results list
- Return type:
- Raises:
ADAMSValidationError – If any parameters are invalid
ADAMSRequestError – If the API request fails
ADAMSParseError – If the API response cannot be parsed
- adamsnrc.main.advanced_search(properties_search_all=None, properties_search_any=None, public_library=True, legacy_library=False, added_today=False, added_this_month=False, within_folder_enable=False, within_folder_insubfolder=False, within_folder_path='', sort='$title', order='ASC')[source]
Perform an advanced search with additional filtering options.
This function provides more advanced search capabilities including library selection, date-based filtering, and folder-based searching in addition to property-based search.
- Parameters:
properties_search_all (Optional[list[tuple[str, str, Any]]], optional) – List of property tuples (property, operator, value) for AND conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
properties_search_any (Optional[list[tuple[str, str, Any]]], optional) – List of property tuples (property, operator, value) for OR conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
public_library (bool, optional) – Whether to search in the public library. Defaults to True.
legacy_library (bool, optional) – Whether to search in the legacy library. Defaults to False.
added_today (bool, optional) – Filter for items added today. Defaults to False.
added_this_month (bool, optional) – Filter for items added this month. Defaults to False.
within_folder_enable (bool, optional) – Enable within folder search. Defaults to False.
within_folder_insubfolder (bool, optional) – Include subfolders when searching within a folder. Defaults to False.
within_folder_path (str, optional) – Folder path to search within. Defaults to “”.
sort (str, optional) – Field to sort results by. Defaults to “$title”.
order (str, optional) – Sort order - “ASC” for ascending, “DESC” for descending. Defaults to “ASC”.
- Returns:
Object containing search metadata and results list
- Return type:
- Raises:
ADAMSValidationError – If any parameters are invalid
ADAMSRequestError – If the API request fails
ADAMSParseError – If the API response cannot be parsed
- adamsnrc.main.part21_search_content(extra_and=None, extra_or=None, text='', sort='$size', order='DESC')[source]
Search for Part 21 Correspondence documents using content search.
This function is a convenience wrapper around content_search that automatically filters for Part 21 Correspondence documents.
- Parameters:
extra_and (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for AND conditions beyond the base Part 21 filter. Each tuple should contain (property_name, operator, search_value). Defaults to None.
extra_or (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for OR conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
text (str, optional) – Full-text search string to search within document content. Defaults to “”.
sort (str, optional) – Field to sort results by. Defaults to “$size”.
order (str, optional) – Sort order - “ASC” for ascending, “DESC” for descending. Defaults to “DESC”.
- Returns:
Object containing search metadata and results list
- Return type:
- Raises:
ADAMSValidationError – If any parameters are invalid
ADAMSRequestError – If the API request fails
ADAMSParseError – If the API response cannot be parsed
- adamsnrc.main.part21_search_advanced(extra_all=None, extra_any=None, date_range=None, sort='$title', order='ASC')[source]
Search for Part 21 Correspondence documents using advanced search.
This function is a convenience wrapper around advanced_search that automatically filters for Part 21 Correspondence documents and supports date range filtering.
- Parameters:
extra_all (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for AND conditions beyond the base Part 21 filter. Each tuple should contain (property_name, operator, search_value). Defaults to None.
extra_any (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for OR conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
date_range (Optional[tuple[str, str]], optional) – Date range tuple (start_date, end_date) for filtering by publish date. Both dates should be strings in a format accepted by the ADAMS API. Defaults to None.
sort (str, optional) – Field to sort results by. Defaults to “$title”.
order (str, optional) – Sort order - “ASC” for ascending, “DESC” for descending. Defaults to “ASC”.
- Returns:
Object containing search metadata and results list
- Return type:
- Raises:
ADAMSValidationError – If any parameters are invalid
ADAMSRequestError – If the API request fails
ADAMSParseError – If the API response cannot be parsed
- adamsnrc.main.operating_reactor_ir_search_content(extra_and=None, extra_or=None, text='', sort='$size', order='DESC')[source]
Search for Operating Reactor Inspection Reports using content search.
This function is a convenience wrapper around content_search that automatically filters for inspection reports from operating reactors (DocketNumber starting with 05000).
- Parameters:
extra_and (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for AND conditions beyond the base inspection report filter. Each tuple should contain (property_name, operator, search_value). Defaults to None.
extra_or (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for OR conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
text (str, optional) – Full-text search string to search within document content. Defaults to “”.
sort (str, optional) – Field to sort results by. Defaults to “$size”.
order (str, optional) – Sort order - “ASC” for ascending, “DESC” for descending. Defaults to “DESC”.
- Returns:
Object containing search metadata and results list
- Return type:
- Raises:
ADAMSValidationError – If any parameters are invalid
ADAMSRequestError – If the API request fails
ADAMSParseError – If the API response cannot be parsed
- adamsnrc.main.operating_reactor_ir_search_advanced(extra_all=None, extra_any=None, date_range=None, sort='$title', order='ASC')[source]
Search for Operating Reactor Inspection Reports using advanced search.
This function is a convenience wrapper around advanced_search that automatically filters for inspection reports from operating reactors (DocketNumber starting with 05000) and supports date range filtering.
- Parameters:
extra_all (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for AND conditions beyond the base inspection report filter. Each tuple should contain (property_name, operator, search_value). Defaults to None.
extra_any (Optional[list[tuple[str, str, Any]]], optional) – Additional property tuples for OR conditions. Each tuple should contain (property_name, operator, search_value). Defaults to None.
date_range (Optional[tuple[str, str]], optional) – Date range tuple (start_date, end_date) for filtering by publish date. Both dates should be strings in a format accepted by the ADAMS API. Defaults to None.
sort (str, optional) – Field to sort results by. Defaults to “$title”.
order (str, optional) – Sort order - “ASC” for ascending, “DESC” for descending. Defaults to “ASC”.
- Returns:
Object containing search metadata and results list
- Return type:
- Raises:
ADAMSError – If any parameters are invalid or an unexpected error occurs
Types and enums
Type definitions and data models for the ADAMS API client.
This module provides comprehensive type hints, enums, and data models that help coding agents understand the API structure and provide better autocomplete and validation.
- class adamsnrc.types.SortOrder(*values)[source]
Bases:
str,EnumValid sort orders for ADAMS API queries.
- ASCENDING = 'ASC'
- DESCENDING = 'DESC'
- class adamsnrc.types.SortField(*values)[source]
Bases:
str,EnumValid sort fields for ADAMS API queries.
- DOCUMENT_DATE = 'DocumentDate'
- TITLE = '$title'
- SIZE = '$size'
- AUTHOR_NAME = 'AuthorName'
- DOCUMENT_TYPE = 'DocumentType'
- PUBLISH_DATE = 'PublishDatePARS'
- DOCKET_NUMBER = 'DocketNumber'
- ACCESSION_NUMBER = 'AccessionNumber'
- SUBJECT = 'Subject'
- class adamsnrc.types.SearchOperator(*values)[source]
Bases:
str,EnumValid search operators for property searches.
- EQUALS = 'eq'
- STARTS_WITH = 'starts'
- ENDS_WITH = 'ends'
- CONTAINS = 'contains'
- IN_FOLDER = 'infolder'
- RANGE = 'range'
- class adamsnrc.types.DocumentType(*values)[source]
Bases:
str,EnumCommon document types in ADAMS.
- NUREG = 'NUREG'
- PART_21 = 'Part 21 Correspondence'
- INSPECTION_REPORT = 'inspection report'
- SPEECH = 'Speech'
- LETTER = 'Letter'
- MEMORANDUM = 'Memorandum'
- ORDER = 'Order'
- LICENSE = 'License'
- class adamsnrc.types.LibraryType(*values)[source]
Bases:
str,EnumAvailable library types.
- PUBLIC = 'public'
- LEGACY = 'legacy'
- class adamsnrc.types.PropertySearch(property_name, operator, value)[source]
Bases:
objectRepresents a property search condition.
- Parameters:
property_name (str)
operator (SearchOperator)
value (Any)
- property_name: str
- operator: SearchOperator
- value: Any
- class adamsnrc.types.DateRange(start_date, end_date, format_str='%m/%d/%Y %I:%M %p')[source]
Bases:
objectRepresents a date range for filtering.
- Parameters:
start_date (str | datetime)
end_date (str | datetime)
format_str (str)
- start_date: str | datetime
- end_date: str | datetime
- format_str: str = '%m/%d/%Y %I:%M %p'
- class adamsnrc.types.SearchOptions(public_library=True, legacy_library=False, added_today=False, added_this_month=False, within_folder_enable=False, within_folder_insubfolder=False, within_folder_path='', sort_field=SortField.DOCUMENT_DATE, sort_order=SortOrder.DESCENDING)[source]
Bases:
objectConfiguration options for search queries.
- Parameters:
- public_library: bool = True
- legacy_library: bool = False
- added_today: bool = False
- added_this_month: bool = False
- within_folder_enable: bool = False
- within_folder_insubfolder: bool = False
- within_folder_path: str = ''
- class adamsnrc.types.SearchQuery(properties_and=<factory>, properties_or=<factory>, content_search='', date_range=None, options=<factory>)[source]
Bases:
objectRepresents a complete search query.
- Parameters:
properties_and (List[PropertySearch])
properties_or (List[PropertySearch])
content_search (str)
date_range (DateRange | None)
options (SearchOptions)
- properties_and: List[PropertySearch]
- properties_or: List[PropertySearch]
- content_search: str = ''
- options: SearchOptions
- add_property_and(prop, op, value)[source]
Add a property search with AND logic.
- Parameters:
prop (str)
op (SearchOperator)
value (Any)
- Return type:
None
- add_property_or(prop, op, value)[source]
Add a property search with OR logic.
- Parameters:
prop (str)
op (SearchOperator)
value (Any)
- Return type:
None
- class adamsnrc.types.DocumentMetadata(accession_number=None, title=None, document_type=None, author_name=None, author_affiliation=None, docket_number=None, subject=None, document_date=None, publish_date=None, size=None, file_name=None, url=None)[source]
Bases:
objectStructured metadata for a document.
- Parameters:
accession_number (str | None)
title (str | None)
document_type (str | None)
author_name (str | None)
author_affiliation (str | None)
docket_number (str | None)
subject (str | None)
document_date (datetime | None)
publish_date (datetime | None)
size (int | None)
file_name (str | None)
url (str | None)
- accession_number: str | None = None
- title: str | None = None
- document_type: str | None = None
- author_name: str | None = None
- author_affiliation: str | None = None
- docket_number: str | None = None
- subject: str | None = None
- document_date: datetime | None = None
- publish_date: datetime | None = None
- size: int | None = None
- file_name: str | None = None
- url: str | None = None
- class adamsnrc.types.SearchStatistics(total_results, unique_authors, unique_document_types, date_range=None, average_size=0.0, size_distribution=<factory>, document_type_distribution=<factory>, author_distribution=<factory>)[source]
Bases:
objectStatistics about search results.
- Parameters:
total_results (int)
unique_authors (int)
unique_document_types (int)
date_range (Dict[str, datetime] | None)
average_size (float)
size_distribution (Dict[str, int])
document_type_distribution (Dict[str, int])
author_distribution (Dict[str, int])
- total_results: int
- unique_authors: int
- unique_document_types: int
- date_range: Dict[str, datetime] | None = None
- average_size: float = 0.0
- size_distribution: Dict[str, int]
- document_type_distribution: Dict[str, int]
- author_distribution: Dict[str, int]
- class adamsnrc.types.SearchResult(metadata, results, documents=<factory>, statistics=None)[source]
Bases:
objectEnhanced search result with structured data.
- Parameters:
metadata (Dict[str, str])
results (List[Dict[str, str]])
documents (List[DocumentMetadata])
statistics (SearchStatistics | None)
- metadata: Dict[str, str]
- results: List[Dict[str, str]]
- documents: List[DocumentMetadata]
- statistics: SearchStatistics | None = None
- property count: int
Return the count as an integer.
- property matches: int
Return the matches as an integer.
Query builder
Builder pattern for constructing ADAMS API search queries.
This module provides a fluent interface for building complex search queries that is more intuitive for coding agents and human developers.
- class adamsnrc.builder.SearchQueryBuilder[source]
Bases:
objectFluent builder for constructing ADAMS API search queries.
This builder provides a more intuitive interface for creating complex search queries, especially useful for coding agents that need to construct queries step by step.
- add_property_and(property_name, operator, value)[source]
Add a property search condition with AND logic.
- Parameters:
property_name (str) – The property to search on
operator (str | SearchOperator) – The search operator (string or SearchOperator enum)
value (Any) – The value to search for
- Returns:
Self for method chaining
- Return type:
- add_property_or(property_name, operator, value)[source]
Add a property search condition with OR logic.
- Parameters:
property_name (str) – The property to search on
operator (str | SearchOperator) – The search operator (string or SearchOperator enum)
value (Any) – The value to search for
- Returns:
Self for method chaining
- Return type:
- content_search(text)[source]
Set the full-text content search.
- Parameters:
text (str) – The text to search for in document content
- Returns:
Self for method chaining
- Return type:
- date_range(start_date, end_date, format_str='%m/%d/%Y %I:%M %p')[source]
Set a date range filter.
- Parameters:
start_date (str | datetime) – Start date (string or datetime)
end_date (str | datetime) – End date (string or datetime)
format_str (str) – Date format string (if using string dates)
- Returns:
Self for method chaining
- Return type:
- public_library(include=True)[source]
Configure public library inclusion.
- Parameters:
include (bool) – Whether to include public library
- Returns:
Self for method chaining
- Return type:
- legacy_library(include=True)[source]
Configure legacy library inclusion.
- Parameters:
include (bool) – Whether to include legacy library
- Returns:
Self for method chaining
- Return type:
- added_today(filter_today=True)[source]
Filter for items added today.
- Parameters:
filter_today (bool) – Whether to filter for items added today
- Returns:
Self for method chaining
- Return type:
- added_this_month(filter_month=True)[source]
Filter for items added this month.
- Parameters:
filter_month (bool) – Whether to filter for items added this month
- Returns:
Self for method chaining
- Return type:
- within_folder(path, include_subfolders=False)[source]
Configure within folder search.
- Parameters:
path (str) – Folder path to search within
include_subfolders (bool) – Whether to include subfolders
- Returns:
Self for method chaining
- Return type:
- sort_by(field, order=SortOrder.DESCENDING)[source]
Set sort field and order.
- Parameters:
- Returns:
Self for method chaining
- Return type:
- by_docket(docket_number)[source]
Filter by docket number.
- Parameters:
docket_number (str)
- Return type:
- by_document_type(doc_type)[source]
Filter by document type.
- Parameters:
doc_type (str | DocumentType)
- Return type:
- adamsnrc.builder.part21_search()[source]
Create a builder for Part 21 correspondence searches.
- Return type:
- adamsnrc.builder.inspection_report_search()[source]
Create a builder for inspection report searches.
- Return type:
- adamsnrc.builder.author_search(author_name)[source]
Create a builder for author-based searches.
- Parameters:
author_name (str)
- Return type:
Client
ADAMS API Client class for better state management and configuration.
This module provides a client class that encapsulates the ADAMS API functionality and provides a more object-oriented interface for coding agents.
- class adamsnrc.client.ADAMSClient(base_url=None, timeout=None, max_retries=None, log_level=None)[source]
Bases:
objectClient class for interacting with the ADAMS API.
This class provides a more object-oriented interface to the ADAMS API, with built-in configuration management, caching, and convenience methods that make it easier for coding agents to work with the API.
- Parameters:
base_url (str | None)
timeout (int | None)
max_retries (int | None)
log_level (str | None)
- search(query)[source]
Execute a search using a SearchQuery object.
- Parameters:
query (SearchQuery) – The SearchQuery object to execute
- Returns:
SearchResult containing the search results
- Raises:
ADAMSError – If the search fails
- Return type:
- search_builder()[source]
Get a new SearchQueryBuilder instance.
- Returns:
SearchQueryBuilder for constructing search queries
- Return type:
- search_nureg(content='', **kwargs)[source]
Search for NUREG documents.
- Parameters:
content (str) – Content search text
**kwargs – Additional search parameters
- Returns:
SearchResult containing NUREG documents
- Return type:
- search_part21(content='', **kwargs)[source]
Search for Part 21 correspondence.
- Parameters:
content (str) – Content search text
**kwargs – Additional search parameters
- Returns:
SearchResult containing Part 21 documents
- Return type:
- search_inspection_reports(content='', **kwargs)[source]
Search for inspection reports.
- Parameters:
content (str) – Content search text
**kwargs – Additional search parameters
- Returns:
SearchResult containing inspection reports
- Return type:
- search_by_author(author, **kwargs)[source]
Search for documents by author.
- Parameters:
author (str) – Author name to search for
**kwargs – Additional search parameters
- Returns:
SearchResult containing documents by the author
- Return type:
- search_by_docket(docket, **kwargs)[source]
Search for documents by docket number.
- Parameters:
docket (str) – Docket number to search for
**kwargs – Additional search parameters
- Returns:
SearchResult containing documents for the docket
- Return type:
- content_search(*args, **kwargs)[source]
Legacy content_search method for backward compatibility.
- Return type:
- advanced_search(*args, **kwargs)[source]
Legacy advanced_search method for backward compatibility.
- Return type:
- part21_search_content(*args, **kwargs)[source]
Legacy part21_search_content method for backward compatibility.
- Return type:
- part21_search_advanced(*args, **kwargs)[source]
Legacy part21_search_advanced method for backward compatibility.
- Return type:
- operating_reactor_ir_search_content(*args, **kwargs)[source]
Legacy operating_reactor_ir_search_content method for backward compatibility.
- Return type:
- operating_reactor_ir_search_advanced(*args, **kwargs)[source]
Legacy operating_reactor_ir_search_advanced method for backward compatibility.
- Return type:
- get_statistics()[source]
Get client usage statistics.
- Returns:
Dictionary containing usage statistics
- Return type:
Dict[str, Any]
- set_cache_size(size)[source]
Set the maximum cache size.
- Parameters:
size (int) – Maximum number of cached results
- Return type:
None
- batch_search(queries)[source]
Execute multiple searches in batch.
- Parameters:
queries (List[SearchQuery]) – List of SearchQuery objects to execute
- Returns:
List of SearchResult objects
- Return type:
List[SearchResult]
- search_with_retry(query, max_retries=3)[source]
Execute a search with automatic retry on failure.
- Parameters:
query (SearchQuery) – The SearchQuery object to execute
max_retries (int) – Maximum number of retry attempts
- Returns:
SearchResult containing the search results
- Raises:
ADAMSError – If all retry attempts fail
- Return type:
- adamsnrc.client.create_client(**kwargs)[source]
Create a new ADAMS client with the specified configuration.
- Parameters:
**kwargs – Configuration parameters for the client
- Returns:
Configured ADAMSClient instance
- Return type:
- adamsnrc.client.get_default_client()[source]
Get the default client instance, creating it if necessary.
- Returns:
Default ADAMSClient instance
- Return type:
- adamsnrc.client.set_default_client(client)[source]
Set the default client instance.
- Parameters:
client (ADAMSClient) – The ADAMSClient instance to use as default
- Return type:
None
Abstraction layer
Simplified abstractions for the ADAMS API client.
This module provides high-level abstractions that simplify common API usage patterns, making it easier for coding agents to work with the ADAMS API without needing to understand the underlying complexity.
- class adamsnrc.abstractions.SimpleADAMSClient(**kwargs)[source]
Bases:
objectSimplified ADAMS API client with intuitive method names and reduced complexity.
This class provides a more user-friendly interface that abstracts away the complexity of the underlying API while maintaining full functionality.
- find_documents(query='', document_type=None, author=None, docket=None, **kwargs)[source]
Find documents with a simple, intuitive interface.
- Parameters:
query (str) – Search query text
document_type (str | None) – Type of document (NUREG, Letter, etc.)
author (str | None) – Author name
docket (str | None) – Docket number
**kwargs – Additional search parameters
- Returns:
Dictionary with search results and metadata
- Return type:
Dict[str, Any]
- find_by_type(document_type, query='')[source]
Find documents by type with optional content search.
- Parameters:
document_type (str)
query (str)
- Return type:
Dict[str, Any]
- find_by_author(author, query='')[source]
Find documents by author with optional content search.
- Parameters:
author (str)
query (str)
- Return type:
Dict[str, Any]
- find_by_docket(docket, query='')[source]
Find documents by docket with optional content search.
- Parameters:
docket (str)
query (str)
- Return type:
Dict[str, Any]
- find_recent(days=30, query='')[source]
Find documents added in the last N days.
- Parameters:
days (int)
query (str)
- Return type:
Dict[str, Any]
- find_in_date_range(start_date, end_date, query='')[source]
Find documents within a specific date range.
- Parameters:
start_date (str | datetime)
end_date (str | datetime)
query (str)
- Return type:
Dict[str, Any]
- find_nureg(topic='')[source]
Find NUREG documents about a specific topic.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- find_letters(topic='')[source]
Find letters about a specific topic.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- find_part21(topic='')[source]
Find Part 21 correspondence about a specific topic.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- find_inspection_reports(topic='')[source]
Find inspection reports about a specific topic.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- find_safety_documents(query='')[source]
Find safety-related documents.
- Parameters:
query (str)
- Return type:
Dict[str, Any]
- find_security_documents(query='')[source]
Find security-related documents.
- Parameters:
query (str)
- Return type:
Dict[str, Any]
- find_multiple_authors(authors, query='')[source]
Find documents by multiple authors.
- Parameters:
authors (List[str])
query (str)
- Return type:
Dict[str, Dict[str, Any]]
- find_multiple_dockets(dockets, query='')[source]
Find documents by multiple dockets.
- Parameters:
dockets (List[str])
query (str)
- Return type:
Dict[str, Dict[str, Any]]
- find_multiple_types(document_types, query='')[source]
Find documents of multiple types.
- Parameters:
document_types (List[str])
query (str)
- Return type:
Dict[str, Dict[str, Any]]
- get_document_stats(query='', **filters)[source]
Get statistics about documents matching criteria.
- Parameters:
query (str)
- Return type:
Dict[str, Any]
- get_author_stats(query='')[source]
Get statistics about authors for documents matching query.
- Parameters:
query (str)
- Return type:
Dict[str, Any]
- get_type_stats(query='')[source]
Get statistics about document types for documents matching query.
- Parameters:
query (str)
- Return type:
Dict[str, Any]
- class adamsnrc.abstractions.QuickSearch[source]
Bases:
objectUltra-simplified search interface for the most common use cases.
This class provides static methods for quick, one-line searches without needing to instantiate a client.
- classmethod nureg(topic)[source]
Quick NUREG search.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- classmethod letters(topic)[source]
Quick letters search.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- classmethod part21(topic)[source]
Quick Part 21 search.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- classmethod inspections(topic)[source]
Quick inspection reports search.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- classmethod author(author, topic='')[source]
Quick author search.
- Parameters:
author (str)
topic (str)
- Return type:
Dict[str, Any]
- classmethod docket(docket, topic='')[source]
Quick docket search.
- Parameters:
docket (str)
topic (str)
- Return type:
Dict[str, Any]
- class adamsnrc.abstractions.SearchTemplate(client=None)[source]
Bases:
objectPre-defined search templates for common use cases.
This class provides ready-to-use search patterns that can be customized with specific parameters.
- Parameters:
client (SimpleADAMSClient | None)
- regulatory_letters(topic='', author='', days=30)[source]
Template for regulatory letters.
- Parameters:
topic (str)
author (str)
days (int)
- Return type:
Dict[str, Any]
- safety_reports(topic='', docket='')[source]
Template for safety reports.
- Parameters:
topic (str)
docket (str)
- Return type:
Dict[str, Any]
- emergency_documents(days=7)[source]
Template for emergency-related documents.
- Parameters:
days (int)
- Return type:
Dict[str, Any]
- class adamsnrc.abstractions.SimpleSearchRequest(query='', document_type=None, author=None, docket=None, subject=None, start_date=None, end_date=None, sort_by='date', sort_order='desc', limit=None, include_public=True, include_legacy=False)[source]
Bases:
objectSimplified search request structure.
- Parameters:
query (str)
document_type (str | None)
author (str | None)
docket (str | None)
subject (str | None)
start_date (str | datetime | None)
end_date (str | datetime | None)
sort_by (str)
sort_order (str)
limit (int | None)
include_public (bool)
include_legacy (bool)
- query: str = ''
- document_type: str | None = None
- author: str | None = None
- docket: str | None = None
- subject: str | None = None
- start_date: str | datetime | None = None
- end_date: str | datetime | None = None
- sort_by: str = 'date'
- sort_order: str = 'desc'
- limit: int | None = None
- include_public: bool = True
- include_legacy: bool = False
- class adamsnrc.abstractions.SearchFilters(document_types=None, authors=None, dockets=None, subjects=None, date_range=None, added_today=False, added_this_month=False, folder_path=None)[source]
Bases:
objectSimplified search filters.
- Parameters:
document_types (List[str])
authors (List[str])
dockets (List[str])
subjects (List[str])
date_range (Tuple[str | datetime, str | datetime] | None)
added_today (bool)
added_this_month (bool)
folder_path (str | None)
- document_types: List[str] = None
- authors: List[str] = None
- dockets: List[str] = None
- subjects: List[str] = None
- date_range: Tuple[str | datetime, str | datetime] | None = None
- added_today: bool = False
- added_this_month: bool = False
- folder_path: str | None = None
- adamsnrc.abstractions.quick_search(query, doc_type=None)[source]
One-line function for quick searches.
- Parameters:
query (str)
doc_type (str)
- Return type:
Dict[str, Any]
- adamsnrc.abstractions.find_nureg(topic)[source]
One-line function to find NUREG documents.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- adamsnrc.abstractions.find_letters(topic)[source]
One-line function to find letters.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
- adamsnrc.abstractions.find_safety_docs(topic='')[source]
One-line function to find safety documents.
- Parameters:
topic (str)
- Return type:
Dict[str, Any]
Helpers
Helper functions for common ADAMS API operations.
This module provides convenient helper functions for frequently used search patterns and operations with the ADAMS API.
- adamsnrc.helpers.search_documents_by_title(search_string, client=None, max_results=100)[source]
Search for documents that contain a specific string in the title.
This function searches across all document types in the ADAMS library for documents whose titles contain the specified search string.
- Parameters:
search_string (str) – The string to search for in document titles
client (Optional[ADAMSClient], optional) – ADAMS client instance to use. If None, uses the default client. Defaults to None.
max_results (int, optional) – Maximum number of results to process. Defaults to 100.
- Returns:
- Dictionary mapping document titles to their AccessionNumbers
(IDs). Format: {“Document Title”: “AccessionNumber”}
- Return type:
Dict[str, str]
- Raises:
ADAMSError – If the search fails
ValueError – If search_string is empty or None
Example
>>> title_id_map = search_documents_by_title("steam generator") >>> for title, doc_id in title_id_map.items(): ... print(f"Title: {title}") ... print(f"ID: {doc_id}") ... print("---")
- adamsnrc.helpers.search_documents_by_title_exact(search_string, client=None, max_results=100)[source]
Search for documents with titles that start with a specific string.
This function performs a more precise search for documents whose titles start with the specified search string, useful for finding specific document series or types.
- Parameters:
search_string (str) – The string that document titles should start with
client (Optional[ADAMSClient], optional) – ADAMS client instance to use. If None, uses the default client. Defaults to None.
max_results (int, optional) – Maximum number of results to process. Defaults to 100.
- Returns:
Dictionary mapping document titles to their AccessionNumbers
- Return type:
Dict[str, str]
- Raises:
ADAMSError – If the search fails
ValueError – If search_string is empty or None
Example
>>> title_id_map = search_documents_by_title_exact("NUREG") >>> for title, doc_id in title_id_map.items(): ... print(f"Title: {title}") ... print(f"ID: {doc_id}")
- adamsnrc.helpers.search_documents_by_title_and_type(search_string, document_type, client=None, max_results=100)[source]
Search for documents of a specific type that contain a string in the title.
This function combines document type filtering with title search to provide more targeted results.
- Parameters:
search_string (str) – The string to search for in document titles
document_type (str) – The type of document to filter by (e.g., “NUREG”, “Letter”)
client (Optional[ADAMSClient], optional) – ADAMS client instance to use. If None, uses the default client. Defaults to None.
max_results (int, optional) – Maximum number of results to process. Defaults to 100.
- Returns:
Dictionary mapping document titles to their AccessionNumbers
- Return type:
Dict[str, str]
- Raises:
ADAMSError – If the search fails
ValueError – If search_string or document_type is empty or None
Example
>>> title_id_map = search_documents_by_title_and_type("steam generator", "NUREG") >>> for title, doc_id in title_id_map.items(): ... print(f"NUREG Title: {title}") ... print(f"ID: {doc_id}")
- adamsnrc.helpers.search_nureg_by_title(search_string, client=None, max_results=100)[source]
Search for NUREG documents that contain a specific string in the title.
- Parameters:
search_string (str) – The string to search for in NUREG titles
client (Optional[ADAMSClient], optional) – ADAMS client instance to use
max_results (int, optional) – Maximum number of results to process
- Returns:
Dictionary mapping NUREG titles to their AccessionNumbers
- Return type:
Dict[str, str]
- adamsnrc.helpers.search_letters_by_title(search_string, client=None, max_results=100)[source]
Search for Letter documents that contain a specific string in the title.
- Parameters:
search_string (str) – The string to search for in letter titles
client (Optional[ADAMSClient], optional) – ADAMS client instance to use
max_results (int, optional) – Maximum number of results to process
- Returns:
Dictionary mapping letter titles to their AccessionNumbers
- Return type:
Dict[str, str]
- adamsnrc.helpers.search_reports_by_title(search_string, client=None, max_results=100)[source]
Search for Report documents that contain a specific string in the title.
- Parameters:
search_string (str) – The string to search for in report titles
client (Optional[ADAMSClient], optional) – ADAMS client instance to use
max_results (int, optional) – Maximum number of results to process
- Returns:
Dictionary mapping report titles to their AccessionNumbers
- Return type:
Dict[str, str]
- adamsnrc.helpers.search_documents_by_content(search_string, client=None, max_results=100)[source]
Search for documents that contain a specific string in their content (not just title).
This function performs a full-text content search, which is more likely to return results than title-only searches. Use this when you want to find documents that mention a topic anywhere in their content.
- Parameters:
search_string (str) – The string to search for in document content
client (Optional[ADAMSClient], optional) – ADAMS client instance to use. If None, uses the default client. Defaults to None.
max_results (int, optional) – Maximum number of results to process. Defaults to 100.
- Returns:
- Dictionary mapping document titles to their AccessionNumbers
(IDs). Format: {“Document Title”: “AccessionNumber”}
- Return type:
Dict[str, str]
- Raises:
ADAMSError – If the search fails
ValueError – If search_string is empty or None
Example
>>> title_id_map = search_documents_by_content("steam generator") >>> for title, doc_id in title_id_map.items(): ... print(f"Title: {title}") ... print(f"ID: {doc_id}") ... print("---")
Utilities
Utility functions for the ADAMS API client.
- adamsnrc.utils.sanitize_string(value)[source]
Sanitize a value to a safe string representation.
- Parameters:
value (Any)
- Return type:
str
- adamsnrc.utils.validate_and_format_date(date_str, format_str='%m/%d/%Y %I:%M %p')[source]
Validate and format a date string.
- Parameters:
date_str (str) – Date string to validate and format
format_str (str) – Expected format of the date string
- Returns:
Formatted date string
- Raises:
ValueError – If date string is invalid
- Return type:
str
- adamsnrc.utils.build_date_range(start_date, end_date, format_str='%m/%d/%Y %I:%M %p')[source]
Build a properly formatted date range tuple.
- Parameters:
start_date (str | date | datetime) – Start date (string, date, or datetime object)
end_date (str | date | datetime) – End date (string, date, or datetime object)
format_str (str) – Format string for date output
- Returns:
Tuple of (start_date_str, end_date_str)
- Return type:
tuple[str, str]
- adamsnrc.utils.escape_special_chars(text)[source]
Escape special characters that might cause issues in search queries.
- Parameters:
text (str)
- Return type:
str
- adamsnrc.utils.normalize_whitespace(text)[source]
Normalize whitespace in text (replace multiple spaces with single space).
- Parameters:
text (str)
- Return type:
str
- adamsnrc.utils.truncate_text(text, max_length=1000)[source]
Truncate text to maximum length, preserving word boundaries.
- Parameters:
text (str)
max_length (int)
- Return type:
str
- adamsnrc.utils.validate_docket_number(docket)[source]
Validate NRC docket number format.
- Parameters:
docket (str) – Docket number to validate
- Returns:
True if valid, False otherwise
- Return type:
bool
- adamsnrc.utils.format_docket_number(docket)[source]
Format docket number to standard format.
- Parameters:
docket (str) – Raw docket number
- Returns:
Formatted docket number
- Return type:
str
- adamsnrc.utils.extract_metadata_from_result(result)[source]
Extract and parse metadata from a search result.
- Parameters:
result (dict[str, str]) – Raw result dictionary
- Returns:
Parsed metadata dictionary
- Return type:
dict[str, Any]
- adamsnrc.utils.filter_results_by_date(results, start_date=None, end_date=None, date_field='DocumentDate')[source]
Filter search results by date range.
- Parameters:
results (list[dict[str, str]]) – List of result dictionaries
start_date (datetime | None) – Start date for filtering
end_date (datetime | None) – End date for filtering
date_field (str) – Field name containing the date
- Returns:
Filtered list of results
- Return type:
list[dict[str, str]]
- adamsnrc.utils.group_results_by_field(results, field)[source]
Group search results by a specific field.
- Parameters:
results (list[dict[str, str]]) – List of result dictionaries
field (str) – Field name to group by
- Returns:
Dictionary with field values as keys and lists of results as values
- Return type:
dict[str, list[dict[str, str]]]
Configuration
Configuration settings for the ADAMS API client.
CLI
Command-line interface for ADAMSNRC.