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

new import tool #3182

Merged
merged 9 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion Microsoft.Health.Fhir.sln
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.TaskManage
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Fhir.Store.Utils", "src\Microsoft.Health.Fhir.Store.Utils\Microsoft.Health.Fhir.Store.Utils.csproj", "{7A736E5F-DA6E-483F-AD5B-EE8F66828E36}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImporterV2", "tools\ImporterV2\ImporterV2.csproj", "{E85BCB9A-5D6E-45AD-BE67-AEFA060FEBF1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Importer", "tools\Importer\Importer.csproj", "{F6B94905-B496-46AD-B2A7-2ABCB0B2A6B4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exporter", "tools\Exporter\Exporter.csproj", "{E468B6C6-9098-4293-AFD6-3B1675D67063}"
Expand Down Expand Up @@ -408,6 +410,10 @@ Global
{F4DE2945-80C5-48FE-B58A-4AD1264C9FEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4DE2945-80C5-48FE-B58A-4AD1264C9FEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4DE2945-80C5-48FE-B58A-4AD1264C9FEA}.Release|Any CPU.Build.0 = Release|Any CPU
{E85BCB9A-5D6E-45AD-BE67-AEFA060FEBF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E85BCB9A-5D6E-45AD-BE67-AEFA060FEBF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E85BCB9A-5D6E-45AD-BE67-AEFA060FEBF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E85BCB9A-5D6E-45AD-BE67-AEFA060FEBF1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -489,10 +495,11 @@ Global
{5E456FD7-E5A5-41F4-A0D3-7215585AEB7A} = {FCD51BAF-BFE5-476F-B562-C9AB36AA9839}
{A5DED132-32B1-4804-95F5-EBC6092EC8AE} = {85F39C13-BC62-49A0-9C06-3BBA724D35ED}
{D6C90E8C-50AF-45D8-B2D3-1B9B07E65F3E} = {1295CCC3-73FB-4376-AE95-F6F31A37B152}
{E85BCB9A-5D6E-45AD-BE67-AEFA060FEBF1} = {B70945F4-01A6-4351-955B-C4A2943B5E3B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E370FB31-CF95-47D1-B1E1-863A77973FF8}
RESX_SortFileContentOnSave = True
SolutionGuid = {E370FB31-CF95-47D1-B1E1-863A77973FF8}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
test\Microsoft.Health.Fhir.Shared.Tests.E2E.Common\Microsoft.Health.Fhir.Shared.Tests.E2E.Common.projitems*{0478b687-7105-40f6-a2dc-81057890e944}*SharedItemsImports = 13
Expand Down
30 changes: 30 additions & 0 deletions tools/ImporterV2/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!--
This code allows to import resources from a storage container to a FHIR service.
Input data must be provided in ndjson format in one container in Azure blobs storage.
-->
<appSettings>
<!-- Azure blob storage parameters -->
<add key="ConnectionString" value="{Add your BlobServiceClient connection string here}" />
<add key="ContainerName" value="{Add your container}" />
<!--
the type of files it'll search for in the container
do not add a file extension as ndjson is assumed and added to the ResourceType automatically
-->
<add key="ResourceType" value="Observation" />
<!--
the number we want to import at a time
of course this can be a much larger value than 20 so adjust as needed
-->
<add key="NumberOfBlobsForImport" value="20" />
<add key="FhirEndpoint" value="{add your FHIR endpoint}" />

<!-- the following are for getting a token -->
<add key="TokenEndpoint" value="{add login url to your oauth2/token endpoint}" />
<add key="grant_type" value="Client_Credentials" />
<add key="client_id" value="{add your client id}" />
<add key="client_secret" value="{add your client secret}" />
<add key="resource" value="{add your FHIR endpoint}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is not jus a connection string?

Copy link
Contributor Author

@v-mserdar v-mserdar Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses the connection string for getting the blob container and lines 25-28 in the app.config for getting the auth token needed for $import status. Please let me know if I'm misunderstanding your question.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it work the same way for OSS FHIR?

</appSettings>
</configuration>
33 changes: 33 additions & 0 deletions tools/ImporterV2/ImportResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Microsoft.Health.Fhir.ImporterV2
{
#pragma warning disable CA1812 // Avoid uninstantiated internal classes
internal sealed class ImportResponse
{
[JsonPropertyName("error")]
public List<Json> Error { get; set; } = new();

[JsonPropertyName("output")]
public List<Json> Output { get; set; } = new();

public sealed class Json
{
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;

[JsonPropertyName("count")]
public int Count { get; set; }

[JsonPropertyName("inputUrl")]
public string InputUrl { get; set; } = string.Empty;
}
}
#pragma warning disable CA1812 // Avoid uninstantiated internal classes
}
Loading