Skip to content

DeletionService - IFhirDataStore scoped handling #5363

Merged
fhibf merged 12 commits intomainfrom
user/fernfe/deletionServiceScopedDataStore
Feb 3, 2026
Merged

DeletionService - IFhirDataStore scoped handling #5363
fhibf merged 12 commits intomainfrom
user/fernfe/deletionServiceScopedDataStore

Conversation

@fhibf
Copy link
Contributor

@fhibf fhibf commented Jan 30, 2026

Description

In this PR we're creating a new component to handle the creation of IFhirDataStore instances for the Deletion Service.
Cosmos DB requires new instances of the FHIR Data Store to ensure that long running operations (+1 hours) will always have fresh tokens.
While SQL Server operations always require only scoped instances of IFhirDataStore to handle transactions.

With the addition of IDeletionServiceDataStoreFactory, now both services can have different implementations without affecting one another.

  • SqlDeletionServiceDataStoreFactory implements IDeletionServiceDataStoreFactory, and creates instances of DeletionServiceScopedDataStore using scoped instances (.Scoped()) of IFhirDataStore.

  • CosmosDeletionServiceDataStoreFactory implements IDeletionServiceDataStoreFactory, and creates instances of DeletionServiceScopedDataStore using instances of IFhirDataStore using IScopeProvider.

image

Related issues

Addresses AB#182156.

Testing

Describe how this change was tested.

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • When changing or adding behavior, if your code modifies the system design or changes design assumptions, please create and include an ADR.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@fhibf fhibf added this to the FY26\Q3\2Wk\2Wk16 milestone Jan 30, 2026
@fhibf fhibf requested a review from a team as a code owner January 30, 2026 23:55
@fhibf fhibf added Bug Bug bug bug. Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs No-PaaS-breaking-change No-ADR ADR not needed labels Jan 30, 2026
@fhibf fhibf changed the title DeletionService - Fix recreation of IFhirDataStore DeletionService - IFhirDataStore scoped handling Feb 2, 2026
@fhibf
Copy link
Contributor Author

fhibf commented Feb 2, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@fhibf
Copy link
Contributor Author

fhibf commented Feb 2, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

LTA-Thinking
LTA-Thinking previously approved these changes Feb 2, 2026
@fhibf
Copy link
Contributor Author

fhibf commented Feb 3, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@fhibf
Copy link
Contributor Author

fhibf commented Feb 3, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@fhibf fhibf merged commit c58df68 into main Feb 3, 2026
61 checks passed
@fhibf fhibf deleted the user/fernfe/deletionServiceScopedDataStore branch February 3, 2026 16:24
fhibf added a commit that referenced this pull request Feb 5, 2026
* Changes to support FhirDataStore with different scopes in DeletionService.

* Adding comments.

* Revert changes in appsettings.

* Adding hew IDeletionServiceDataStoreFactory.

* Adding the concept of scopes to manage the deletion of already used instaces of IScope.

* Adding new class to handle scenarios where data store should be disposed or not.

* Adding new comment.

* Improving Dispose logic.

* New tests validation DeletionServiceScopedDataStore.

* Fixing tests.

* Fix PR suggestion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Bug Bug bug bug. No-ADR ADR not needed No-PaaS-breaking-change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants