0

I am new to the FHIR world and I am trying to solve healthcare problems in my local region.

In my use case, I have following two requirements

  1. For Resource
  • I have to use most of the resources as it is from FHIR R4.

    ex - Encounter, MedicationRequest etc

  • I have to create a profile for some resources. (put some constraints on existing resource for my use case)

    ex - Observation

  • I have to create an extension for some resources. (add new property to resource for my use case)

    Ex - Patient

  1. For Code System
  • I have to use Snomed CT International.

  • I have to use couple of national extensions of snomed CT listed here (https://mlds.ihtsdotools.org/#/viewReleases#section-IN)

    ex - SnomedCT_IndiaAYUSHExtensionRF2_PRODUCTION_IN1000189_20220615T120000Z.zip etc

  • I have to create my own code system extension for local terminology.

Now I have confusion around how I can do the resource schema validation and code system or terminology validation as it includes my custom resource and my custom code system extension.

I was exploring the hapi-fhir library and I read about the FhirInstanceValidator for validation from the article (https://hapifhir.io/hapi-fhir/docs/validation/introduction.html). It says it can do validation of the official FHIR definition. What does it mean by official definition and can it be used for my use case where I have my custom resource and custom code system extension ?

I have also gone through the code examples from article (https://hapifhir.io/hapi-fhir/docs/validation/instance_validator.html). Particularly from 13.2.4Validating Using Packages. Can this be used for my validation purpose? It is not clear from this example what and how I need to supply so that It can do validation of custom schema and code system both.

Note -

  • I am not using hapi-fhir-jpa-server, I just want to use the hapi-fhir library for resource validation purposes.
  • I am not looking into Schema/Schematron Validation as it is advised by hapi-fhir that it's a legacy feature and might be deprecated with future releases.

1 Answers1

0

If you define your profile, extensions, CodeSystem, and ValueSets in a FHIR IG and use the publication tooling to generate a package (and declare which edition of SNOMED you're drawing from as an IG parameter), then you can pass the reference to that package to the HAPI validator and the validator will check everything for you. Most terminology is checked with a terminology service, not schema, because you're using a combination of code + system to validate, and sometimes a collection of codings, only one of which must be valid. XML schema has no idea how to check something like that. XML schema also can't enforce most profile stuff, including extensions. So just create the relevant StructureDefinitions and other artifacts, package and publish as an IG, and the tooling will handle the validation.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
  • Thanks for your answer Lloyd. I just want to confirm one thing. I have created my own snomed ct code system which has collection of local terms and codes (ex - {"code": 123, "term": "Kapiva"}). can this also be part of the package that I generate using FHIR IG so that I can do schema and terminology validation both using FhirInstanceValidator and I don't need to run terminology server for checking the terminology. – Akshay Singh Jan 15 '23 at 07:42
  • You cannot create your own SNOMED CT code system - there is only *one* SNOMED CT. (Thought there are multiple editions - if you've been assigned management authority for a number-space in SNOMED CT, then the codes you define are still official SNOMED CT codes.) You're free to define your *own* CodeSystem with its own distinct canonical URL. And you can define a value set that includes a mix of codes from SNOMED CT and your own code system. Depending on the nature of the value set definition (e.g. enumerated vs. expression based), the validator might decide it doesn't need a term server. – Lloyd McKenzie Jan 15 '23 at 16:48
  • Oh my bad, I meant to say my own SNOMED CT extension on top of SNOMED CT International. So, you are saying I will have to keep a terminology server up and running for sure and I will pass its URL to hapi-fhir library validator. Now when a request to validate an instance of some resource comes which is having valueset which includes a mix of code from both(international and my extension), sometimes it will validate without calling the terminology server and sometimes it will call terminology server. if I am correct can you please tell me in which scenarios it will call the terminology server ? – Akshay Singh Jan 16 '23 at 04:15
  • Content from SNOMED international and from your extension will both use the same URL for Coding.system. Whether a terminology server is needed depends on your value set definition. If your definition is "All SNOMED procedure codes", you'll need a terminology server to generate the expansion. If your definition is "codes A, B and C", HAPI can probably do that without a terminology server, though it will only be able to check that the codes are part of the value set, not that they're part of the code system. – Lloyd McKenzie Jan 16 '23 at 16:36