Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inspector FHIR

A command-line utility and Python module for discovering FHIR endpoints and related API metadata.

Overview

ifhir.py searches for FHIR and related endpoints on a given URL/host, including:

  • FHIR metadata (CapabilityStatement)
  • SMART-on-FHIR discovery endpoints
  • OIDC discovery endpoints
  • OAuth2 discovery endpoints
  • Swagger/OpenAPI documentation
  • API documentation UIs

Installation

pip install inspectorfhir

Command Line Usage

Basic Usage

python ifhir.py --url https://example.com/fhir

Options

  • --url, -U, -u: Full FHIR URL where metadata should be found (e.g., https://example.com/fhir)
  • --hostname, -H: Target server hostname (e.g., https://example.com)
  • --fhir_prefix, -F: FHIR API prefix (e.g., /fhir) - used with --hostname
  • --all, -A: Include full details of each endpoint check in the output

Examples

Using a full URL:

python ifhir.py --url https://example.com/fhir/metadata

Using hostname and prefix separately:

python ifhir.py --hostname https://example.com --fhir_prefix /fhir

Include detailed results:

python ifhir.py --url https://example.com/fhir --all

Using as a Python Module

Import the Module

from inspectorfhir.ifhir import fhir_recognizer

Function: fhir_recognizer(url, include_details=True)

Parameters:

  • url (str): The FHIR endpoint URL to check
  • include_details (bool): Whether to include detailed response data (default: True)

Returns: Dictionary containing discovery results

Example Usage

from inspectorfhir.ifhir import fhir_recognizer
import json

# Check a FHIR endpoint with full details
result = fhir_recognizer('https://example.com/fhir', include_details=True)
print(json.dumps(result, indent=2))

# Check without detailed response data
result = fhir_recognizer('https://example.com/fhir', include_details=False)
print(json.dumps(result, indent=2))

Response Structure

The response includes a report section with discovery results:

{
    "report": {
        "fhir_metadata": {"url": "...", "found": true},
        "oidc_discovery": {"url": "...", "found": false},
        "oauth2_discovery": {"url": "...", "found": false},
        "smart_discovery_1": {"url": "...", "found": true},
        "smart_discovery_2": {"url": "...", "found": false},
        "documentation_ui": {"found": true, "https://...": true},
        "swagger_json": {"found": true, "https://...": true}
    }
}

When include_details=True, a details section contains full HTTP responses and data from each endpoint.

About

Library and command line tools for inspecting FHIR server's discoverble endpoints.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages