chore: deploy initial code base
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using Strata.RxNorm.Biz.RxNorm;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Strata.RxNorm.Biz.Test.Unit.Extensions
|
||||
{
|
||||
[ExcludeFromCodeCoverage]
|
||||
public static class RxnRelationExtension
|
||||
{
|
||||
public static IEnumerable<RxnRelation> LoadRxnRelations(this string fileName)
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var lines = assembly.LoadRxnNorm(fileName);
|
||||
return lines.Select(l => l.RelationCtor()).Where(r => !string.IsNullOrEmpty(r.Rxcui1)).ToList();
|
||||
}
|
||||
|
||||
public static RxnRelation RelationCtor(this string line, string separator = "|")
|
||||
{
|
||||
var data = line.Split(separator).ToArray();
|
||||
var r = new RxnRelation();
|
||||
r.Rxcui1 = data[0];
|
||||
r.Rxaui1 = data[1];
|
||||
r.SType1 = data[2];
|
||||
r.Rel = data[3];
|
||||
r.Rxcui2 = data[4];
|
||||
r.Rxaui2 = data[5];
|
||||
r.SType2 = data[6];
|
||||
r.Rela = data[7];
|
||||
r.Rui = data[8];
|
||||
r.Srui = data[9];
|
||||
r.Sab = data[10];
|
||||
r.Sl = data[11];
|
||||
r.Rg = data[12];
|
||||
r.Dir = data[13];
|
||||
r.Suppress = data[14];
|
||||
r.Cvf = data[15];
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user