Browse Source

Starting with it

Piotr Czajkowski 2 years ago
commit
998a7c7b48

+ 215 - 0
.gitignore

@@ -0,0 +1,215 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+build/
+bld/
+[Bb]in/
+[Oo]bj/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+## TODO: Comment the next line if you want to checkin your
+## web deploy settings but do note that will include unencrypted
+## passwords
+#*.pubxml
+
+*.publishproj
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+
+# Windows Azure Build Output
+csx/
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# LightSwitch generated files
+GeneratedArtifacts/
+_Pvt_Extensions/
+ModelManifest.xml
+
+#Rider
+.idea

+ 22 - 0
AnalyzeJSON.cs

@@ -0,0 +1,22 @@
+using System;
+using System.IO;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace analyzeJSON
+{
+    public class AnalyzeJSON
+    {
+        private readonly JObject json;
+
+        public AnalyzeJSON(string path)
+        {
+            if (!File.Exists(path))
+                throw new ArgumentNullException("File doesn't exist!");
+
+            using StreamReader sr = new StreamReader(path);
+            var jsonString = sr.ReadToEnd();
+            json = JsonConvert.DeserializeObject<JObject>(jsonString);
+        }
+    }
+}

+ 15 - 0
analyzeJSON.csproj

@@ -0,0 +1,15 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net5.0</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="xunit" />
+    <None Remove="Newtonsoft.Json" />
+  </ItemGroup>
+  <ItemGroup>
+    <PackageReference Include="xunit" Version="2.4.1" />
+    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
+  </ItemGroup>
+</Project>

+ 31 - 0
analyzeJSON.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.810.16
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "analyzeJSON", "analyzeJSON.csproj", "{218074DD-F7C9-4B0C-9F84-B824298A9186}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "analyzeJSONTests", "analyzeJSONTests\analyzeJSONTests.csproj", "{8A325FAC-621D-4DD1-A9C6-15006C50052F}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{218074DD-F7C9-4B0C-9F84-B824298A9186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{218074DD-F7C9-4B0C-9F84-B824298A9186}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{218074DD-F7C9-4B0C-9F84-B824298A9186}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{218074DD-F7C9-4B0C-9F84-B824298A9186}.Release|Any CPU.Build.0 = Release|Any CPU
+		{8A325FAC-621D-4DD1-A9C6-15006C50052F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{8A325FAC-621D-4DD1-A9C6-15006C50052F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{8A325FAC-621D-4DD1-A9C6-15006C50052F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{8A325FAC-621D-4DD1-A9C6-15006C50052F}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {A92FB8DD-A7BC-4506-B638-238D4918B0B6}
+	EndGlobalSection
+EndGlobal

+ 16 - 0
analyzeJSONTests/AnalyzeJSONIntegrationTests.cs

@@ -0,0 +1,16 @@
+using analyzeJSON;
+using Xunit;
+
+namespace analyzeJSONTests
+{
+    public class AnalyzeJSONIntegrationTests
+    {
+        private static readonly string testFile = @"testFiles/complex.json";
+
+        [Fact]
+        public void AnalyzeJSON_AllGood()
+        {
+            var test = new AnalyzeJSON(testFile);
+        }
+    }
+}

+ 38 - 0
analyzeJSONTests/analyzeJSONTests.csproj

@@ -0,0 +1,38 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net5.0</TargetFramework>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
+    <PackageReference Include="xunit" Version="2.4.1" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
+    <PackageReference Include="coverlet.collector" Version="3.0.2">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
+    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Remove="testFiles\" />
+    <None Remove="Newtonsoft.Json" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="testFiles\" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Update="testFiles\complex.json">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\analyzeJSON.csproj" />
+  </ItemGroup>
+</Project>

+ 137 - 0
analyzeJSONTests/testFiles/complex.json

@@ -0,0 +1,137 @@
+{
+  "medications": {
+    "aceInhibitors": {
+      "name": "lisinopril",
+      "strength": "10 mg Tab",
+      "dose": "1 tab",
+      "route": "PO",
+      "sig": "daily",
+      "pillCount": "#90",
+      "refills": "Refill 3"
+    },
+    "antianginal": {
+      "name": "nitroglycerin",
+      "strength": "0.4 mg Sublingual Tab",
+      "dose": "1 tab",
+      "route": "SL",
+      "sig": "q15min PRN",
+      "pillCount": "#30",
+      "refills": "Refill 1"
+    },
+    "anticoagulants": {
+      "name": "warfarin sodium",
+      "strength": "3 mg Tab",
+      "dose": "1 tab",
+      "route": "PO",
+      "sig": "daily",
+      "pillCount": "#90",
+      "refills": "Refill 3"
+    },
+    "betaBlocker": {
+      "name": "metoprolol tartrate",
+      "strength": "25 mg Tab",
+      "dose": "1 tab",
+      "route": "PO",
+      "sig": "daily",
+      "pillCount": "#90",
+      "refills": "Refill 3"
+    },
+    "diuretic": {
+      "name": "furosemide",
+      "strength": "40 mg Tab",
+      "dose": "1 tab",
+      "route": "PO",
+      "sig": "daily",
+      "pillCount": "#90",
+      "refills": "Refill 3"
+    },
+    "mineral": {
+      "name": "potassium chloride ER",
+      "strength": "10 mEq Tab",
+      "dose": "1 tab",
+      "route": "PO",
+      "sig": "daily",
+      "pillCount": "#90",
+      "refills": "Refill 3"
+    }
+  },
+  "labs": [
+    {
+      "name": "Arterial Blood Gas",
+      "time": "Today",
+      "location": "Main Hospital Lab"
+    },
+    {
+      "name": "BMP",
+      "time": "Today",
+      "location": "Primary Care Clinic"
+    },
+    {
+      "name": "BNP",
+      "time": "3 Weeks",
+      "location": "Primary Care Clinic"
+    },
+    {
+      "name": "BUN",
+      "time": "1 Year",
+      "location": "Primary Care Clinic"
+    },
+    {
+      "name": "Cardiac Enzymes",
+      "time": "Today",
+      "location": "Primary Care Clinic"
+    },
+    {
+      "name": "CBC",
+      "time": "1 Year",
+      "location": "Primary Care Clinic"
+    },
+    {
+      "name": "Creatinine",
+      "time": "1 Year",
+      "location": "Main Hospital Lab"
+    },
+    {
+      "name": "Electrolyte Panel",
+      "time": "1 Year",
+      "location": "Primary Care Clinic"
+    },
+    {
+      "name": "Glucose",
+      "time": "1 Year",
+      "location": "Main Hospital Lab"
+    },
+    {
+      "name": "PT/INR",
+      "time": "3 Weeks",
+      "location": "Primary Care Clinic"
+    },
+    {
+      "name": "PTT",
+      "time": "3 Weeks",
+      "location": "Coumadin Clinic"
+    },
+    {
+      "name": "TSH",
+      "time": "1 Year",
+      "location": "Primary Care Clinic"
+    }
+  ],
+  "imaging": [
+    {
+      "name": "Chest X-Ray",
+      "time": "Today",
+      "location": "Main Hospital Radiology"
+    },
+    {
+      "name": "Chest X-Ray",
+      "time": "Today",
+      "location": "Main Hospital Radiology"
+    },
+    {
+      "name": "Chest X-Ray",
+      "time": "Today",
+      "location": "Main Hospital Radiology"
+    }
+  ]
+}