Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
da0ea8b
Moving message-related helper methods to a MessageUtils class
astride Aug 11, 2025
6d027d9
Customizing MessageUtils to allow for the BatchMessageUtils class to …
astride Aug 11, 2025
106c699
Generating an XML document prior to saving the file to disk, to allow…
astride Aug 13, 2025
b45d5ee
Changing the order of events in KppService.Run() and introducing a he…
astride Aug 14, 2025
e236964
Introducing config values in the GUI project to allow for enabling/di…
astride Aug 14, 2025
1050929
Implementing logic to create batch messages when necessary and possible
astride Aug 14, 2025
c40e837
Removing unnecessary XML helper method
astride Aug 14, 2025
43a2034
Creating helper method for building test input file path
astride Aug 14, 2025
20233fc
Renaming episode.csv to episode_institusjoner.csv and adding an episo…
astride Aug 14, 2025
adb7881
Adding batch file tests
astride Aug 14, 2025
48e1783
Creating a TestBase class
astride Aug 15, 2025
e1cb03f
Moving the batch file tests to a separate class
astride Aug 15, 2025
973b4d9
Using a file-scoped namespace for the test classes
astride Aug 15, 2025
725af44
Moving the 'recommended batch file count' calculation to BatchMessage…
astride Aug 15, 2025
483ff1a
Using more appropriate (i.e. larger) test files
astride Aug 18, 2025
92689dc
Leaving lopenr out of the batch file name
astride Aug 27, 2025
d8f3a12
Setting gigabytes rather than bytes in the config file, and mocking t…
astride Sep 1, 2025
3d57f78
Moving the batch file configuration from settings to the GUI form
astride Sep 1, 2025
5777032
Implementing the possibility of creating batch files in the console app
astride Sep 1, 2025
be8cf03
Updating docs and readme files
astride Sep 1, 2025
2c8f1f0
Making small fixes and removing TODOS
astride Sep 1, 2025
28d36e2
Updating the assembly version / EPJ version to 1.9.0
astride Sep 1, 2025
1aec8a3
Moving the BaseFileSizeInBytes constant from BatchMessageUtils to con…
astride Sep 2, 2025
e00102e
Reverting the 'serialize content to an XML document before saving to …
astride Sep 2, 2025
98f54ad
Deleting the single KPP file if batch files should be created
astride Sep 2, 2025
5f7853f
Bugfixes
astride Sep 2, 2025
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
8 changes: 7 additions & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ Pakk ut `zip`-filen:
- Angi navn og HER-ID på avsender (nivå 1)
- Angi navn og HER-ID på avsender (nivå 2)
- Velg om sendingen er en ordentlig innsending eller en prøvesending
- Velg om programmet skal kunne lage delmeldinger dersom KPP-meldingen blir for stor
- Angi maksstørrelse på KPP-meldingen
4. Generér melding (`xml`-fil):
- Trykk `Lagre...`
- Velg hvilken mappe du ønsker at den genererte meldingen (`xml`-fil) skal lagres i, samt ønsket navn på filen
- Etter at du har trykket `Lagre` vil fremdriften vises i et lite vindu. Når vinduet viser `Ferdig` er filen ferdig generert.
- Etter at du har trykket `Lagre` vil fremdriften vises i et lite vindu
- Dersom generering av delmeldinger er aktivert og KPP-meldingen er over maksstørrelsen, informeres det om at det genereres delmeldinger
- Når vinduet viser `Ferdig` er filen(e) ferdig generert

Dersom `episode`-filen inneholder episoder knyttet til mer enn én institusjon-ID vil programmet informere brukeren om dette i en meldingsboks.

<small><i>NB: Delmeldinger kan ikke genereres når `episode`-filen inneholder episoder knyttet til mer enn én institusjon-ID.</i></small>

Programmet/Applikasjonen ser slik ut:

![...](./illustrations/GuiApplication.png)
Expand Down
Binary file modified docs/illustrations/GuiApplication.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Program for konvertering av KPP-filer
Programmet konverterer én csv-fil om episoder og én csv-fil om tjeneste til én xml-melding som skal sendes til Folkehelseinstituttet
Programmet konverterer én csv-fil om episoder og én csv-fil om tjeneste til én KPP-melding (xml-fil) som skal sendes til Folkehelseinstituttet. Programmet kan generere delmeldinger (flere xml-filer) dersom KPP-meldingen blir for stor.

Det er to måter å kjøre programmet:
- Bruke det grafiske grensesnittet (Gui)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<AssemblyVersion>1.8.0.*</AssemblyVersion>
<AssemblyVersion>1.9.0.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.8" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dhhr.KppParser.Service\Dhhr.KppParser.Service.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="app.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None>
<None Update="lesmeg.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
Expand Down
15 changes: 15 additions & 0 deletions src/Dhhr.KppParser.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using Dhhr.KppParser.Service;
using Mono.Options;
using ConfigurationManager = System.Configuration.ConfigurationManager;

namespace Dhhr.KppParser.ConsoleApp
{
Expand All @@ -23,6 +24,8 @@ private static int Main(string[] args)
ProgramVersion = Version()
};

kppArgs.BatchFiles.BaseFileSizeInBytes = ParseInt(ConfigurationManager.AppSettings["BaseFileSizeInBytes"]);

var p = new OptionSet
{
{"Program-argumenter"},
Expand All @@ -43,6 +46,8 @@ private static int Main(string[] args)
{"epj-navn=", "Navn på EPJ", x => kppArgs.NavnEpj = x },
{"epj-versjon=", "Versjon av EPJ", x => kppArgs.VersjonEpj = x },
{"fhi-herid=", "FHIs HerId.", x => kppArgs.FhiHerId = x },
{"batchfiles-enable=", "'true' dersom det er ønskelig å opprette delmeldinger om KPP-meldingen blir for stor", x => kppArgs.BatchFiles.EnableCreation = ParseBool(x) },
{"batchfiles-maxfilesize=", "Maks. filstørrelse for KPP-meldingen i gigabyte (GB)", x => kppArgs.BatchFiles.MaxFileSizeInGigabytes = ParseInt(x) },
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

De to batchfiles-*-input-argumentene er bredere enn de eksisterende argumentene. Når man kjører

.\Dhhr.KppParser.ConsoleApp.exe -h

for å vise veiledning for konsollapplikasjonen, ser det ikke så pent ut:

bilde

Har forsøkt å se på om det går an å konfigurere Mono.Options.OptionSet eller Mono.Options.OptionSet.WriteOptionDescriptions() for å øke avstanden mellom første og andre kolonne, men har ikke blitt klok på om det er mulig.

{"Output" },
{"o|output=", "Filsti hvor resultatet lagres", x => kppArgs.OutputPath = x}
};
Expand Down Expand Up @@ -102,13 +107,23 @@ private static int Main(string[] args)
return 0;
}

private static bool ParseBool(string x)
{
return bool.TryParse(x, out var boolValue) && boolValue;
}

private static DateTime ParseDate(string x)
{
return DateTime.TryParseExact(x, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var tmp)
? tmp
: DateTime.MinValue;
}

private static int ParseInt(string x)
{
return int.TryParse(x, out var intValue) ? intValue : 0;
}

private static string Version()
{
var version = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
Expand Down
7 changes: 7 additions & 0 deletions src/Dhhr.KppParser.ConsoleApp/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="BaseFileSizeInBytes" value="3000" />
<add key="BaseFileSizeInBytes_Info" value="The base file size is slightly larger than the base size of the generated XML file (before the file is populated with episode content)" />
</appSettings>
</configuration>
4 changes: 3 additions & 1 deletion src/Dhhr.KppParser.ConsoleApp/lesmeg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
.\Dhhr.KppParser.ConsoleApp.exe -h

# Merknad
Merk at alle Input og Output er påkrevd
Det er valgfritt å angi --batchfiles-*. Dersom --batchfiles-enable er true må --batchfiles-maxfilesize være større enn 0.

Utover dette er alle Input og Output påkrevd.

# FHIs HerId
I skrivende stund er FHIs HerId-er følgende:
Expand Down
2 changes: 1 addition & 1 deletion src/Dhhr.KppParser.Gui/Dhhr.KppParser.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<AssemblyVersion>1.8.0.*</AssemblyVersion>
<AssemblyVersion>1.9.0.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<UseWindowsForms>true</UseWindowsForms>
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>
Expand Down
Loading