From a61d860ddb8e0ce5176cf198590e8c8c0f0a940f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 16 Jan 2023 22:13:38 +1100 Subject: [PATCH 1/3] FTP passive mode --- .../src/main/java/org/hl7/fhir/utilities/FTPClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/FTPClient.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/FTPClient.java index 69f712159..e21979ba6 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/FTPClient.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/FTPClient.java @@ -57,7 +57,6 @@ public class FTPClient { else { clientImpl.connect(server); } - //clientImpl.setFileTransferMode(FTP.BINARY_FILE_TYPE); clientImpl.login(user, password); @@ -93,6 +92,7 @@ public class FTPClient { String resolvedPath = resolveRemotePath(path); FileInputStream localStream = new FileInputStream(source); clientImpl.setFileType(FTP.BINARY_FILE_TYPE); + clientImpl.enterLocalPassiveMode(); clientImpl.storeFile( resolvedPath, localStream); localStream.close(); From 4b1a3dba466f8eaaccad875c504e5c7e9de9486c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 16 Jan 2023 22:13:53 +1100 Subject: [PATCH 2/3] Improve URN validation --- .../src/main/resources/Messages.properties | 2 +- .../instance/InstanceValidator.java | 6 +- .../4.0.1/http___standardterms.edqm.eu.cache | 12 ++++ .../4.0.1/iso3166.cache | 11 ++++ .../org.hl7.fhir.validation/4.0.1/loinc.cache | 64 +++++++++++++++++++ .../4.0.1/rxnorm.cache | 11 ++++ pom.xml | 2 +- 7 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/http___standardterms.edqm.eu.cache diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index 53d2bf1e3..9a4ee9b56 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -222,7 +222,7 @@ Type_Specific_Checks_DT_URI_UUID = URI values cannot start with uuid: Type_Specific_Checks_DT_URI_WS = URI values cannot have whitespace(''{0}'') Type_Specific_Checks_DT_URL_Resolve = URL value ''{0}'' does not resolve Type_Specific_Checks_DT_UUID_Strat = UUIDs must start with urn:uuid: -Type_Specific_Checks_DT_UUID_Valid = UUIDs must be valid (and lowercase) +Type_Specific_Checks_DT_UUID_Valid = UUIDs must be valid and lowercase ({0}) Validation_BUNDLE_Message = The first entry in a message must be a MessageHeader Validation_VAL_Content_Unknown = Unrecognised Content {0} Validation_VAL_NoType = Unknown type {0} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 33816e8fc..59c937d1e 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -2319,7 +2319,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat } if (url != null && url.startsWith("urn:uuid:")) { - ok = rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, Utilities.isValidUUID(url.substring(9)), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_UUID_VALID) && ok; + String s = url.substring(9); + if (s.contains("#")) { + s = s.substring(0, s.indexOf("#")); + } + ok = rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, Utilities.isValidUUID(s), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_UUID_VALID, s) && ok; } if (url != null && url.startsWith("urn:oid:")) { String cc = url.substring(8); diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/http___standardterms.edqm.eu.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/http___standardterms.edqm.eu.cache new file mode 100644 index 000000000..d4e834cae --- /dev/null +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/http___standardterms.edqm.eu.cache @@ -0,0 +1,12 @@ +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://standardterms.edqm.eu", + "code" : "20049000", + "display" : "Nasal use" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "Nasal use", + "code" : "20049000", + "system" : "http://standardterms.edqm.eu" +} +------------------------------------------------------------------------------------- diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache index d69b91e0d..29345203a 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache @@ -49,3 +49,14 @@ v: { "system" : "urn:iso:std:iso:3166" } ------------------------------------------------------------------------------------- +{"code" : { + "system" : "urn:iso:std:iso:3166", + "code" : "NO", + "display" : "Norway" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "Norway", + "code" : "NO", + "system" : "urn:iso:std:iso:3166" +} +------------------------------------------------------------------------------------- diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache index 4707078d1..900f50716 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache @@ -2184,3 +2184,67 @@ v: { "system" : "http://loinc.org" } ------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "60591-5" +}, "url": "http://hl7.org/fhir/ValueSet/doc-typecodes--0", "version": "4.0.1", "lang":"null", "useServer":"true", "useClient":"false", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "Patient summary Document", + "code" : "60591-5", + "system" : "http://loinc.org" +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "60591-5", + "display" : "Patient Summary Document" +}, "url": "http://hl7.org/fhir/ValueSet/doc-typecodes", "version": "4.0.1", "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"NO_MEMBERSHIP_CHECK", "versionFlexible":"false"}#### +v: { + "display" : "Patient summary Document", + "code" : "60591-5", + "system" : "http://loinc.org" +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "60591-5" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "Patient summary Document", + "code" : "60591-5", + "system" : "http://loinc.org" +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "48765-2", + "display" : "Allergies and adverse reactions Document" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "Allergies and adverse reactions Document", + "code" : "48765-2", + "system" : "http://loinc.org" +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "10160-0", + "display" : "History of Medication use Narrative" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "History of Medication use Narrative", + "code" : "10160-0", + "system" : "http://loinc.org" +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "11450-4", + "display" : "Problem list - Reported" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "Problem list - Reported", + "code" : "11450-4", + "system" : "http://loinc.org" +} +------------------------------------------------------------------------------------- diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/rxnorm.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/rxnorm.cache index 11156b33c..a475020d6 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/rxnorm.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/rxnorm.cache @@ -110,3 +110,14 @@ v: { "system" : "http://www.nlm.nih.gov/research/umls/rxnorm" } ------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://www.nlm.nih.gov/research/umls/rxnorm", + "code" : "1000990", + "display" : "oxymetazoline hydrochloride 0.5 MG/ML Nasal Spray" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "oxymetazoline hydrochloride 0.5 MG/ML Nasal Spray", + "code" : "1000990", + "system" : "http://www.nlm.nih.gov/research/umls/rxnorm" +} +------------------------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index b0a93aba0..b1612eae2 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 6.2.1 - 1.2.7 + 1.2.8-SNAPSHOT 5.7.1 1.8.2 3.0.0-M5 From 41abbb21a0b45621d96c23545631c64b45c7c0b4 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 17 Jan 2023 05:36:44 +1100 Subject: [PATCH 3/3] fix debug logging for snapshot generation --- .../main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java | 3 +++ .../main/java/org/hl7/fhir/r5/context/ContextUtilities.java | 2 +- .../java/org/hl7/fhir/r5/context/SimpleWorkerContext.java | 3 +++ .../main/java/org/hl7/fhir/validation/ValidationEngine.java | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index 712d337f6..1a3abd041 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -2275,6 +2275,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte } } catch (Exception e) { System.out.println("Unable to generate snapshot for "+tail(sd.getUrl()) +" from "+tail(sd.getBaseDefinition())+" because "+e.getMessage()); + if (logger.isDebugLogging()) { + e.printStackTrace(); + } } } System.out.print(":"); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java index 91b4496c4..fe714306e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java @@ -207,7 +207,7 @@ public class ContextUtilities implements ProfileKnowledgeProvider { } catch (Exception e) { if (!isSuppressDebugMessages()) { System.out.println("Unable to generate snapshot for "+tail(sd.getUrl()) +" from "+tail(sd.getBaseDefinition())+" because "+e.getMessage()); - if (true) { + if (context.getLogger().isDebugLogging()) { e.printStackTrace(); } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java index 31087fc2b..e4484c10f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java @@ -660,6 +660,9 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon } catch (Exception e) { // not sure what to do in this case? System.out.println("Unable to generate snapshot for "+uri+": "+e.getMessage()); + if (logger.isDebugLogging()) { + e.printStackTrace(); + } } } return r; diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java index 64e71a771..d9aa5cf40 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java @@ -764,9 +764,9 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP makeSnapshot(sd); } catch (Exception e) { System.out.println("Process Note: Unable to generate snapshot for " + sd.present() + ": " + e.getMessage()); -// if (debug) { + if (context.getLogger().isDebugLogging()) { e.printStackTrace(); -// } + } } } }