feat: Conformance Manager #98
                
     Draft
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
PULL REQUEST
Summary
This PR was my attempt to better utilize the conformance data available in the eCR FHIR package without having to implement a full FHIR server or download and run a bunch of scripts manually. It does this with a new project
Dibbs.FhirResolverthat handles interacting with the conformance data. Currently it attempts to do 2 things:_SystemReference.liquidtemplate.GetLoincName,GetRxnormNamefilters inCustomFilters.cs.This PR should be considered to still be in a rough first draft state as I was hoping to implement as much as possible before I had to leave it.
Current Changes
Code System URIs
Old State
In the current version of the converter code systems are turned into human-readable URIs with the
_SystemReference.liquidtemplate. This template is effectively just a large switch statement, where each case is a possible system OID. We would have to manually add every possible OID to this switch statement.New Changes
The awful switch statement is replaced with a dictionary created on the initialization of the
Dibbs.FhirResolver:_oidUriMapping. On initialization ofConformanceServiceevery code system and naming system resource is read and their OID and URI are added to_oidUriMapping. This can then be accessed throughGetCodeSystemUri.Code Displays
Old State
The
_Coding.liquidtemplate will populate"display"in the following order:displayattribute in the XMLLoinc.csvandrxnorm.csvusing the filtersGetLoincNameandGetRxnormName.New Changes
ConformanceServicewill now construct a dictionary of all codes with a display value in valueset resources. While this will cover a lot of relevant codes, especially from HL7 valuesets, there will still be a lot of Loinc, Snomed, and RxNorm codes not included in the eCR package. Therefore I have written scripts to update the currently used CSVs, and moved that logic intoDibbs.FhirResolver. In addition I have added a CSV for Snomed.What is left for this PR
Bugs/Issues
In no particular order:
Dibbs.FhirResolverit requires an internet connection to retrieve the eCR FHIR package. To keep the converter usable in an offline state the_resolvershould be created usingZipSource, orDirectorySource. this would require that the package is downloaded either manually or as part of the build process.src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/BaseConvertDataFunctionalTests.ValidateConvertCCDAMessageIsValidFHIRshould likely be moved intoDibbs.FhirResolverto reduce duplication of logic.FhirResolver, however I then moved toConformanceManageras I think that is a more general term. But both "resolver" and "conformance" have specific meanings in the context of the Firely SDK, and in the FHIR ecosystem so neither of them may be appropriate.ConformanceServiceis async, but I am currently not taking advantage of that to keep things simple if development.ConformanceService.GetCodeSystemUrislaps an"urn:oid:"even when it is not an OID. I think it should be renamed toGetCodeSystemand the logic inGeneralFilters.PrependIDmoved into it. That way it becomes a general purpose function that replaces OIDs with URIs, appendsurn:...when needed, and returns the given string if it is not recognized as an OID, UUID, or URI.MakeCodeLibrarycould be expanded to look in them. Downloading additional packages may also be helpful.Dibbs.FhirResolver, and using scripts to generate the CSVs I would want to find a more integrated solution to reduce that manual overhead. But perhaps this is a good first step._Identifier.liquidtemplate appears to be broken. I believe it's because of the change from using_SystemReference.liquidtoGetSystemUri.Checklist
dibbs-ecr-viewerPR & checked that things work on the front-end.dibbs-ecr-viewer)dibbs-ecr-viewerPR is created and validated. When both have been approved:dibbs-fhir-converterdibbs-ecr-viewerwith the updated release branch number.