Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding fhir indexer project to communities #8467

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Changes from 2 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
93 changes: 93 additions & 0 deletions docs/ecosystem/community/fhir-indexer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
id: fhir-indexer
title: "Fhir-indexer"
---

[Fhir-indexer](https://github.com/royashcenazi/fhir-indexer) is a ZIO based library for fetchine FHIR resources fast and easy.
royashcenazi marked this conversation as resolved.
Show resolved Hide resolved
## Introduction

Welcome to the FHIR Indexing with ZIO and HAPI FHIR repository! This open-source project aims to provide a robust and efficient solution for indexing FHIR (Fast Healthcare Interoperability Resources) based APIs. The project leverages the power of the ZIO framework to handle concurrency and asynchronicity, while wrapping around the widely-used HAPI FHIR library for working with FHIR resources.

## Features

- **Asynchronous and Concurrent Indexing**: The project takes advantage of ZIO's powerful concurrency model to efficiently index FHIR resources from multiple APIs simultaneously.

- **Modular and Extensible Design**: The codebase is structured in a modular way, allowing easy extension and customization to fit different FHIR-based API implementations.

- **Authentication Support**: The library supports various authentication mechanisms for accessing secure FHIR endpoints, ensuring data privacy and security.

- **Resource Filtering and Transformation**: Users can define custom filters and transformations to tailor the indexing process according to their specific requirements.

## Installation

### SBT

`libraryDependencies += "io.github.royashcenazi" % "fhir-indexer" % "v0.0.2"`

### Maven
```
<dependency>
<groupId>io.github.royashcenazi</groupId>
<artifactId>fhir-indexer</artifactId>
<version>v0.0.2</version>
</dependency>
```

## Example

```scala
object ZioApp extends ZIOAppDefault {

class ConditionIndexer(override val hapiFhirClient: FHIRHapiClient) extends ApiIndexer {
override type ProcessResult = Unit

override def indexApi[T <: IParam](searchMetadata: RequestMetadata[T]): ZIO[Any, Throwable, Unit] = {
for {
data <- createPagedApiIndexingFlow[Encounter, T](searchMetadata)
_ <- ZIO.log(s"Processed api: ${getClass.getSimpleName} with ${data.size} entries")
} yield ()
}
}

object ConditionIndexer {
val layer: ZLayer[FHIRHapiClient, Nothing, ConditionIndexer] = ZLayer {
for {
hapiClient <- ZIO.service[FHIRHapiClient]
} yield new ConditionIndexer(hapiClient)
}
}

def myApp: ZIO[ConditionIndexer, Nothing, Exit[Throwable, Unit]] = {
val requestMetadata = RequestMetadata[TokenClientParam]("")
for {
conditionsService <- ZIO.service[ConditionIndexer]
zio = conditionsService.indexApi[TokenClientParam](requestMetadata)
} yield {
Unsafe.unsafe { implicit unsafe =>
Runtime.default.unsafe.run(zio)
}
}
}

object FhirConfigTest {
val layer: zio.ZLayer[Any, Nothing, FhirIndexingConfig] =
zio.ZLayer.succeed(FhirIndexingConfig(url = "",
authUrl ="/oauth2/token",
clientId = "",
secret = ""))
}


override def run: ZIO[Any, Throwable, Exit[Throwable, Unit]] = {
myApp.debug("example")
.provide(
Client.default,
FhirConfigTest.layer,
FhirAuthClientImpl.layer(),
FHIRHapiClientImpl.layer(),
ConditionIndexer.layer
)
}
}
```
Happy indexing!
Loading