diff --git a/Dockerfile b/Dockerfile index 799d031..1386da8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN pip install --no-cache-dir -r requirements.txt COPY app.py . COPY services.py . COPY templates/ templates/ +COPY static/ static/ # Ensure /tmp is writable as a fallback RUN mkdir -p /tmp && chmod 777 /tmp diff --git a/Dump/base.html.txt b/Dump/base.html.txt new file mode 100644 index 0000000..cdad0d0 --- /dev/null +++ b/Dump/base.html.txt @@ -0,0 +1,91 @@ + + + + + + + + + {% if title %}{{ title }} - {% endif %}{{ site_name }} + + + + +
+ {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} + + {% endfor %} + {% endif %} + {% endwith %} + {% block content %}{% endblock %} +
+ + + + + + + {% block scripts %} + {# Tooltip Initialization Script #} + + {% endblock %} + + \ No newline at end of file diff --git a/Dump/index.html.txt b/Dump/index.html.txt new file mode 100644 index 0000000..0cbeb42 --- /dev/null +++ b/Dump/index.html.txt @@ -0,0 +1,16 @@ +{% extends "base.html" %} {% block content %}
+ PAS Logo Placeholder + +

Welcome to {{ site_name }}

+
+

+ This is the starting point for our modular Patient Administration System. + We will build upon this core framework by adding modules through the control panel. +

+
+ + +
+
+
+{% endblock %} diff --git a/app.py b/app.py index dd15676..48a523a 100644 --- a/app.py +++ b/app.py @@ -65,26 +65,7 @@ class ProcessedIg(db.Model): @app.route('/') def index(): - return render_template_string(''' - - - - - FHIR IG Toolkit - - - - -

FHIR IG Toolkit

-

Simple tool for importing and viewing FHIR Implementation Guides.

- - - - - ''') + return render_template('index.html', site_name='FHIRFLARE IG Toolkit', now=datetime.now()) @app.route('/import-ig', methods=['GET', 'POST']) def import_ig(): @@ -101,47 +82,7 @@ def import_ig(): return redirect(url_for('view_igs')) except Exception as e: flash(f"Error downloading IG: {str(e)}", "error") - return render_template_string(''' - - - - - Import FHIR IG - - - - -
-

Import FHIR IG

-
- {{ form.hidden_tag() }} -
- {{ form.package_name.label(class="form-label") }} - {{ form.package_name(class="form-control") }} - {% for error in form.package_name.errors %}

{{ error }}

{% endfor %} -
-
- {{ form.package_version.label(class="form-label") }} - {{ form.package_version(class="form-control") }} - {% for error in form.package_version.errors %}

{{ error }}

{% endfor %} -
- {{ form.submit(class="btn btn-primary") }} - Back -
- {% with messages = get_flashed_messages(with_categories=True) %} - {% if messages %} - {% for category, message in messages %} -

{{ message }}

- {% endfor %} - {% endif %} - {% endwith %} -
- - - ''', form=form) + return render_template('import_ig.html', form=form, site_name='FLARE FHIR IG Toolkit', now=datetime.now()) @app.route('/view-igs') def view_igs(): @@ -194,7 +135,8 @@ def view_igs(): return render_template('cp_downloaded_igs.html', packages=packages, processed_list=igs, processed_ids=processed_ids, duplicate_names=duplicate_names, - duplicate_groups=duplicate_groups, group_colors=group_colors) + duplicate_groups=duplicate_groups, group_colors=group_colors, + site_name='FLARE FHIR IG Toolkit', now=datetime.now()) @app.route('/process-igs', methods=['POST']) def process_ig(): @@ -283,7 +225,8 @@ def view_ig(processed_ig_id): base_list = [t for t in processed_ig.resource_types_info if not t.get('is_profile')] examples_by_type = processed_ig.examples or {} return render_template('cp_view_processed_ig.html', title=f"View {processed_ig.package_name}#{processed_ig.version}", - processed_ig=processed_ig, profile_list=profile_list, base_list=base_list, examples_by_type=examples_by_type) + processed_ig=processed_ig, profile_list=profile_list, base_list=base_list, + examples_by_type=examples_by_type, site_name='FLARE FHIR IG Toolkit', now=datetime.now()) @app.route('/get-structure') def get_structure_definition(): @@ -332,5 +275,10 @@ with app.app_context(): db.create_all() logger.debug("Database initialization complete") +# Add route to serve favicon +@app.route('/favicon.ico') +def favicon(): + return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico', mimetype='image/vnd.microsoft.icon') + if __name__ == '__main__': app.run(debug=True) \ No newline at end of file diff --git a/instance/fhir_ig.db b/instance/fhir_ig.db index 57778d3..0d4bd90 100644 Binary files a/instance/fhir_ig.db and b/instance/fhir_ig.db differ diff --git a/static/FHIRFLARE.png b/static/FHIRFLARE.png new file mode 100644 index 0000000..66f8452 Binary files /dev/null and b/static/FHIRFLARE.png differ diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..fa12c15 Binary files /dev/null and b/static/favicon.ico differ diff --git a/templates/_form_helpers.html b/templates/_form_helpers.html new file mode 100644 index 0000000..c5ba59d --- /dev/null +++ b/templates/_form_helpers.html @@ -0,0 +1,26 @@ +{# app/templates/_form_helpers.html #} +{% macro render_field(field, label_visible=true) %} +
{# Add margin bottom for spacing #} + {% if label_visible and field.label %} + {{ field.label(class="form-label") }} {# Render label with Bootstrap class #} + {% endif %} + + {# Add is-invalid class if errors exist #} + {% set css_class = 'form-control ' + kwargs.pop('class', '') %} + {% if field.errors %} + {% set css_class = css_class + ' is-invalid' %} + {% endif %} + + {# Render the field itself, passing any extra attributes #} + {{ field(class=css_class, **kwargs) }} + + {# Display validation errors #} + {% if field.errors %} +
+ {% for error in field.errors %} + {{ error }}
+ {% endfor %} +
+ {% endif %} +
+{% endmacro %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..2624eed --- /dev/null +++ b/templates/base.html @@ -0,0 +1,66 @@ + + + + + + + + + {% if title %}{{ title }} - {% endif %}{{ site_name }} + + + + +
+ {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} + + {% endfor %} + {% endif %} + {% endwith %} + {% block content %}{% endblock %} +
+ + + + + + {% block scripts %} + + {% endblock %} + + \ No newline at end of file diff --git a/templates/base.html.txt b/templates/base.html.txt new file mode 100644 index 0000000..16098b9 --- /dev/null +++ b/templates/base.html.txt @@ -0,0 +1,65 @@ + + + + + + + + {% if title %}{{ title }} - {% endif %}{{ site_name }} + + + + +
+ {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} + + {% endfor %} + {% endif %} + {% endwith %} + {% block content %}{% endblock %} +
+ + + + + + {% block scripts %} + + {% endblock %} + + \ No newline at end of file diff --git a/templates/cp_downloaded_igs.html b/templates/cp_downloaded_igs.html index 31e3e5d..7a99aeb 100644 --- a/templates/cp_downloaded_igs.html +++ b/templates/cp_downloaded_igs.html @@ -1,32 +1,28 @@ - - - - - Manage FHIR Packages - - - - +{% extends "base.html" %} + +{% block content %} +
+ FHIRFLARE Ig Toolkit +

Welcome to {{ site_name }}

+
+

+ This is the starting Point for your Journey through the IG's +

+ +
+
+

Manage FHIR Packages

- Import More IGs - Back to Home + Import More IGs
- {% with messages = get_flashed_messages(with_categories=True) %} - {% if messages %} - {% for category, message in messages %} - - {% endfor %} - {% endif %} - {% endwith %} -
@@ -34,6 +30,7 @@
{% if packages %}
+

Risk: Duplicate Dependency with Different Versions

@@ -42,12 +39,12 @@ {% for pkg in packages %} {% set is_processed = (pkg.name, pkg.version) in processed_ids %} {% set is_duplicate = pkg.name in duplicate_names and duplicate_names[pkg.name]|length > 1 %} - {% set group_color = group_colors[pkg.name] if is_duplicate else 'bg-warning' %} - + {% set group_color = group_colors[pkg.name] if is_duplicate else 'bg-light' %} + @@ -58,12 +55,12 @@ {% else %} - + {% endif %} - + @@ -76,10 +73,13 @@

Duplicates detected: {% for name, versions in duplicate_groups.items() %} {% if versions|length > 1 %} - {{ name }} ({{ versions|join(', ') }}) + {% set group_color = group_colors[name] if name in group_colors else 'bg-warning' %} + {{ name }} ({{ versions|join(', ') }}) {% endif %} {% endfor %}

+ {% else %} +

No duplicates detected.

{% endif %} {% else %}

No downloaded FHIR packages found.

@@ -89,7 +89,7 @@
-
+
Processed Packages ({{ processed_list|length }})
{% if processed_list %} @@ -102,7 +102,9 @@
{% for processed_ig in processed_list %} - + @@ -134,10 +136,12 @@

No packages recorded as processed yet.

{% endif %} - + - - - \ No newline at end of file +{% endblock %} + +{% block scripts %} +{{ super() }} +{% endblock %} \ No newline at end of file diff --git a/templates/cp_downloaded_igs.html.txt b/templates/cp_downloaded_igs.html.txt new file mode 100644 index 0000000..24fd0cc --- /dev/null +++ b/templates/cp_downloaded_igs.html.txt @@ -0,0 +1,145 @@ +{% extends "base.html" %} + +{% block content %} +
+ PAS Logo Placeholder +

Welcome to {{ site_name }}

+
+

+ This is the starting point for our modular Patient Administration System. + We will build upon this core framework by adding modules through the control panel. +

+
+
+ +
+
+

Manage FHIR Packages

+ +
+ +
+
+
+
Downloaded Packages ({{ packages|length }})
+
+ {% if packages %} +
+

Risk: Duplicate Dependency with Different Versions

+
Package NameVersionActions
{{ pkg.name }} {% if is_duplicate %} - Duplicate + Duplicate {% endif %} {{ pkg.version }}
{{ processed_ig.package_name }} + {{ processed_ig.package_name }} + {{ processed_ig.version }} {% set types_info = processed_ig.resource_types_info %} @@ -121,7 +123,7 @@ View
- +
+ + + + + {% for pkg in packages %} + {% set is_processed = (pkg.name, pkg.version) in processed_ids %} + {% set is_duplicate = pkg.name in duplicate_names and duplicate_names[pkg.name]|length > 1 %} + {% set group_color = group_colors[pkg.name] if is_duplicate else 'bg-light' %} + + + + + + {% endfor %} + +
Package NameVersionActions
+ {{ pkg.name }} + {% if is_duplicate %} + Duplicate + {% endif %} + {{ pkg.version }} +
+ {% if is_processed %} + Processed + {% else %} +
+ + +
+ {% endif %} +
+ + +
+
+
+
+ {% if duplicate_groups %} +

Duplicates detected: + {% for name, versions in duplicate_groups.items() %} + {% if versions|length > 1 %} + {% set group_color = group_colors[name] if name in group_colors else 'bg-warning' %} + {{ name }} ({{ versions|join(', ') }}) + {% endif %} + {% endfor %} +

+ {% else %} +

No duplicates detected.

+ {% endif %} + {% else %} +

No downloaded FHIR packages found.

+ {% endif %} +
+
+
+ +
+
+
Processed Packages ({{ processed_list|length }})
+
+ {% if processed_list %} +

MS = Contains Must Support Elements

+
+ + + + + + {% for processed_ig in processed_list %} + + + + + + + {% endfor %} + +
Package NameVersionResource TypesActions
+ {{ processed_ig.package_name }} + {{ processed_ig.version }} + {% set types_info = processed_ig.resource_types_info %} + {% if types_info %}
+ {% for type_info in types_info %} + {% if type_info.must_support %} + {{ type_info.name }} + {% else %} + {{ type_info.name }} + {% endif %} + {% endfor %} +
{% else %}N/A{% endif %} +
+
+ View +
+ + +
+
+
+
+ {% else %} +

No packages recorded as processed yet.

+ {% endif %} +
+
+
+
+
+{% endblock %} + +{% block scripts %} +{{ super() }} +{% endblock %} \ No newline at end of file diff --git a/templates/cp_view_processed_ig.html b/templates/cp_view_processed_ig.html index 910e362..da0dd31 100644 --- a/templates/cp_view_processed_ig.html +++ b/templates/cp_view_processed_ig.html @@ -1,12 +1,22 @@ - - - - - {{ title }} - - - - +{% extends "base.html" %} + +{% block content %} +
+ FHIRFLARE Ig Toolkit +

{{ title }}

+
+

+ View details of the processed FHIR Implementation Guide. +

+ +
+
+

{{ title }}

@@ -50,6 +60,8 @@ {% endfor %}
+ {% else %} +

No profiles defined.

{% endif %} {% if base_list %}
Base Resource Types Referenced ({{ base_list|length }}):
@@ -68,6 +80,8 @@ {% endfor %}
+ {% else %} +

No base resource types referenced.

{% endif %} {% else %}

No resource type information extracted or stored.

@@ -132,255 +146,293 @@ {% else %} {% endif %} + + +
+
+ Debug: Raw Data (Click to Expand) +
Resource Types Info: {{ processed_ig.resource_types_info | tojson | safe }}
+
Examples: {{ processed_ig.examples | tojson | safe }}
+
+
- - \ No newline at end of file +{% endblock %} \ No newline at end of file diff --git a/templates/cp_view_processed_ig.html.txt b/templates/cp_view_processed_ig.html.txt new file mode 100644 index 0000000..261be12 --- /dev/null +++ b/templates/cp_view_processed_ig.html.txt @@ -0,0 +1,385 @@ +{% extends "base.html" %} + +{% from "_form_helpers.html" import render_field %} + +{% block content %} + +
+
+

{{ title }}

+ Back to Package List + + +
+ + {% if processed_ig %} +
+
Package Details
+
+
+
Package Name
+
{{ processed_ig.package_name }}
+
Package Version
+
{{ processed_ig.version }}
+
Processed At
+
{{ processed_ig.processed_date.strftime('%Y-%m-%d %H:%M:%S UTC') }}
+
+
+
+ +
+
Resource Types Found / Defined
+
+ {% if profile_list or base_list %} +

MS = Contains Must Support Elements

+ {% if profile_list %} +
Profiles Defined ({{ profile_list|length }}):
+ + {% endif %} + {% if base_list %} +
Base Resource Types Referenced ({{ base_list|length }}):
+ + {% endif %} + {% else %} +

No resource type information extracted or stored.

+ {% endif %} +
+
+ + + + + + + {% else %} + + {% endif %} +
+ + + + + +{% endblock content %} {# Main content block END #} \ No newline at end of file diff --git a/templates/import_ig.html b/templates/import_ig.html new file mode 100644 index 0000000..804d0ce --- /dev/null +++ b/templates/import_ig.html @@ -0,0 +1,40 @@ +{% extends "base.html" %} + +{% from "_form_helpers.html" import render_field %} + +{% block content %} +
+ FHIRFLARE Ig Toolkit +

Import FHIR Implementation Guides

+
+

+ Import new FHIR Implementation Guides to the system for viewing. +

+ +
+
+ +
+

Import a New IG

+
+
+
+
+
+ {{ form.hidden_tag() }} + {{ render_field(form.package_name) }} + {{ render_field(form.package_version) }} +
+ {{ form.submit(class="btn btn-success") }} + Back +
+
+
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..8433a80 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% block content %} +
+ FHIRFLARE Ig Toolkit +

Welcome to {{ site_name }}

+
+

+ Simple tool for importing and viewing FHIR Implementation Guides. +

+ +
+
+{% endblock %} \ No newline at end of file