Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoSuchMethodError in Fhir validation #138

Open
Wambere opened this issue Feb 14, 2024 · 6 comments
Open

Fix NoSuchMethodError in Fhir validation #138

Wambere opened this issue Feb 14, 2024 · 6 comments
Labels
efsity FCT features

Comments

@Wambere
Copy link
Contributor

Wambere commented Feb 14, 2024

Fix the error below
source

EFSITY: :: INFO  :: ecbis_liberia/structure_map/json/child/child_immunization_record_all_follow_up.json
Error: Exception in thread "main" java.lang.NoSuchMethodError: 'org.hl7.fhir.utilities.xhtml.XhtmlParser org.hl7.fhir.utilities.xhtml.XhtmlParser.setValidatorMode(boolean)'
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildPrimitiveInstance(JsonParser.java:[35](https://github.com/onaio/fhir-resources/actions/runs/7897731649/job/21556230354?pr=3002#step:6:36)0)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildPrimitive(JsonParser.java:317)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildItem(JsonParser.java:220)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildren(JsonParser.java:194)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildComplexInstance(JsonParser.java:271)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildComplex(JsonParser.java:245)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildItem(JsonParser.java:222)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parseChildren(JsonParser.java:194)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parse(JsonParser.java:164)
	at org.hl7.fhir.r5.elementmodel.JsonParser.parse(JsonParser.java:126)
	at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:628)
	at org.hl7.fhir.common.hapi.validation.validator.ValidatorWrapper.validate(ValidatorWrapper.java:193)
	at org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator.validate(FhirInstanceValidator.java:238)
	at org.hl7.fhir.common.hapi.validation.validator.BaseValidatorBridge.doValidate(BaseValidatorBridge.java:22)
	at org.hl7.fhir.common.hapi.validation.validator.BaseValidatorBridge.validateResource(BaseValidatorBridge.java:48)
	at org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator.validateResource(FhirInstanceValidator.java:26)
	at ca.uhn.fhir.validation.FhirValidator.validateResource(FhirValidator.java:343)
	at ca.uhn.fhir.validation.FhirValidator.doValidate(FhirValidator.java:264)
	at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:252)
	at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:211)
	at org.smartregister.command.ValidateFhirResourcesCommand.validateResource(ValidateFhirResourcesCommand.java:122)
	at org.smartregister.command.ValidateFhirResourcesCommand.validateFhirResources(ValidateFhirResourcesCommand.java:86)
	at org.smartregister.command.ValidateFhirResourcesCommand.run(ValidateFhirResourcesCommand.java:49)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at org.smartregister.Main.main(Main.java:29)
Error: Process completed with exit code 1.
##[debug]Finishing: Run validation
@Wambere Wambere added the efsity FCT features label Feb 14, 2024
@Wambere
Copy link
Contributor Author

Wambere commented Feb 27, 2024

@dubdabasoduba it seems the validator is having an issue validating resources that have the text field with a div html value.

According to https://www.hl7.org/fhir/domainresource-definitions.html#DomainResource.text alternative names are narrative; html; xhtml; display.

If I replace text in the failing resources with any of the alternatives above, the validation works.

Can we work with this modification on the resources or must we use text ?

@dubdabasoduba
Copy link
Member

@Wambere when you say replace does this mean altering the resource itself?

@Wambere
Copy link
Contributor Author

Wambere commented Feb 29, 2024

@dubdabasoduba instead of

{
  "resourceType": "StructureMap",
  "text": {
    "status": "additional",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">...</div>"
  },
  "name": "ImmunizationCarePlan",
  ....
}

I switched it to

{
  "resourceType": "StructureMap",
  "narrative": {
    "status": "additional",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">...</div>"
  },
  "name": "ImmunizationCarePlan",
  ....
}

@dubdabasoduba
Copy link
Member

@Wambere as we discussed earlier we can update the validator to replace text with narrative during validation

@Wambere
Copy link
Contributor Author

Wambere commented Feb 29, 2024

@dubdabasoduba after thinking about how to go about this, I now think it makes more sense for the validator to "notify" the user that they need to make that change instead of itself trying to make that change, since this would involve making changes to a PR.
It could just print it as one of the other errors that the user needs to fix

@dubdabasoduba
Copy link
Member

@Wambere I was thinking of an inconsequential update, where the validator just changes it before validating and does not persist it in memory. Since the servers will most of the time return the resources with this property added.

If the data was copied from the server then it will have this data updated by the server or the resource generator on the tooling repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
efsity FCT features
Projects
None yet
Development

No branches or pull requests

2 participants