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

Add hand-written business rules from the Java Validator #266

Open
ewoutkramer opened this issue Jan 22, 2024 · 2 comments
Open

Add hand-written business rules from the Java Validator #266

ewoutkramer opened this issue Jan 22, 2024 · 2 comments

Comments

@ewoutkramer
Copy link
Member

This picture show (in purple) the lines that call the methods that contain all the hand-written validations in the Java validator.

java-validator-business-rules

We should be adding those to the validator and monitor newly added ones.

@ewoutkramer
Copy link
Member Author

Here's the relevant Java. As you can see, Grahame has combined the rules per type of resource in specialized validators. Some of them really complex (like the Bundle one), others (like Observation) much more simple. I'd say this is VERY useful to do, as this would bridge a lot of the gaps between the two validators. But also, as a rough estimate I think it would take about 20 days.

 if (element.getType().equals(BUNDLE)) {
        return new BundleValidator(this, serverBase).validateBundle(errors, element, stack, checkSpecials, valContext, pct, mode) && ok;
      } else if (element.getType().equals("Observation")) {
        return new ObservationValidator(this).validateObservation(valContext, errors, element, stack, pct, mode) && ok;
      } else if (element.getType().equals("Questionnaire")) {
        return new QuestionnaireValidator(this, myEnableWhenEvaluator, fpe, questionnaireMode).validateQuestionannaire(errors, element, element, stack) && ok;
      } else if (element.getType().equals("QuestionnaireResponse")) {
        return new QuestionnaireValidator(this, myEnableWhenEvaluator, fpe, questionnaireMode).validateQuestionannaireResponse(valContext, errors, element, stack) && ok;
      } else if (element.getType().equals("Measure")) {
        return new MeasureValidator(this).validateMeasure(valContext, errors, element, stack) && ok;      
      } else if (element.getType().equals("MeasureReport")) {
        return new MeasureValidator(this).validateMeasureReport(valContext, errors, element, stack) && ok;
      } else if (element.getType().equals("CapabilityStatement")) {
        return validateCapabilityStatement(errors, element, stack) && ok;
      } else if (element.getType().equals("CodeSystem")) {
        return new CodeSystemValidator(this).validateCodeSystem(errors, element, stack, baseOptions.withLanguage(stack.getWorkingLang())) && ok;
      } else if (element.getType().equals("ConceptMap")) {
        return new ConceptMapValidator(this).validateConceptMap(errors, element, stack, baseOptions.withLanguage(stack.getWorkingLang())) && ok;
      } else if (element.getType().equals("SearchParameter")) {
        return new SearchParameterValidator(this, fpe).validateSearchParameter(errors, element, stack) && ok;
      } else if (element.getType().equals("StructureDefinition")) {
        return new StructureDefinitionValidator(this, fpe, wantCheckSnapshotUnchanged).validateStructureDefinition(errors, element, stack) && ok;
      } else if (element.getType().equals("StructureMap")) {
        return new StructureMapValidator(this, fpe, profileUtilities).validateStructureMap(errors, element, stack) && ok;
      } else if (element.getType().equals("ValueSet")) {
        return new ValueSetValidator(this).validateValueSet(errors, element, stack) && ok;

@mmsmits mmsmits removed their assignment Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants