Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c4a7199
fix snomed import
costateixeira Oct 1, 2022
12d8838
try to fix codescan
costateixeira May 14, 2023
2e03db6
Update linux-docker-build.yml
costateixeira May 14, 2023
0688d1f
Merge pull request #2 from HealthIntersections/master
costateixeira May 14, 2023
f1db005
remove codescan
costateixeira May 14, 2023
4516b9b
Merge branch 'HealthIntersections:master' into master
costateixeira May 31, 2023
f4df493
Merge branch 'HealthIntersections:master' into master
costateixeira May 31, 2023
8be7fdb
Merge branch 'HealthIntersections:master' into master
costateixeira May 31, 2023
f2ea7e7
Merge branch 'HealthIntersections:master' into master
costateixeira May 31, 2023
10fa16d
Merge branch 'HealthIntersections:master' into master
costateixeira Jun 1, 2023
28f7dd6
Merge branch 'HealthIntersections:master' into master
costateixeira Jun 1, 2023
4466a48
Merge branch 'HealthIntersections:master' into master
costateixeira Jun 1, 2023
2754368
Update linux-docker-build.yml
costateixeira Jun 1, 2023
9c1700d
Update linux-docker-build.yml
costateixeira Jun 1, 2023
f331280
update docker run line
costateixeira Jun 5, 2023
9f3875d
Merge branch 'HealthIntersections:master' into master
costateixeira Jun 5, 2023
712fa80
Update linux-docker-build.yml
costateixeira Jun 6, 2023
3d6700b
Merge branch 'HealthIntersections:master' into master
costateixeira Jun 7, 2023
529694b
Merge branch 'HealthIntersections:master' into master
costateixeira Jun 7, 2023
eac875b
serve static files
costateixeira Jun 10, 2023
7b642d5
fix copy paste issue
costateixeira Jun 11, 2023
3fc34a1
Merge branch 'HealthIntersections:master' into master
costateixeira Jun 11, 2023
9cc28e2
Update web_server.pas
costateixeira Jun 11, 2023
ef36272
Update Dockerfile
costateixeira Jun 11, 2023
f3c1eb4
simple local config
costateixeira Jun 11, 2023
755ab86
reduce server binary size on linux
costateixeira Jun 11, 2023
829462f
Update linux-fhirserver.sh
costateixeira Jun 11, 2023
bef6a96
Update linux-fhirserver.sh
costateixeira Jun 11, 2023
273ceca
Update linux-fhirserver.sh
costateixeira Jun 11, 2023
58dcf49
Update fhirserver.lpi
costateixeira Jun 11, 2023
4d63165
Update fhirtoolkit.lpi
costateixeira Jun 11, 2023
8fbfcb6
reduce layers in docker and reduce bin size
costateixeira Jun 11, 2023
4c31e6a
Merge branch 'master' into fix-sct
costateixeira Jun 12, 2023
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
19 changes: 16 additions & 3 deletions .github/workflows/linux-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ jobs:
docker build \
--tag fhirserver \
.
- name: Scan Code
run: |
docker run --entrypoint /work/fhirserver/utilities/codescan/codescan fhirserver /work/bootstrap
# - name: Scan Code
# run: |
# export DISPLAY=0:0
# docker run --entrypoint /work/fhirserver/utilities/codescan/codescan fhirserver /work/bootstrap
- name: Prepare ini file
env:
FHIRSERVER_LOCATIONS_CLONE_PATH: /work/fhirserver
Expand Down Expand Up @@ -65,3 +66,15 @@ jobs:
-v ~/terminology:/terminology \
-v ~/test-settings.ini:/work/fhirserver/exec/64/test-settings.ini \
fhirserver -tests
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Tag and push Docker image
run: |
docker tag fhirserver ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:latest

12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ RUN /work/bootstrap/linux-toolchain.sh /work/bootstrap
WORKDIR /work/fhirserver
COPY . /work/fhirserver

RUN /work/bootstrap/linux-libraries.sh /work/bootstrap
RUN cp exec/pack/linux/*.so /usr/lib/
RUN /work/fhirserver/build/linux-fhirserver.sh /work/bootstrap
RUN cp exec/pack/*.properties exec/64
RUN /work/bootstrap/linux-libraries.sh /work/bootstrap && \
cp exec/pack/linux/*.so /usr/lib/
RUN /work/fhirserver/build/linux-fhirserver.sh /work/bootstrap && \
cp exec/pack/*.properties exec/64 && \
find . -name "*.o" -type f -delete -o -name "*.ppu" -type f -delete


ENV DISPLAY :99
ENV PORT 80
Expand All @@ -38,4 +40,4 @@ chmod +x /bin/entrypoint.sh

ENTRYPOINT ["/bin/entrypoint.sh"]

CMD ["-cmd", "exec", "-cfg", "http://tx.fhir.org/config", "-version", "4", "-local", "$TERMINOLOGY_CACHE"]
CMD ["-cmd", "exec", "-cfg", "/config/config.ini", "-local", "$TERMINOLOGY_CACHE"]
6 changes: 6 additions & 0 deletions config/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[config]
zero=https://storage.googleapis.com/tx-fhir-org
version=*
user=jose

[web]
18 changes: 16 additions & 2 deletions library/ftx/ftx_loinc_services.pas
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
Uses
SysUtils, Classes, Generics.Collections, {$IFDEF FPC} LazUTF8,{$ELSE} IOUtils, RegularExpressions, {$ENDIF}
fsl_base, fsl_utilities, fsl_stream, fsl_collections, fsl_fpc, fsl_lang, fsl_http,
fhir_objects, fhir_common, fhir_utilities, fhir_factory, fhir_features, fhir_uris,
fhir_objects, fhir_common, fhir_utilities, fhir_factory,
fhir_features, fhir_uris,
fhir_cdshooks,
ftx_service;

Expand Down Expand Up @@ -525,6 +526,13 @@ function memU16ToString(const bytes : TBytes; index : cardinal; chars : word) :

// the bytes contain UTF8
function memU8toString(bytes : TBytes; index, chars : integer) : String;
{$IFNDEF FPC}
var
utf8str: UTF8String;
{$ENDIF}
var UTFEncoding: TEncoding;
theseBytes:TBytes;

begin
if chars = 0 then
exit('');
Expand All @@ -534,7 +542,13 @@ function memU8toString(bytes : TBytes; index, chars : integer) : String;
setLength(result, chars);
Move(bytes[index], result[1], chars);
{$ELSE}
result := TEncoding.UTF8.GetString(bytes, index, chars);
UTFEncoding:= TEncoding.UTF8;
theseBytes := Copy(bytes, index, chars);
try
result :=UTFEncoding.GetString(theseBytes);
except
writeln(result)
end;
{$ENDIF}
end;

Expand Down
11 changes: 6 additions & 5 deletions library/ftx/ftx_sct_services.pas
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}

Uses
SysUtils, Classes, Generics.Collections, Character,
SysUtils, Classes, Generics.Collections, Character, Dialogs,
fsl_base, fsl_utilities, fsl_collections, fsl_http, fsl_fpc, fsl_threads, fsl_lang,
fhir_objects, fhir_common, fhir_factory, fhir_utilities, fhir_features, fhir_uris,
fhir_cdshooks,
Expand Down Expand Up @@ -840,7 +840,7 @@ function TSnomedStrings.GetEntry(iIndex: Cardinal): String;
if FIsUTF16 then
result := memU16ToString(FMaster, iIndex+2, i)
else
result := memU8ToString(FMaster, iIndex+2, i)
result := memU8ToString(FMaster, iIndex+2, i)
end;

procedure TSnomedStrings.Reopen;
Expand All @@ -852,15 +852,16 @@ procedure TSnomedStrings.Reopen;
function TSnomedStrings.AddString(const s: String): Cardinal;
var
i : word;
b : TArray<Byte>;
b : TBytes;
begin
if Length(s) > 65535 Then
raise ETerminologySetup.Create('Snomed Description too long: '+String(s));
result := FBuilder.Length;
if FIsUTF16 then
b := TEncoding.BigEndianUnicode.GetBytes(s)
else
b := TEncoding.UTF8.GetBytes(s);
else
b := TEncoding.UTF8.GetBytes(s) ;

i := length(b);
FBuilder.AddWord(i);
FBuilder.Append(b);
Expand Down
3 changes: 3 additions & 0 deletions server/fhirconsole.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
</Win32>
</Options>
</Linking>
<Other>
<Compiler>-O2 -Xs</Compiler>
</Other>
</CompilerOptions>
</Item4>
<Item5 Name="osx">
Expand Down
1 change: 1 addition & 0 deletions server/fhirserver.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<ShowNotes Value="False"/>
<ShowHints Value="False"/>
</Verbosity>
<Compiler>-O2 -Xs</Compiler>
<CompilerMessages>
<IgnoredMessages idx5094="True" idx5093="True" idx5092="True" idx5091="True" idx5090="True" idx5089="True" idx5024="True"/>
</CompilerMessages>
Expand Down
4 changes: 3 additions & 1 deletion server/web_base.pas
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@ function TFHIRWebServerBase.IsTerminologyServerOnly: boolean;
result := 'video/mpeg'
Else if AExt = '.js' Then
result := 'text/javascript'
Else
else if AExt = '.html' then // Add this case
result := 'text/html' // Use 'text/html' for .html files
else
Begin
{$IFDEF WINDOWS}
Try
Expand Down
28 changes: 28 additions & 0 deletions server/web_server.pas
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,18 @@ procedure TFhirWebServer.PlainRequest(AContext: TIdContext;
ok : boolean;
epn, cid, ip : String;
tt : TTimeTracker;
fullPath: String;
DefaultFiles: array[0..2] of String;
DefaultFile: String;
i: Integer;

begin

DefaultFiles[0] := 'index.html';
DefaultFiles[1] := 'index.htm';
DefaultFiles[2] := 'default.html';


// when running with a reverse proxy, it's easier to let the reverse proxy just use non-ssl upstream, and pass through the certificate details se we know SSL is being used
if (Common.SSLHeaderValue <> '') and (request.RawHeaders.Values['X-Client-SSL'] = Common.SSLHeaderValue) then
SecureRequest(aContext, request, response)
Expand Down Expand Up @@ -742,6 +753,23 @@ procedure TFhirWebServer.PlainRequest(AContext: TIdContext;

if not ok then
begin
// Get full path of the requested document
fullPath := SourceProvider.AltFile(request.Document, '/');

// If the path corresponds to a directory, look for a default file
if DirectoryExists(fullPath) then
begin
for i := 0 to 2 do
begin
DefaultFile := DefaultFiles[i];
if FileExists(fullPath + '/' + DefaultFile) then
begin
ReturnSpecFile(response, request.Document + '/' + DefaultFile, fullPath + '/' + DefaultFile, false);
Exit; // Exit the procedure after serving a default file
end;
end;
end;

if request.Document = '/diagnostics' then
begin
epn := 'WS';
Expand Down
1 change: 1 addition & 0 deletions toolkit2/fhirtoolkit.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<CompilerMessages>
<IgnoredMessages idx5024="True"/>
</CompilerMessages>
<Compiler>-O2 -Xs</Compiler>
</Other>
</CompilerOptions>
</Item>
Expand Down
3 changes: 3 additions & 0 deletions utilities/codescan/codescan.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
<TargetCPU Value="x86_64"/>
<TargetOS Value="linux"/>
</CodeGeneration>
<Other>
<Compiler>-O2 -Xs</Compiler>
</Other>
</CompilerOptions>
</Item>
<Item Name="osx">
Expand Down