ValidateResource Example

The ValidateResource process validates a Patient FHIR resource, and provides an example of validation that has an Object, XML, or JSON input formats and Schema and Schematron, Structure Definition, and Strict Parser as validation types.

For more information about the FHIR palette Validate Resource activity, see Validate Resource.

ValidateResource Process

The ValidateResource process is illustrated here:

Process Definition

The process performs the following operations:
  1. The Timer activity starts the process.
  2. The ParsePatient activity parses the Patient resource, which is in XML format and creates a Patient object to be validated.
  3. The Patient object generated as the output of ParsePatient activity is provided as input to the ValidateObject activity. The Patient object is validated against SchemaAndSchematron validation type. The resource is validated; the validation result is true and no issue is detected.
  4. The parsed Patient resource is taken as input by the EncodeToXML activity and an XML output is returned.
  5. The XML output from EncodeToXML activity is passed as input to ValidateXML and is validated against the StrictParser validation type. The resource is validated; the validation result is true and no issue is detected.
  6. The output of EncodeToXML activity is passed as input to the ParseResource and a Patient object is generated as output.
  7. The output of ParseResource activity is passed as input by the EncodeToJSON activity and returns a JSON string as output.
  8. The output of EncodeToJSON activity is passed as input to the ValidateJSON activity with StructureDefinition as validation type. The resource is validated; the validation result is true and no issue is detected.
  9. Appointment resource is passed as input to the ValidateFailError activity and the resource is validated against SchemaAndSchematron type. Three schematron errors are detected and the validation status returns false.
  10. Appointment resource is passed as input to the ValidateFailWarn activity and the resource is validated against StructureDefinition type. There is one warning detected, and the validation status returns true.
  11. An XML string which doesn't include a FHIR resource is input to encodedValue of ValidateResource activity, and validated against the StrictParser type. The validation status returns false and the fatal error is output in OperationOutcome issues list.
  12. After the process executes successfully, a Success message is written to the Console. Select Window > Show Console in TIBCO Business Studio to view the log messages.

Process Output

Select the desired activity and click the Output tab.

  • The ValidateObject activity output displays an example of a validation with no errors:

    Note: The presence of the word true in the output means that the input provided is correct, and no errors are present.
  • The ValidateJSON activity output displays an example of validation with info level issues:

  • The ValidateFailError activity output displays an example of validation where an error occurs.

  • The ValidateFailWarn activity output displays an example of validation with a warning.

  • The ValidateFatalError activity output displays an example of a fatal error.

For fatal level issues, the OperationOutcome is populated on the Output tab.