Skip to content

Commit 9f0b2ac

Browse files
Merge pull request #245 from costateixeira/master
Update CI Build + ensure package is loaded to GHCR...
2 parents 9b21858 + aee03c1 commit 9f0b2ac

8 files changed

Lines changed: 103 additions & 27 deletions

File tree

.github/workflows/linux-docker-build.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@ jobs:
1212
steps:
1313
# Step 1: Check out the repository code
1414
- name: Check out repository code
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
16+
17+
- name: Debug Repository Names
18+
run: |
19+
echo "ORG_NAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
20+
echo "REPO_NAME=$(basename "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
21+
1622
1723
# Step 2: Log in to GitHub Container Registry (GHCR)
1824
- name: Log in to GitHub Container Registry
19-
uses: docker/login-action@v2
25+
uses: docker/login-action@v3
2026
with:
2127
registry: ghcr.io
2228
username: ${{ github.actor }}
2329
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
2430

2531
# Step 3: Cache terminology files (optional, to avoid re-downloading terminology files)
2632
- name: Cache terminology files
27-
uses: actions/cache@v2
33+
uses: actions/cache@v4
2834
with:
2935
path: ~/terminology
3036
key: terminology-${{ github.sha }}
@@ -83,4 +89,10 @@ jobs:
8389
# Step 9: Push the Docker image to GitHub Container Registry (GHCR)
8490
- name: Push Docker image to GHCR
8591
run: |
86-
docker push ghcr.io/${{ env.org_name }}/fhirserver:nightly
92+
ORG_NAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
93+
REPO_NAME=$(basename "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
94+
IMAGE_TAG="nightly"
95+
96+
echo "Pushing to ghcr.io/${ORG_NAME}/${REPO_NAME}:${IMAGE_TAG}"
97+
docker push ghcr.io/${ORG_NAME}/${REPO_NAME}:${IMAGE_TAG}
98+

library/ftx/ftx_sct_importer.pas

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -766,59 +766,94 @@ function LoadFile(filename : String):TBytes;
766766
End;
767767
TIndexArray = array of TIndex;
768768

769+
769770
Procedure QuickSortIndex(var a : TIndexArray);
770771

772+
Function MedianOfThree(L, M, R: Integer): Integer;
773+
Begin
774+
If a[L].id <= a[M].id Then
775+
Begin
776+
If a[M].id <= a[R].id Then
777+
Result := M // L <= M <= R
778+
Else If a[L].id <= a[R].id Then
779+
Result := R // L <= R < M
780+
Else
781+
Result := L // R < L <= M
782+
End
783+
Else
784+
Begin
785+
If a[L].id <= a[R].id Then
786+
Result := L // M < L <= R
787+
Else If a[M].id <= a[R].id Then
788+
Result := R // M <= R < L
789+
Else
790+
Result := M // R < M < L
791+
End;
792+
End;
793+
771794
Procedure QuickSort(L, R: Integer);
772795
Var
773796
I, J, K : Integer;
774797
t : TIndex;
775798
Begin
776-
// QuickSort routine (Recursive)
777-
// * Items is the default indexed property that returns a pointer, subclasses
778-
// specify these return values as their default type.
779-
// * The Compare routine used must be aware of what this pointer actually means.
780-
781-
Repeat
799+
While L < R Do
800+
Begin
782801
I := L;
783802
J := R;
784-
K := (L + R) Shr 1;
803+
804+
// BETTER PIVOT SELECTION - median of three
805+
K := MedianOfThree(L, (L + R) Shr 1, R);
806+
807+
// Move pivot to middle position for consistency
808+
If K <> ((L + R) Shr 1) Then
809+
Begin
810+
t := a[K];
811+
a[K] := a[(L + R) Shr 1];
812+
a[(L + R) Shr 1] := t;
813+
K := (L + R) Shr 1;
814+
End;
785815

786816
Repeat
787817
While a[I].id < a[K].id Do
788818
Inc(I);
789-
790819
While a[J].id > a[K].id Do
791820
Dec(J);
792-
793821
If I <= J Then
794822
Begin
795823
t := a[i];
796824
a[i] := a[j];
797825
a[j] := t;
798-
799-
// Keep K as the index of the original middle element as it might get exchanged.
800826
If I = K Then
801827
K := J
802828
Else If J = K Then
803829
K := I;
804-
805830
Inc(I);
806831
Dec(J);
807832
End;
808833
Until I > J;
809834

810-
If L < J Then
811-
QuickSort(L, J);
812-
813-
L := I;
814-
Until I >= R;
835+
// Recurse on smaller partition
836+
If (J - L) < (R - I) Then
837+
Begin
838+
If L < J Then
839+
QuickSort(L, J);
840+
L := I;
841+
End
842+
Else
843+
Begin
844+
If I < R Then
845+
QuickSort(I, R);
846+
R := J;
847+
End;
848+
End;
815849
End;
816850

817851
Begin
818852
If length(a) > 1 Then
819853
QuickSort(0, length(a) - 1);
820854
End;
821855

856+
822857
procedure TSnomedImporter.ReadDescriptionsFile;
823858
var
824859
s : TBytes;

library/ftx/ftx_sct_services.pas

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,6 +2113,7 @@ function TSnomedServices.GetEditionName: String;
21132113
else if FEditionId = '11000172109' then result := 'Belgian Edition'
21142114
else if FEditionId = '20621000087109' then result := 'Canadian English Edition'
21152115
else if FEditionId = '20611000087101' then result := 'Canadian Canadian French Edition'
2116+
else if FEditionId = '11000279109' then result := 'Czech Edition'
21162117
else if FEditionId = '554471000005108' then result := 'Danish Edition'
21172118
else if FEditionId = '11000181102' then result := 'Estonian Edition'
21182119
else if FEditionId = '11000229106' then result := 'Finnish Edition'
@@ -4703,6 +4704,8 @@ function readLang(s : String) : byte;
47034704
result := 7
47044705
else if (s = 'it') then
47054706
result := 8
4707+
else if (s = 'cs') then
4708+
result := 9
47064709
else
47074710
raise ETerminologyError.create('Unknown SCT Lang "'+s+'"', itInvalid);
47084711
end;
@@ -4718,6 +4721,7 @@ function codeForLang(lang : byte):String;
47184721
6 : result := 'da';
47194722
7 : result := 'de';
47204723
8 : result := 'it';
4724+
9 : result := 'cs';
47214725
else
47224726
result := '??';
47234727
end;
@@ -4741,6 +4745,8 @@ function langForCode(s: String): byte;
47414745
result := 7
47424746
else if (s = 'it') or (s.startsWith('it-')) then
47434747
result := 8
4748+
else if (s = 'cs') or (s.startsWith('cs-')) then
4749+
result := 9
47444750
else
47454751
result := 0;
47464752
end;
@@ -4756,6 +4762,7 @@ function describeLangs(langs: integer): string;
47564762
if (langs and (1 shl 6) > 0) then CommaAdd(result, 'da');
47574763
if (langs and (1 shl 7) > 0) then CommaAdd(result, 'de');
47584764
if (langs and (1 shl 8) > 0) then CommaAdd(result, 'it');
4765+
if (langs and (1 shl 9) > 0) then CommaAdd(result, 'cs');
47594766
end;
47604767

47614768
function TSnomedExpressionContext.sizeInBytesV(magic : integer) : cardinal;

server/console_form.lfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3170,6 +3170,7 @@ object MainConsoleForm: TMainConsoleForm
31703170
'Belgian'
31713171
'Canadian English'
31723172
'Canadian French'
3173+
'Czech'
31733174
'Danish'
31743175
'Estonian'
31753176
'Finnish'

server/console_form.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,6 +3225,7 @@ function TMainConsoleForm.getSnomedModule: String;
32253225
25: { US (with ICD-10-CM maps) } result := '5991000124107';
32263226
26: { IPS Terminology } result := '827022005';
32273227
27: { Combined } result := inttostr(COMBINED_MODULE_ID);
3228+
28: { Czech } result := '11000279109';
32283229
end;
32293230
end;
32303231

server/fhirconsole.lpi

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<CONFIG>
23
<ProjectOptions>
34
<Version Value="12"/>
@@ -19,7 +20,6 @@
1920
<MajorVersionNr Value="3"/>
2021
<MinorVersionNr Value="8"/>
2122
<RevisionNr Value="6"/>
22-
<Attributes pvaDebug="False"/>
2323
</VersionInfo>
2424
<BuildModes Count="8">
2525
<Item1 Name="default" Default="True"/>
@@ -126,7 +126,7 @@
126126
</Target>
127127
<SearchPaths>
128128
<IncludeFiles Value="$(ProjOutDir);..\library"/>
129-
<Libraries Value="\usr\local\lib64\"/>
129+
<Libraries Value="\usr\local\lib64"/>
130130
<OtherUnitFiles Value="admin;tx;..\library\fsl\tests;..\library\fhir\tests;..\library\fhir4\tests;..\library\fhir4b\tests;..\library\fhir5\tests;..\library\ftx\tests;..\library\fxver\tests;..\library\cda\tests;..\library\v2\tests;..\library\fdb\tests;modules;tests;..\library\fcomp\tests"/>
131131
<UnitOutputDirectory Value="lib\console\$(BuildMode)"/>
132132
</SearchPaths>
@@ -219,7 +219,10 @@
219219
</Debugging>
220220
</Linking>
221221
<Other>
222-
<CustomOptions Value="-WM10.15&#10;-XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk&#10;-gw2&#10;-gw3"/>
222+
<CustomOptions Value="-WM10.15
223+
-XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
224+
-gw2
225+
-gw3"/>
223226
</Other>
224227
</CompilerOptions>
225228
</Item6>
@@ -276,7 +279,7 @@
276279
</Target>
277280
<SearchPaths>
278281
<IncludeFiles Value="$(ProjOutDir);..\library"/>
279-
<Libraries Value="\usr\local\lib64\"/>
282+
<Libraries Value="\usr\local\lib64"/>
280283
<OtherUnitFiles Value="admin;tx;..\library\fsl\tests;..\library\fhir\tests;..\library\fhir4\tests;..\library\fhir4b\tests;..\library\fhir5\tests;..\library\ftx\tests;..\library\fxver\tests;..\library\cda\tests;..\library\v2\tests;..\library\fdb\tests;modules;tests;..\library\fcomp\tests"/>
281284
<UnitOutputDirectory Value="lib\console\$(BuildMode)"/>
282285
</SearchPaths>
@@ -508,7 +511,7 @@
508511
<Name Value="ELibraryException"/>
509512
</Item3>
510513
<Item4>
511-
<Name Value="&lt;Unknown Class&gt;"/>
514+
<Name Value="&lt;Unknown Class>"/>
512515
</Item4>
513516
<Item5>
514517
<Name Value="0000000eEIdSocketError"/>

server/web/homepage.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ <h2>Welcome to the FHIR Server</h2>
1818
[%endpoints%]
1919
</ul>
2020

21+
[%host_include links.html%]
22+
2123
<p>
2224
GDPR-Disclosure: All access to this server is logged as AuditEvent Resources, and these store your ip address
2325
(and logged in user, if one exists). Also, your IP address is logged with Google Analytics for building geomaps

server/web_server.pas

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,23 @@ procedure TFhirWebServer.ReturnProcessedFile(sender : TObject; request : TIdHTTP
15311531
end;
15321532

15331533
function TFhirWebServer.insertValue(n : String; secure: boolean; variables: TFslMap<TFHIRObject>) : String;
1534+
var localfilePath:string;
15341535
begin
1535-
if n.startsWith('include ') then
1536+
if n.StartsWith('host_include ') then
1537+
begin
1538+
localfilePath := filePath(['/root/fhirserver/web_files',n.Substring(13).Trim]);
1539+
try
1540+
if FileExists(localfilePath) then
1541+
result := FileToString(localfilePath, TEncoding.UTF8)
1542+
else
1543+
result := '';
1544+
except
1545+
on E: Exception do
1546+
result := '';
1547+
//Logging.Log('Error reading host file: '+E.Message);
1548+
end;
1549+
end
1550+
else if n.startsWith('include ') then
15361551
result := SourceProvider.getSource(n.subString(8))
15371552
else if n = 'id' then
15381553
result := Common.Name

0 commit comments

Comments
 (0)