typer integration and header for PAD AUF
This commit is contained in:
109
CLAUDE.md
109
CLAUDE.md
@@ -49,28 +49,100 @@ FHIR JSON Bundle → Validation → Resource Grouping → Mapping → PAD XML Ge
|
||||
|
||||
### Convert FHIR to PAD XML
|
||||
|
||||
Basic conversion:
|
||||
**Note**: The converter now uses [Typer](https://typer.tiangolo.com/) for the CLI, providing better error messages, colored output, and shell completion support.
|
||||
|
||||
Basic conversion (uses defaults from mapping_config.json):
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py \
|
||||
--input-json Input.json \
|
||||
--output-xml output.xml
|
||||
python3 fhir_to_pad_converter.py -i Input.json -o .
|
||||
```
|
||||
|
||||
With validation and report:
|
||||
With XSD validation:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py \
|
||||
--input-json samples/fhir/sample_1/226844_1240059013-KaBr.json \
|
||||
--output-xml output.xml \
|
||||
--report-json report.json \
|
||||
-i samples/fhir/sample_1/226844_1240059013-KaBr.json \
|
||||
-o . \
|
||||
--pad-xsd specs/padnext/padx_adl_v2.12.xsd
|
||||
```
|
||||
|
||||
With header configuration:
|
||||
With verbose output:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py \
|
||||
--input-json Input.json \
|
||||
--output-xml output.xml \
|
||||
--header-cfg header_config.json
|
||||
python3 fhir_to_pad_converter.py -i Input.json -o . --verbose
|
||||
|
||||
# Or short form:
|
||||
python3 fhir_to_pad_converter.py -i Input.json -o . -v
|
||||
```
|
||||
|
||||
Get help:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py --help
|
||||
```
|
||||
|
||||
### Shell Completion (Optional)
|
||||
|
||||
Typer provides automatic shell completion. To install:
|
||||
|
||||
**Bash**:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py --install-completion bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
**Zsh**:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py --install-completion zsh
|
||||
source ~/.zshrc
|
||||
```
|
||||
|
||||
**Fish**:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py --install-completion fish
|
||||
source ~/.config/fish/config.fish
|
||||
```
|
||||
|
||||
After installation, you can use tab completion:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py --input-<TAB>
|
||||
# Shows: --input-json
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Unified Configuration File (mapping_config.json)
|
||||
|
||||
The converter uses a **single configuration file** (`mapping_config.json`) that contains:
|
||||
1. **Header configuration** - Practice/billing information (sender, recipient, etc.)
|
||||
2. **Resource mapping** - How FHIR resources map to PADneXt billing positions
|
||||
|
||||
**Key Benefits**:
|
||||
- ✅ Single file to manage
|
||||
- ✅ Header defaults automatically loaded
|
||||
- ✅ Easy to version control
|
||||
- ✅ No need for separate `--header-cfg` flag
|
||||
|
||||
**Structure**:
|
||||
```json
|
||||
{
|
||||
"header": {
|
||||
"empfaenger_name": "AOK Berlin",
|
||||
"leistungserbringer_name": "Schmidt",
|
||||
"rechnungsersteller_kundennr": "PRX123456",
|
||||
...
|
||||
},
|
||||
"resources": {
|
||||
"Observation": { ... },
|
||||
"Procedure": { ... }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Customization**:
|
||||
1. Edit `mapping_config.json` directly
|
||||
2. Update `header` section with your practice details
|
||||
3. No command-line changes needed - automatically loaded
|
||||
|
||||
**Override**: You can still use `--header-cfg` to override the defaults:
|
||||
```bash
|
||||
python3 fhir_to_pad_converter.py -i input.json -o . --header-cfg custom_header.json
|
||||
```
|
||||
|
||||
### Validate PADneXt XML
|
||||
@@ -92,12 +164,17 @@ python3 validate_padnext.py \
|
||||
## Dependencies
|
||||
|
||||
- **Python 3.11+**
|
||||
- **Required**: `lxml` (XSD validation), `jsonschema` (FHIR validation)
|
||||
- **Built-in**: `xml.etree.ElementTree`, `argparse`, `json`, `datetime`, `random`
|
||||
- **Required**:
|
||||
- `lxml` (XSD validation)
|
||||
- `jsonschema` (FHIR validation)
|
||||
- `typer[all]` (Modern CLI framework with colored output)
|
||||
- **Built-in**: `xml.etree.ElementTree`, `json`, `datetime`, `pathlib`, `logging`
|
||||
|
||||
Install dependencies:
|
||||
```bash
|
||||
pip3 install lxml jsonschema
|
||||
pip3 install -r requirements.txt
|
||||
# Or manually:
|
||||
pip3 install lxml jsonschema 'typer[all]'
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
Reference in New Issue
Block a user