Search by

kraenzle-ritter / nara-risk

ottosmops

Laravel package for automated digital preservation risk assessment based on NARA Digital Preservation Framework TTL/RDF data

Package info

github.com/kraenzle-ritter/nara-risk

pkg:composer/kraenzle-ritter/nara-risk

Statistics

Installs: 70

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-10-16 06:59 UTC

This package is auto-updated.

Last update: 2026-10-19 11:41:39 UTC


README

Tests Code Style codecov PHPStan Level 5 Latest Stable Version Total Downloads License PHP Version Require

A Laravel package for automated digital preservation risk assessment based on the NARA Digital Preservation Framework.

Features

  • Official NARA TTL/RDF data integration
  • Automatic caching with 28-day refresh cycle
  • Nara Risk assessment for 100+ file formats via PRONOM IDs
  • Nara Preservation action recommendations
  • Support for 16 NARA format categories
  • Nara Tool suggestions for preservation workflows

Installation

composer require kraenzle-ritter/nara-risk

The package auto-registers via Laravel's package discovery.

Usage

use KraenzleRitter\NaraRisk\Services\NaraAssessmentService;

$service = app(NaraAssessmentService::class);
$result = $service->assessFile('fmt/276'); // PDF 1.7

echo $result['risk_level'];           // "Low"
echo $result['category'];             // "Presentation and Publishing"
echo $result['recommended_action'];   // "Retain"

Response Structure

Each assessment returns an array with these key fields:

  • pronom_id - PRONOM identifier
  • format_name - Human-readable format name
  • category - NARA format category
  • risk_level - Low, Moderate, or High
  • recommended_action - Retain, Transform, Assess, or Identify
  • tools - Array of suggested preservation tools
  • nara_compliant - Boolean indicating NARA framework coverage
  • assessment_notes - Detailed recommendations

Additional Methods

// Get all supported PRONOM IDs
$ids = $service->getSupportedPronomIds();

// Get format statistics
$stats = $service->getFormatStatistics();

// Check cache status
$cacheInfo = $service->getCacheInfo();

Configuration

Publish the configuration with php artisan vendor:publish --tag=nara-config, or set the environment variable. The defaults:

Key Default
cache_directory storage/app/nara TTL files and the parsed format table
cache_days 28 age after which fileformats.ttl is downloaded again
download true (NARA_DOWNLOAD) false on servers without internet access: the file in the cache directory is used however old, and nothing waits for a download
timeout 60 seconds per download
retry_after_minutes 360 a failed download is not retried before; meanwhile the old file is used, or the assessment fails at once if there is none
schema_urls archives.gov fileformats is read by the assessment; nara:download-schema fetches all

The parsed table is stored next to the TTL file (nara_fileformats.ttl.parsed) and reused while the file is unchanged, so a queue job assessing a single file does not parse 1 MB of Turtle each time.

Testing

Run the test suite:

composer test

Some tests download from archives.gov; NaraTtlCacheTest runs without network.

Requirements

  • PHP 8.2+
  • Laravel 11.44+ | 12.4+ | 13

Data Sources

This package uses official data from:

Data is cached locally and refreshed automatically every 28 days.

License

This project is licensed under the MIT License.