# Architecture Diagram

The SPICE platform supports the [HL7 FHIR](https://www.hl7.org/fhir/overview.html) standard.

<div data-full-width="false"><figure><img src="https://1478837505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc8r5CWDYQD5YGrlFur8R%2Fuploads%2FZYUMVmcKY1FcCGrUupe5%2FMDTLabs_SPICE_Architecture_drawio-SPICE%202.1%20AF%20OpenSource%20(1).jpg?alt=media&#x26;token=725fd8a7-00d8-4d43-93f1-0cb4d7293d38" alt=""><figcaption></figcaption></figure></div>

#### **1. External EHR/EMR**

Represents external **Electronic Health Record (EHR)** or **Electronic Medical Record (EMR)** systems. These are external healthcare data systems that provide or consume patient-related information, enabling data interoperability with the SPICE platform.

***

#### **2. SPICE Mobile App**

A mobile application used by healthcare professionals or field workers for managing patient records, accessing clinical workflows, and syncing data with the SPICE platform.

***

#### **3. Admin + CFR Portal Web App**

A web-based application for administrators and healthcare managers to manage system configurations, users, and Client Facing Reports (CFR). It serves as a central portal for administration and data visualization.

***

#### **4. SPICE Platform**

The core system enables healthcare data management and interoperability. It integrates multiple components to ensure seamless data flow between external systems and the FHIR server.

**Subcomponents of SPICE Platform:**

* **FHIR Converter:** Transforms non-FHIR data from external systems or the SPICE Mobile App into FHIR-compliant resources to be stored in the FHIR server.
* **SPICE Core:** The central processing engine handling data synchronization, queue management, and core business logic.
* **Queue:** A mechanism to handle offline data sync from the mobile app, ensuring data integrity even in low-connectivity scenarios.
* **User Management:** Manages authentication, authorization, and user roles within the SPICE platform.
* **Notification:** Sends alerts, updates, or confirmations to users via email, SMS, or push notifications.

***

#### **5. WHO SMART Guidelines**

A reference to the World Health Organization’s **SMART (Standards-Based, Machine-Readable, Adaptive, Requirements-Based, and Testable)** guidelines that define healthcare data workflows and best practices. The SPICE platform aligns with these guidelines for standardization.

***

#### **6. FHIR Server (HAPI JPA Server)**

A server implementing the HL7 FHIR standard using the **HAPI FHIR JPA Server**. It stores and retrieves FHIR-compliant healthcare data.

***

#### **7. Postgres FHIR DB**

A PostgreSQL database serves as the backend storage for the FHIR server. It securely stores all FHIR resources (e.g., Patient, Observation, etc.).

***

#### **8. Postgres Admin DB**

A separate PostgreSQL database for storing administrative and metadata information required by the SPICE platform, such as user roles, configurations, and system logs.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://spice.docs.medtroniclabs.org/engineering/architecture/fhir-and-standards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
