Open jorgealarco opened 1 year ago
Hi, I am also getting the same issue as mentioned by @jorgealarco I tried to validate Observation resource[https://build.fhir.org/observation-example-f001-glucose.json.html] as below. I used valuesets.json and other json files from: https://build.fhir.org/downloads.html as mentioned in readme.
// Read the content of the 'observation.json' file which contains json from above mentioned url
var observation = fs.readFileSync('./observation.json').toString();
async function main() {
// Get the data for new value sets, types, and resources from definitions.json
let newValueSets = JSON.parse(
fs
.readFileSync('/definitions.json/valuesets.json')
.toString()
);
let newTypes = JSON.parse(
fs
.readFileSync('/definitions.json/profiles-types.json')
.toString()
);
let newResources = JSON.parse(
fs
.readFileSync('/definitions.json/profiles-resources.json')
.toString()
);
// Create a parser instance with R4 FHIR version and load new definitions
let parser = new ParseConformance(true, FhirVersions.R4);
parser.parseBundle(newValueSets);
parser.parseBundle(newTypes);
parser.parseBundle(newResources);
// Create a Fhir instance using the parser
const v = new Fhir(parser);
// Validate the observation data using the Fhir instance
const result = v.validate(JSON.parse(observation));
// Output the validation result to the console
console.log('result', result);
}
// Call the main function to execute the logic
main();
Output:
result {
valid: true,
messages: [
{
location: 'Observation.code',
resourceId: 'f001',
severity: 'info',
message: 'Value set "http://hl7.org/fhir/ValueSet/observation-codes" could not be found.'
},
{
location: 'Observation.code',
resourceId: 'f001',
severity: 'warning',
message: 'Code "15074-8" (http://loinc.org) not found in value set'
},
{
location: 'Observation.interpretation[0]',
resourceId: 'f001',
severity: 'info',
message: 'Value set "http://hl7.org/fhir/ValueSet/observation-interpretation" could not be found.'
},
{
location: 'Observation.interpretation[0]',
resourceId: 'f001',
severity: 'warning',
message: 'Code "H" (http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation) not found in value set'
}
]
}
Since http://hl7.org/fhir/ValueSet/observation-codes is present in valuesets.json file downloaded from FHIR, I am getting this issue. On some investigation, found that this valueset has some dependent valuesets present in: compose>include of object(refer valuesets.json file), and these valuesets are not present as provided by FHIR.
Is this logic actually required? As I am getting this issue for multiple number of valuesets and each having multiple dependencies.
Also any idea why getting error: message: 'Code "15074-8" (http://loinc.org) not found in value set'
? As this is a valid code, refer: https://loinc.org/15074-8#:~:text=LOINC%2015074%2D8%20Glucose%20%5BMoles%2Fvolume%5D%20in%20Blood
Hi,
I am using the validator to create a bunch of unit tests for conformance with the UK Core IG. I am trying the custom loading for the StructureDefinitions, CodeSystems and ValueSets of the FHIR R4 plus the corresponding resources of the UK Core IG.
Despite of having loaded all the resources, I am still getting warnings when validating the resource. I decided to custom load the FHIR R4 resources instead of using the pre-loaded data of the
ParseConformance
constructor in case there was an issue with the default data. I made sure the ValueSets are loaded before the StructureDefinitions as well, but I am still getting:I wonder if this is related to the UK Core StructureDefinitions, as they don't contain a
snapshot
field. I am trying to create it using thefhir.generateSnapshot()
function on the bundle. However, when doing this, I get the following error:Cannot find base definition "http://hl7.org/fhir/StructureDefinition/Extension" in bundle or core FHIR specification.
Could you please help me identifying why I am still getting the warnings on the validation of the resource? This is code I came up with:
PS: Additionally, I believe there is an issue with the package exports, as I had to manually expose the SnapShotGenerator in the
index.js
file.Many thanks.