Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FML Syntax Validation Demo</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}

.container {
background: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
color: #333;
border-bottom: 2px solid #007acc;
padding-bottom: 10px;
}

.demo-section {
margin-bottom: 40px;
}

.result {
margin-top: 20px;
padding: 15px;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 14px;
white-space: pre-wrap;
}

.result.valid {
background-color: #d4edda;
border: 1px solid #c3e6cb;
color: #155724;
}

.result.invalid {
background-color: #f8d7da;
border: 1px solid #f5c6cb;
color: #721c24;
}

.example {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 4px;
padding: 15px;
margin: 10px 0;
}

.curl-example {
background-color: #2d3748;
color: #68d391;
padding: 15px;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 14px;
overflow-x: auto;
margin: 10px 0;
}
</style>
</head>
<body>
<div class="container">
<h1>🔍 FML Syntax Validation Endpoint</h1>

<p>Implementation of FML (FHIR Mapping Language) syntax validation endpoint as requested in the issue. This provides detailed error messages with line and column information for debugging FML syntax errors.</p>

<div class="demo-section">
<h2>✅ Valid FML Example</h2>
<div class="example">
<h3>Input FML:</h3>
<div class="result valid">map "http://example.org/fhir/StructureMap/PatientTransform" = "PatientTransform"

uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source
uses "http://example.org/StructureDefinition/MyPatient" alias MyPatient as target

group Patient(source src : Patient, target tgt : MyPatient) {
src.name -> tgt.name;
src.gender -> tgt.gender;
}</div>
<h3>Validation Response:</h3>
<div class="result valid">{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "information",
"code": "informational",
"diagnostics": "FML syntax is valid"
}
]
}</div>
</div>
</div>

<div class="demo-section">
<h2>❌ Invalid FML Example</h2>
<div class="example">
<h3>Input FML (with syntax errors):</h3>
<div class="result invalid">// Missing map declaration
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source

group Test(source src {
// Missing closing paren and brace
}</div>
<h3>Validation Response:</h3>
<div class="result invalid">{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "invalid",
"diagnostics": "FML content must start with a map declaration",
"location": ["line 1, column 1"]
}
]
}</div>
</div>
</div>

<div class="demo-section">
<h2>🚀 API Usage</h2>
<div class="example">
<h3>REST API Endpoint:</h3>
<div class="curl-example">POST /api/v1/fml/validate-syntax

curl -X POST http://localhost:3000/api/v1/fml/validate-syntax \
-H "Content-Type: application/json" \
-d '{"fmlContent": "map \"test\" = \"Test\""}'</div>

<h3>MCP Tool:</h3>
<div class="curl-example">Tool: validate-fml-syntax
Input: {"fmlContent": "map \"test\" = \"Test\""}</div>
</div>
</div>

<div class="demo-section">
<h2>🛠️ Features Implemented</h2>
<ul>
<li>✅ <strong>Detailed Error Messages</strong>: Line and column information</li>
<li>✅ <strong>Warning System</strong>: Warnings for missing groups</li>
<li>✅ <strong>Comment Handling</strong>: Single-line (//) and multi-line (/* */)</li>
<li>✅ <strong>Bracket Validation</strong>: Unmatched braces and parentheses</li>
<li>✅ <strong>Keyword Validation</strong>: Required FML keywords</li>
<li>✅ <strong>FHIR Compliance</strong>: OperationOutcome responses</li>
<li>✅ <strong>Multiple Interfaces</strong>: REST API + MCP</li>
</ul>
</div>

<div class="demo-section">
<h2>🧪 Test Results</h2>
<div class="example">
<p><strong>Core Library Tests:</strong> 11/11 passing ✅</p>
<p><strong>REST API Tests:</strong> 8/8 passing ✅</p>
<p><strong>MCP Interface:</strong> Working ✅</p>
</div>
</div>
</div>
</body>
</html>
Loading