FHIR Chat · Current validator very slow for some resources? · implementers

Stream: implementers

Topic: Current validator very slow for some resources?


view this post on Zulip Morten Ernebjerg (Nov 11 2020 at 08:09):

Hi :wave: Running the latest validator this morning, I noticed it was extremely slow for certain resources. It seems to be very dependent on the resource/resource type (seem to work as usual for some), but I see it e.g. on this QuestionnaireResponse example: http://hl7.org/fhir/R4/questionnaire-example.json Validating this standard example just now took 1 min 19 secs! The slowness remains even when switching off the terminology serverm, so that is not the issue. There are no errors being thrown, either (see command line output below). Any ideas where this might be coming from?

FHIR Validation tool Version 5.1.21 (Git# 5b62d35f715f). Built 2020-11-11T02:04:31.124Z (5 hours old)
  Java:   1.8.0_222 from /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre on x86_64 (64bit). 3641MB available
  Paths:  Current = [....], Package Cache = /Users/[...]/.fhir/packages
  Params: -version 4.0.1 -tx n/a test.json
Loading
  Load FHIR v4.0 from hl7.fhir.r4.core#4.0.1 - 4575 resources (00:03.0671)
  Terminology server null - Version n/a: No Terminology Server (00:00.0000)
  Get set...  go (00:00.0002)
Validating
  Validate test.jsonTerminology server: Check for supported code systems for http://cancer.questionnaire.org/system/code/yesno
==============!! Running without terminology server !! ==============
=====================================================================
 01:19.0046
Done. Times: Loading: 00:03.0862, validation: 01:19.0046

Success: 0 errors, 2 warnings, 5 notes
  Information @ QuestionnaireResponse (line 1, col2) : No questionnaire is identified, so no validation can be performed against the base questionnaire
  Information @ QuestionnaireResponse.item[0].item[0].answer[0].value.ofType(Coding) (line 77, col83) : Code System URI 'http://cancer.questionnaire.org/system/code/yesno' is unknown so the code cannot be validated
  Information @ QuestionnaireResponse.item[0].item[0].answer[0].item[0].item[0].answer[0].value.ofType(Coding) (line 87, col99) : Code System URI 'http://cancer.questionnaire.org/system/code/yesno' is unknown so the code cannot be validated
  Information @ QuestionnaireResponse.item[0].item[0].answer[0].item[0].item[1].answer[0].value.ofType(Coding) (line 96, col99) : Code System URI 'http://cancer.questionnaire.org/system/code/yesno' is unknown so the code cannot be validated
  Information @ QuestionnaireResponse.item[0].item[0].answer[0].item[0].item[2].answer[0].value.ofType(Coding) (line 105, col99) : Code System URI 'http://cancer.questionnaire.org/system/code/yesno' is unknown so the code cannot be validated
  Warning @ QuestionnaireResponse.contained[0].ofType(Patient).identifier[1].type (line 18, col22) : No code provided, and a code should be provided from the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type)
  Warning @ QuestionnaireResponse.contained[2].ofType(Practitioner).identifier[0].type (line 44, col18) : No code provided, and a code should be provided from the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type)

view this post on Zulip Lloyd McKenzie (Nov 11 2020 at 14:36):

Does it run slow still once you have an updated cache? (Questionnaires often involve lots of vocabulary validation)

view this post on Zulip Morten Ernebjerg (Nov 12 2020 at 09:22):

Strangely, this morning the example I mentioned above runs fine (less than a second), but I still see this problem on other resources. I played around a bit and found the following:

  • Running the same validation repeatedly does not improve the speed - I imagine that means it is not due to a stale cache(?)
  • All the slow runs seem to run for pretty much exactly 1 min 19 secs, so there does not seem to be a strong dependence on resource details
  • Slow runs seem to be triggered by custom code system canonical URLs that contain particular "FHIR-words", e.g. "CodeSystem". For instance, comparing the two examples below, having "CodeSystem" (as opposed to "SodeCystem") in the URL bumps the validation time from 0.5 secs to 1 min 19 secs (!):

Slow example Encounter.type.coding.system = "http://somreandomurl.com/CodeSystem/test" :

{
    "resourceType": "Encounter",
    "status": "finished",
    "class": {
        "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
        "code": "AMB",
        "display": "ambulatory"
    },
    "type": [{
        "coding": [{
            "system": "http://somreandomurl.com/CodeSystem/test",
            "code": "somecode"
        }]
    }],
    "period": {
        "start": "2020-02-06",
        "end": "2020-02-06"
    }
}

Fast example - identical to the above, except that Encounter.type.coding.system = "http://somreandomurl.com/SodeCystem/test" :

{
    "resourceType": "Encounter",
    "status": "finished",
    "class": {
        "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
        "code": "AMB",
        "display": "ambulatory"
    },
    "type": [{
        "coding": [{
            "system": "http://somreandomurl.com/SodeCystem/test",
            "code": "somecode"
        }]
    }],
    "period": {
        "start": "2020-02-06",
        "end": "2020-02-06"
    }
}

view this post on Zulip Charlie Filkins (Nov 12 2020 at 22:30):

I have been experiencing problems as well on a number of different machines, with different network configurations, and with different versions of the Validator. I used WireShark to capture some network traffic and found a number of 502 Bad Gateway responses to http://packages2.fhir.org. I did notice that one validation (sadly, I can't recall which particular file) did run at what I would call a "normal" speed.

view this post on Zulip Grahame Grieve (Nov 12 2020 at 22:38):

hmm it shouldn't be hitting packages2.fhir.org...

view this post on Zulip Grahame Grieve (Nov 13 2020 at 00:34):

you'll both be glad to know that for me, validating the fast resource takes 01:28, and the slow resource takes 1:50

view this post on Zulip Grahame Grieve (Nov 13 2020 at 01:24):

and now that I fixed a few things, both now take 00:00.02

view this post on Zulip Morten Ernebjerg (Nov 13 2020 at 05:48):

Indeed, sounds great! :tada:


Last updated: Apr 12 2022 at 19:14 UTC