Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the SUSHI output String buffer #713

Merged
merged 7 commits into from
Jun 29, 2023
Merged

Improve the SUSHI output String buffer #713

merged 7 commits into from
Jun 29, 2023

Conversation

qligier
Copy link
Contributor

@qligier qligier commented Jun 21, 2023

It now automatically increases size if the current SUSHI output line is larger than the buffer initial size, preventing an IndexOutOfBoundsException being thrown. The StringBuilder is reused in the same way the old byte array was. to preserve performance. It solves #712.

It now automatically increases size if the current SUSHI output line is larger than the buffer initial size, preventing an IndexOutOfBoundsException being thrown. The StringBuilder is reused in the same way the old byte array was. to preserve performance. It solves #712.
@dotasek
Copy link
Collaborator

dotasek commented Jun 22, 2023

Is it possible to create a simple test to describe the expected behaviour?

The code does seem cleaner with these fixes.

@qligier
Copy link
Contributor Author

qligier commented Jun 22, 2023

Sure. I've refactored the code a bit to facilitate testing and have added simple tests for MySushiHandler. Is it fine like that?

@dotasek
Copy link
Collaborator

dotasek commented Jun 27, 2023

That does look better! I have another PR that refines those tests slightly: https://github.com/qligier/fhir-ig-publisher/pull/1

Could you take a look?

@qligier
Copy link
Contributor Author

qligier commented Jun 28, 2023

Thank you for improving this PR, I've merged your commit.

@dotasek
Copy link
Collaborator

dotasek commented Jun 29, 2023

This was tested locally using the compiled CLI jar to confirm that SUSHI output is still generated and matches previous runs.

Run Sushi on /Users/david.otasek/IN/2023-06-28-fshrunner-refactor/fhir-sdoh-clinicalcare (00:00.024)
Sushi: info  Running SUSHI v3.0.0 (implements FHIR Shorthand specification v2.0.0) (00:03.950)
Sushi: info  Arguments:                                                          (00:03.951)
Sushi: info    --out /Users/david.otasek/IN/2023-06-28-fshrunner-refactor/fhir-sdoh-clinicalcare (00:03.951)
Sushi: info    /Users/david.otasek/IN/2023-06-28-fshrunner-refactor/fhir-sdoh-clinicalcare (00:03.951)
Sushi: info  Using configuration file: /Users/david.otasek/IN/2023-06-28-fshrunner-refactor/fhir-sdoh-clinicalcare/sushi-config.yaml (00:06.844)
Sushi: info  Importing FSH text...                                               (00:06.934)
Sushi: info  Preprocessed 117 documents with 36 aliases.                         (00:07.067)
Sushi: info  Imported 36 definitions and 67 instances.                           (00:07.122)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for hl7.fhir.uv.tools#current... (00:07.123)
Sushi: info  Found hl7.fhir.uv.tools#current in /Users/david.otasek/.fhir/packages. (00:07.431)
Sushi: info  Loaded package hl7.fhir.uv.tools#current                            (00:07.858)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for hl7.terminology.r4#5.0.0... (00:08.365)
Sushi: info  Found hl7.terminology.r4#5.0.0 in /Users/david.otasek/.fhir/packages. (00:17.567)
Sushi: info  Loaded package hl7.terminology.r4#5.0.0                             (00:17.568)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for hl7.fhir.us.core#3.1.1... (00:17.568)
Sushi: info  Found hl7.fhir.us.core#3.1.1 in /Users/david.otasek/.fhir/packages. (00:18.258)
Sushi: info  Loaded package hl7.fhir.us.core#3.1.1                               (00:18.259)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for hl7.fhir.uv.sdc#3.0.0... (00:18.259)
Sushi: info  Found hl7.fhir.uv.sdc#3.0.0 in /Users/david.otasek/.fhir/packages.  (00:18.980)
Sushi: info  Loaded package hl7.fhir.uv.sdc#3.0.0                                (00:18.980)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for hl7.fhir.uv.subscriptions-backport#0.1.0... (00:18.981)
Sushi: info  Found hl7.fhir.uv.subscriptions-backport#0.1.0 in /Users/david.otasek/.fhir/packages. (00:19.255)
Sushi: info  Loaded package hl7.fhir.uv.subscriptions-backport#0.1.0             (00:19.256)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for us.nlm.vsac#0.9.0... (00:19.256)
Sushi: info  Found us.nlm.vsac#0.9.0 in /Users/david.otasek/.fhir/packages.      (00:53.453)
Sushi: info  Loaded package us.nlm.vsac#0.9.0                                    (00:53.454)
Sushi: info  Loading supplemental version of FHIR to support extensions from hl7.fhir.extensions.r5 (00:53.454)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for hl7.fhir.r5.core#5.0.0... (00:53.455)
Sushi: info  Found hl7.fhir.r5.core#5.0.0 in /Users/david.otasek/.fhir/packages. (01:09.740)
Sushi: info  Loaded package hl7.fhir.r5.core#5.0.0                               (01:09.741)
Sushi: info  Checking /Users/david.otasek/.fhir/packages for hl7.fhir.r4.core#4.0.1... (01:09.741)
Sushi: info  Found hl7.fhir.r4.core#4.0.1 in /Users/david.otasek/.fhir/packages. (01:20.975)
Sushi: info  Loaded package hl7.fhir.r4.core#4.0.1                               (01:20.975)
Sushi: info  Converting FSH to FHIR resources...                                 (01:21.087)
Sushi: warn  Definition of extension (http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.subject) is incomplete since the following type has no equivalent in FHIR 4.0.1: http://hl7.org/fhir/StructureDefinition/NutritionProduct. (01:22.122)
Sushi: warn  Definition of extension (http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.subject) is incomplete since the following type has no equivalent in FHIR 4.0.1: http://hl7.org/fhir/StructureDefinition/NutritionProduct. (01:22.130)
Sushi: warn  Definition of extension (http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.subject) is incomplete since the following type has no equivalent in FHIR 4.0.1: http://hl7.org/fhir/StructureDefinition/NutritionProduct. (01:22.142)
Sushi: warn  Definition of extension (http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.subject) is incomplete since the following type has no equivalent in FHIR 4.0.1: http://hl7.org/fhir/StructureDefinition/NutritionProduct. (01:22.149)
Sushi: info  Converted 21 FHIR StructureDefinitions.                             (01:24.262)
Sushi: info  Converted 1 FHIR CodeSystems.                                       (01:24.299)
Sushi: info  Converted 14 FHIR ValueSets.                                        (01:24.531)
Sushi: info  Converted 67 FHIR instances.                                        (01:32.588)
Sushi: info  Exporting FHIR resources as JSON...                                 (01:32.588)
Sushi: info  Exported 103 FHIR resources as JSON.                                (01:32.711)
Sushi: info  Assembling Implementation Guide sources...                          (01:32.712)
Sushi: warn  Files not in the supported file types (.md and .xml) were detected. These files will be included without any processing. (01:32.810)
Sushi:   File: /Users/david.otasek/IN/2023-06-28-fshrunner-refactor/fhir-sdoh-clinicalcare/input/pagecontent (01:32.811)
Sushi: info  Generated ImplementationGuide-hl7.fhir.us.sdoh-clinicalcare.json    (01:32.816)
Sushi: info  Assembled Implementation Guide sources; ready for IG Publisher.     (01:32.816)
Sushi: ========================= SUSHI RESULTS ===========================       (01:32.817)
Sushi: |  -------------------------------------------------------------  |       (01:32.817)
Sushi: | |    Profiles   |  Extensions  |   Logicals   |   Resources   | |       (01:32.818)
Sushi: | |-------------------------------------------------------------| |       (01:32.818)
Sushi: | |      19       |      2       |      0       |       0       | |       (01:32.818)
Sushi: |  -------------------------------------------------------------  |       (01:32.819)
Sushi: |  -------------------------------------------------------------  |       (01:32.819)
Sushi: | |      ValueSets     |    CodeSystems    |     Instances      | |       (01:32.819)
Sushi: | |-------------------------------------------------------------| |       (01:32.819)
Sushi: | |         14         |         1         |         67         | |       (01:32.820)
Sushi: |  -------------------------------------------------------------  |       (01:32.820)
Sushi: |                                                                 |       (01:32.820)
Sushi: ===================================================================       (01:32.820)
Sushi: | Sailors, take warning!                 0 Errors      5 Warnings |       (01:32.821)
Sushi: ===================================================================       (01:32.821)

@dotasek dotasek merged commit 9bb1ec8 into HL7:master Jun 29, 2023
10 checks passed
@qligier qligier deleted the ql_sushi_buffer_fix branch June 29, 2023 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants