Skip to content

Instantly share code, notes, and snippets.

View cknaap's full-sized avatar

Christiaan Knaap cknaap

View GitHub Profile
@cknaap
cknaap / VonSessionsAMS2019.md
Last active November 20, 2019 14:26
Links for Vonk sessions FHIR DevDays 2019 Amsterdam

Links

These are the links accompanying the session "Let's Build - Vonk Plugins" and "Let's Build - Vonk FHIR Facade" at FHIR DevDays 2019 Amsterdam.

@cknaap
cknaap / DD_Vonk_Plugins.md
Last active June 10, 2019 20:26
Links for the presentation on Extending Vonk FHIR Server at DevDays

Links

These are the links accompanying the session "Let's Build - Extending Vonk FHIR Server" at DevDays.

More background on Vonk

@cknaap
cknaap / VonkAuthorizationMiddleware.cs
Last active August 22, 2022 19:01
Middleware for custom authorization in Vonk FHIR Server
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Vonk.Core.Context;
using Vonk.Core.Context.VonkContext;
using Vonk.Core.Support;
@cknaap
cknaap / FhirPatchComments.md
Last active October 30, 2018 06:32
Remarks on FhirPatch found while implementing it

I have implemented FHIRPath Patch on top of the .NET FHIR API. I have used the tests provided as download in the specification as unittests. The "Quoted Names" refer to the names of those tests.

  1. "Full Resource": would have expected valueXhtml for the new div instead of valueString. Now with valueString the actual types of the input div and the replacement div are different (xhtml vs string). But valueXhtml is not accepted, at least not by the .NET API.

  2. "Add Anonymous type": structure with nested parts feels clumsy and was very hard to get parsed correctly. No other way?

  3. What happens if sequential patches interact?

    1. For Delete:
      • array [0,1,2,3,4]
  • delete array[0]
@cknaap
cknaap / ElementDefaultMissing.md
Last active January 31, 2018 16:29
Evaluation of :missing modifier and default values in FHIR Elements

Trying to answer FHIR-I tracker items 13224, 13339 and 13348 the working group suggested to outline all possible combinations and work out their meaning.

The general rules we came to during the Mon Q2 session at WGM Jan 2018 were:

  1. An element with a default value is considered to have that value if element is not present
  2. An element without an element.value but with element.extension.count > 0 is NOT missing
  3. An element with a default value is never a match for a search with modifier :missing=true, and IS a match for :missing=false
  4. SUBSETTED and REDACTED tags:
  • SUBSETTED meaning: Elements have been withheld from the response in accordance with the clients request.
@cknaap
cknaap / Vonk.Facade.Starter.MapPatient.cs
Created December 7, 2017 10:24
Map data in Vonk FHIR Facade
public IResource MapPatient(ViSiPatient source)
{
var patient = new Patient();
patient.Id = source.Id.ToString();
patient.Identifier.Add(new Identifier("http://mycompany.org/patientnumber", source.PatientNumber));
patient.Name.Add(new HumanName().WithGiven(source.FirstName).AndFamily(source.FamilyName));
patient.BirthDate = new FhirDateTime(source.DateOfBirth).ToString();
patient.Telecom.Add(new ContactPoint(ContactPoint.ContactPointSystem.Email, ContactPoint.ContactPointUse.Home, source.EmailAddress));
return patient.AsIResource();
}
@cknaap
cknaap / ExpectedCallFromMemberData.cs
Created December 13, 2016 13:13
How to express an expected call on a Moq mock in the memberdata for an XUnit Theory.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Moq;
using Xunit;
namespace DynamicVerify
{
public class ExpectedCallFromMemberData
{
@cknaap
cknaap / SimpleLogCheck.cs
Last active December 17, 2021 22:11
Easily check ILogger<T> interactions with ASP.NET Core Logging and Moq
using Microsoft.Extensions.Logging;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Knaap.Utilties
{