diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/dstu3/PlanDefinitionProcessor.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/dstu3/PlanDefinitionProcessor.java index 4548d4e76..0d6ca123b 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/dstu3/PlanDefinitionProcessor.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/dstu3/PlanDefinitionProcessor.java @@ -22,7 +22,6 @@ import org.hl7.fhir.dstu3.model.Goal; import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.Library; -import org.hl7.fhir.dstu3.model.Meta; import org.hl7.fhir.dstu3.model.MetadataResource; import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Parameters; @@ -197,7 +196,7 @@ public IBaseResource applyPlanDefinition(PlanDefinition planDefinition) { .setSubject(new Reference(subjectId)); requestGroup.setId(new IdType( requestGroup.fhirType(), planDefinition.getIdElement().getIdPart())); - requestGroup.setMeta(new Meta().addProfile(Constants.CPG_STRATEGY)); + // requestGroup.setMeta(new Meta().addProfile(Constants.CPG_STRATEGY)); if (encounterId != null) { requestGroup.setContext(new Reference(encounterId)); } @@ -384,7 +383,7 @@ private RequestGroupActionComponent resolveAction( } IBaseResource resource = null; if (action.hasDefinition()) { - resource = resolveDefinition(planDefinition, requestGroup, action); + resource = resolveDefinition(planDefinition, action); if (resource != null) { applyAction(requestGroup, resource, action); requestAction.setResource(new Reference(resource.getIdElement())); @@ -439,15 +438,13 @@ private RequestGroupActionComponent createRequestAction(PlanDefinitionActionComp } private IBaseResource resolveDefinition( - PlanDefinition planDefinition, - RequestGroup requestGroup, - PlanDefinition.PlanDefinitionActionComponent action) { + PlanDefinition planDefinition, PlanDefinition.PlanDefinitionActionComponent action) { logger.debug("Resolving definition {}", action.getDefinition().getReference()); var definition = new StringType(action.getDefinition().getReference()); var resourceName = resolveResourceName(definition, planDefinition); switch (FHIRAllTypes.fromCode(requireNonNull(resourceName))) { case PLANDEFINITION: - return applyNestedPlanDefinition(requestGroup, definition); + return applyNestedPlanDefinition(planDefinition, definition); case ACTIVITYDEFINITION: return applyActivityDefinition(planDefinition, definition); case QUESTIONNAIRE: @@ -517,14 +514,15 @@ private IBaseResource applyActivityDefinition(PlanDefinition planDefinition, Str return result; } - private IBaseResource applyNestedPlanDefinition(RequestGroup requestGroup, StringType definition) { + private IBaseResource applyNestedPlanDefinition(PlanDefinition planDefinition, StringType definition) { RequestGroup result = null; try { - var planDefinition = (PlanDefinition) SearchHelper.searchRepositoryByCanonical(repository, definition); - result = (RequestGroup) applyPlanDefinition(planDefinition); - for (var c : result.getDefinition()) { - requestGroup.addDefinition(c); - } + var referenceToContained = definition.getValue().startsWith("#"); + var nextPlanDefinition = (PlanDefinition) + (referenceToContained + ? resolveContained(planDefinition, definition.getValue()) + : SearchHelper.searchRepositoryByCanonical(repository, definition)); + result = (RequestGroup) applyPlanDefinition(nextPlanDefinition); } catch (Exception e) { var message = String.format( "ERROR: PlanDefinition %s could not be applied and threw exception %s", diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r4/PlanDefinitionProcessor.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r4/PlanDefinitionProcessor.java index 56b44cc36..9f4506908 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r4/PlanDefinitionProcessor.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r4/PlanDefinitionProcessor.java @@ -30,7 +30,6 @@ import org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Library; -import org.hl7.fhir.r4.model.Meta; import org.hl7.fhir.r4.model.MetadataResource; import org.hl7.fhir.r4.model.OperationOutcome; import org.hl7.fhir.r4.model.Parameters; @@ -202,7 +201,7 @@ public IBaseResource applyPlanDefinition(PlanDefinition planDefinition) { .setSubject(new Reference(subjectId)); requestGroup.setId(new IdType( requestGroup.fhirType(), planDefinition.getIdElement().getIdPart())); - requestGroup.setMeta(new Meta().addProfile(Constants.CPG_STRATEGY)); + // requestGroup.setMeta(new Meta().addProfile(Constants.CPG_STRATEGY)); if (encounterId != null) { requestGroup.setEncounter(new Reference(encounterId)); } @@ -240,7 +239,8 @@ public IBaseResource applyPlanDefinition(PlanDefinition planDefinition) { .setUrl(Constants.PERTAINS_TO_GOAL) .setValue(new Reference(goal.getIdElement())); } - // Always add goals to the resource list so they can be added to the CarePlan if needed + // Always add goals to the resource list so they can be added to the CarePlan if + // needed requestResources.add(goal); } @@ -386,7 +386,8 @@ private RequestGroupActionComponent resolveAction( // TODO: Figure out why this was here and what it was trying to do // if (action.hasRelatedAction()) { // for (var relatedActionComponent : action.getRelatedAction()) { - // if (relatedActionComponent.getRelationship().equals(ActionRelationshipType.AFTER) + // if + // (relatedActionComponent.getRelationship().equals(ActionRelationshipType.AFTER) // && metConditions.containsKey(relatedActionComponent.getActionId())) { // metConditions.put(action.getId(), action); // resolveDefinition(planDefinition, requestGroup, action); @@ -405,7 +406,7 @@ private RequestGroupActionComponent resolveAction( } IBaseResource resource = null; if (action.hasDefinitionCanonicalType()) { - resource = resolveDefinition(planDefinition, requestGroup, action); + resource = resolveDefinition(planDefinition, action); if (resource != null) { applyAction(requestGroup, resource, action); requestAction.setResource(new Reference(resource.getIdElement())); @@ -469,16 +470,14 @@ private RequestGroupActionComponent createRequestAction(PlanDefinitionActionComp } private IBaseResource resolveDefinition( - PlanDefinition planDefinition, - RequestGroup requestGroup, - PlanDefinition.PlanDefinitionActionComponent action) { + PlanDefinition planDefinition, PlanDefinition.PlanDefinitionActionComponent action) { logger.debug( "Resolving definition {}", action.getDefinitionCanonicalType().getValue()); var definition = action.getDefinitionCanonicalType(); var resourceName = resolveResourceName(definition, planDefinition); switch (FHIRAllTypes.fromCode(requireNonNull(resourceName))) { case PLANDEFINITION: - return applyNestedPlanDefinition(requestGroup, definition); + return applyNestedPlanDefinition(planDefinition, definition); case ACTIVITYDEFINITION: return applyActivityDefinition(planDefinition, definition); case QUESTIONNAIRE: @@ -548,15 +547,15 @@ private IBaseResource applyActivityDefinition(PlanDefinition planDefinition, Can return result; } - private IBaseResource applyNestedPlanDefinition(RequestGroup requestGroup, CanonicalType definition) { + private IBaseResource applyNestedPlanDefinition(PlanDefinition planDefinition, CanonicalType definition) { RequestGroup result = null; try { - var planDefinition = (PlanDefinition) SearchHelper.searchRepositoryByCanonical(repository, definition); - result = (RequestGroup) applyPlanDefinition(planDefinition); - - for (var c : result.getInstantiatesCanonical()) { - requestGroup.addInstantiatesCanonical(c.getValueAsString()); - } + var referenceToContained = definition.getValue().startsWith("#"); + var nextPlanDefinition = (PlanDefinition) + (referenceToContained + ? resolveContained(planDefinition, definition.getValue()) + : SearchHelper.searchRepositoryByCanonical(repository, definition)); + result = (RequestGroup) applyPlanDefinition(nextPlanDefinition); } catch (Exception e) { var message = String.format( "ERROR: PlanDefinition %s could not be applied and threw exception %s", @@ -576,7 +575,8 @@ private void applyAction( } /* - * offset -> Duration timing -> Timing ( just our use case for connectathon period periodUnit + * offset -> Duration timing -> Timing ( just our use case for connectathon + * period periodUnit * frequency count ) use task code */ private void resolveTask( @@ -641,7 +641,8 @@ private void resolvePrepopulateAction( for (var questionnaireBundle : questionnaireBundles) { var toPopulate = (Questionnaire) questionnaireBundle.getEntryFirstRep().getResource(); - // Bundle should contain a Questionnaire and supporting Library and ValueSet resources + // Bundle should contain a Questionnaire and supporting Library and ValueSet + // resources var libraries = questionnaireBundle.getEntry().stream() .filter(e -> e.hasResource() && (e.getResource().fhirType().equals(Enumerations.FHIRAllTypes.LIBRARY.toCode()))) @@ -675,7 +676,8 @@ private void resolvePrepopulateAction( private List getQuestionnairePackage(Extension prepopulateExtension) { Bundle bundle = null; - // PlanDef action should provide endpoint for $questionnaire-for-order operation as well as + // PlanDef action should provide endpoint for $questionnaire-for-order operation + // as well as // the order id to pass var parameterExtension = prepopulateExtension.getExtensionByUrl(Constants.SDC_QUESTIONNAIRE_PREPOPULATE_PARAMETER); @@ -705,7 +707,8 @@ private List getQuestionnairePackage(Extension prepopulateExtension) { bundle = new Bundle().addEntry(new Bundle.BundleEntryComponent().setResource(questionnaire)); } } else if (questionnaireExtension.getValue().hasType(FHIRAllTypes.URL.toCode())) { - // Assuming package operation endpoint if the extension is using valueUrl instead of + // Assuming package operation endpoint if the extension is using valueUrl + // instead of // valueCanonical bundle = callQuestionnairePackageOperation(((UrlType) questionnaireExtension.getValue()).getValueAsString()); @@ -734,7 +737,8 @@ private Bundle callQuestionnairePackageOperation(String url) { IGenericClient client = Clients.forUrl(repository.fhirContext(), baseUrl); // Clients.registerBasicAuth(client, user, password); try { - // TODO: This is not currently in use, but if it ever is we will need to determine how the + // TODO: This is not currently in use, but if it ever is we will need to + // determine how the // order and coverage resources are passed in Type order = null; Type coverage = null; diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r5/PlanDefinitionProcessor.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r5/PlanDefinitionProcessor.java index b1b41d063..0168f8e40 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r5/PlanDefinitionProcessor.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/plandefinition/r5/PlanDefinitionProcessor.java @@ -37,7 +37,6 @@ import org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus; import org.hl7.fhir.r5.model.IdType; import org.hl7.fhir.r5.model.Library; -import org.hl7.fhir.r5.model.Meta; import org.hl7.fhir.r5.model.MetadataResource; import org.hl7.fhir.r5.model.OperationOutcome; import org.hl7.fhir.r5.model.Parameters; @@ -205,7 +204,7 @@ public IBaseResource applyPlanDefinition(PlanDefinition planDefinition) { .setSubject(new Reference(subjectId)); requestOrchestration.setId(new IdType( requestOrchestration.fhirType(), planDefinition.getIdElement().getIdPart())); - requestOrchestration.setMeta(new Meta().addProfile(Constants.CPG_STRATEGY)); + // requestOrchestration.setMeta(new Meta().addProfile(Constants.CPG_STRATEGY)); if (encounterId != null) { requestOrchestration.setEncounter(new Reference(encounterId)); } @@ -356,7 +355,7 @@ private RequestOrchestrationActionComponent resolveAction( } IBaseResource resource = null; if (action.hasDefinitionCanonicalType()) { - resource = resolveDefinition(planDefinition, requestOrchestration, action); + resource = resolveDefinition(planDefinition, action); if (resource != null) { applyAction(requestOrchestration, resource, action); requestAction.setResource(new Reference(resource.getIdElement())); @@ -417,16 +416,14 @@ private RequestOrchestrationActionComponent createRequestAction(PlanDefinitionAc } private IBaseResource resolveDefinition( - PlanDefinition planDefinition, - RequestOrchestration requestOrchestration, - PlanDefinition.PlanDefinitionActionComponent action) { + PlanDefinition planDefinition, PlanDefinition.PlanDefinitionActionComponent action) { logger.debug( "Resolving definition {}", action.getDefinitionCanonicalType().getValue()); var definition = action.getDefinitionCanonicalType(); var resourceName = resolveResourceName(definition, planDefinition); switch (FHIRTypes.fromCode(requireNonNull(resourceName))) { case PLANDEFINITION: - return applyNestedPlanDefinition(requestOrchestration, definition); + return applyNestedPlanDefinition(planDefinition, definition); case ACTIVITYDEFINITION: return applyActivityDefinition(planDefinition, definition); case QUESTIONNAIRE: @@ -496,16 +493,15 @@ private IBaseResource applyActivityDefinition(PlanDefinition planDefinition, Can return result; } - private IBaseResource applyNestedPlanDefinition( - RequestOrchestration requestOrchestration, CanonicalType definition) { + private IBaseResource applyNestedPlanDefinition(PlanDefinition planDefinition, CanonicalType definition) { RequestOrchestration result = null; try { - var planDefinition = (PlanDefinition) SearchHelper.searchRepositoryByCanonical(repository, definition); - result = (RequestOrchestration) applyPlanDefinition(planDefinition); - - for (var c : result.getInstantiatesCanonical()) { - requestOrchestration.addInstantiatesCanonical(c.getValueAsString()); - } + var referenceToContained = definition.getValue().startsWith("#"); + var nextPlanDefinition = (PlanDefinition) + (referenceToContained + ? resolveContained(planDefinition, definition.getValue()) + : SearchHelper.searchRepositoryByCanonical(repository, definition)); + result = (RequestOrchestration) applyPlanDefinition(nextPlanDefinition); } catch (Exception e) { var message = String.format( "ERROR: PlanDefinition %s could not be applied and threw exception %s", diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/QuestionnaireResponseProcessor.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/QuestionnaireResponseProcessor.java index 93b574684..d600c7611 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/QuestionnaireResponseProcessor.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/QuestionnaireResponseProcessor.java @@ -3,6 +3,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -13,10 +14,12 @@ import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.DateTimeType; import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DomainResource; import org.hl7.fhir.dstu3.model.Enumerations.FHIRAllTypes; import org.hl7.fhir.dstu3.model.Extension; import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.InstantType; +import org.hl7.fhir.dstu3.model.Meta; import org.hl7.fhir.dstu3.model.Observation; import org.hl7.fhir.dstu3.model.Property; import org.hl7.fhir.dstu3.model.Questionnaire; @@ -160,6 +163,34 @@ private Property getSubjectProperty(Resource resource) { return property; } + private Property getAuthorProperty(Resource resource) { + var property = resource.getNamedProperty("recorder"); + if (property == null && resource.fhirType().equals(FHIRAllTypes.OBSERVATION.toCode())) { + property = resource.getNamedProperty("performer"); + } + + return property; + } + + private List getDateProperties(Resource resource) { + List results = new ArrayList<>(); + results.add(resource.getNamedProperty("onset")); + results.add(resource.getNamedProperty("issued")); + results.add(resource.getNamedProperty("effective")); + results.add(resource.getNamedProperty("recordDate")); + + return results.stream().filter(p -> p != null).collect(Collectors.toList()); + } + + private void resolveMeta(DomainResource resource, String definition) { + var meta = new Meta(); + // Consider setting source and lastUpdated here? + if (definition != null && !definition.isEmpty()) { + meta.addProfile(definition.split("#")[0]); + resource.setMeta(meta); + } + } + private String getDefinitionType(String definition) { return definition.split("#")[1]; } @@ -174,26 +205,51 @@ private void processDefinitionItem( var resourceType = getDefinitionType(item.getDefinition()); var resource = (Resource) newValue(resourceType); - resource.setId(new IdType(resourceType, getExtractId(questionnaireResponse) + "." + item.getLinkId())); + resource.setId(new IdType(resourceType, getExtractId(questionnaireResponse) + "-" + item.getLinkId())); + resolveMeta((DomainResource) resource, item.getDefinition()); var subjectProperty = getSubjectProperty(resource); if (subjectProperty != null) { resource.setProperty(subjectProperty.getName(), subject); } + var authorProperty = getAuthorProperty(resource); + if (authorProperty != null && questionnaireResponse.hasAuthor()) { + resource.setProperty(authorProperty.getName(), questionnaireResponse.getAuthor()); + } + var dateProperties = getDateProperties(resource); + if (dateProperties != null && !dateProperties.isEmpty() && questionnaireResponse.hasAuthored()) { + dateProperties.forEach(p -> { + try { + var propertyDef = fhirContext() + .getElementDefinition( + p.getTypeCode().contains("|") + ? p.getTypeCode().split("\\|")[0] + : p.getTypeCode()); + if (propertyDef != null) { + modelResolver.setValue( + resource, + p.getName(), + propertyDef + .getImplementingClass() + .getConstructor(Date.class) + .newInstance(questionnaireResponse.getAuthored())); + } + } catch (Exception ex) { + var message = String.format( + "Error encountered attempting to set property (%s) on resource type (%s): %s", + p.getName(), resource.fhirType(), ex.getMessage()); + logger.error(message); + } + }); + } item.getItem().forEach(childItem -> { if (childItem.hasDefinition()) { var definition = childItem.getDefinition().split("#"); var path = definition[1]; // First element is always the resource type, so it can be ignored path = path.replace(resourceType + ".", ""); - // var property = modelResolver.resolvePath(resource, path); var answerValue = childItem.getAnswerFirstRep().getValue(); - // transformAnswerValue(childItem.getAnswerFirstRep().getValue(), ""); if (answerValue != null) { - // if (path.contains(".")) { - // nestedValueResolver.setNestedValue(resource, path, answerValue); - // } else { modelResolver.setValue(resource, path, answerValue); - // } } } }); @@ -301,7 +357,8 @@ private Observation createObservationFromItemAnswer( // String url = mySdcProperties.getExtract().getEndpoint(); // if (null == url || url.length() < 1) { // throw new IllegalArgumentException( - // "Unable to transmit observation bundle. No observation.endpoint defined in sdc properties."); + // "Unable to transmit observation bundle. No observation.endpoint defined in + // sdc properties."); // } // String user = mySdcProperties.getExtract().getUsername(); // String password = mySdcProperties.getExtract().getPassword(); diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/QuestionnaireResponseProcessor.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/QuestionnaireResponseProcessor.java index 925bedd28..327855e1a 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/QuestionnaireResponseProcessor.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/QuestionnaireResponseProcessor.java @@ -3,6 +3,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -18,11 +19,13 @@ import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.DateTimeType; import org.hl7.fhir.r4.model.DateType; +import org.hl7.fhir.r4.model.DomainResource; import org.hl7.fhir.r4.model.Enumerations.FHIRAllTypes; import org.hl7.fhir.r4.model.Expression; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.InstantType; +import org.hl7.fhir.r4.model.Meta; import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Property; import org.hl7.fhir.r4.model.Questionnaire; @@ -164,6 +167,34 @@ private Property getSubjectProperty(Resource resource) { return property; } + private Property getAuthorProperty(Resource resource) { + var property = resource.getNamedProperty("recorder"); + if (property == null && resource.fhirType().equals(FHIRAllTypes.OBSERVATION.toCode())) { + property = resource.getNamedProperty("performer"); + } + + return property; + } + + private List getDateProperties(Resource resource) { + List results = new ArrayList<>(); + results.add(resource.getNamedProperty("onset")); + results.add(resource.getNamedProperty("issued")); + results.add(resource.getNamedProperty("effective")); + results.add(resource.getNamedProperty("recordDate")); + + return results.stream().filter(p -> p != null).collect(Collectors.toList()); + } + + private void resolveMeta(DomainResource resource, String definition) { + var meta = new Meta(); + // Consider setting source and lastUpdated here? + if (definition != null && !definition.isEmpty()) { + meta.addProfile(definition.split("#")[0]); + resource.setMeta(meta); + } + } + private List getExpressionResult(Expression expression, String itemLinkId) { if (expression == null || expression.getExpression().isEmpty()) { return null; @@ -210,11 +241,42 @@ private void processDefinitionItem( var resourceType = getDefinitionType(item.getDefinition()); var resource = (Resource) newValue(resourceType); - resource.setId(new IdType(resourceType, getExtractId(questionnaireResponse) + "." + item.getLinkId())); + resource.setId(new IdType(resourceType, getExtractId(questionnaireResponse) + "-" + item.getLinkId())); + resolveMeta((DomainResource) resource, item.getDefinition()); var subjectProperty = getSubjectProperty(resource); if (subjectProperty != null) { resource.setProperty(subjectProperty.getName(), subject); } + var authorProperty = getAuthorProperty(resource); + if (authorProperty != null && questionnaireResponse.hasAuthor()) { + resource.setProperty(authorProperty.getName(), questionnaireResponse.getAuthor()); + } + var dateProperties = getDateProperties(resource); + if (dateProperties != null && !dateProperties.isEmpty() && questionnaireResponse.hasAuthored()) { + dateProperties.forEach(p -> { + try { + var propertyDef = fhirContext() + .getElementDefinition( + p.getTypeCode().contains("|") + ? p.getTypeCode().split("\\|")[0] + : p.getTypeCode()); + if (propertyDef != null) { + modelResolver.setValue( + resource, + p.getName(), + propertyDef + .getImplementingClass() + .getConstructor(Date.class) + .newInstance(questionnaireResponse.getAuthored())); + } + } catch (Exception ex) { + var message = String.format( + "Error encountered attempting to set property (%s) on resource type (%s): %s", + p.getName(), resource.fhirType(), ex.getMessage()); + logger.error(message); + } + }); + } item.getItem().forEach(childItem -> { if (childItem.hasDefinition()) { var definition = childItem.getDefinition().split("#"); @@ -223,11 +285,7 @@ private void processDefinitionItem( path = path.replace(resourceType + ".", ""); var answerValue = childItem.getAnswerFirstRep().getValue(); if (answerValue != null) { - // if (path.contains(".")) { - // nestedValueResolver.setNestedValue(resource, path, answerValue); - // } else { modelResolver.setValue(resource, path, answerValue); - // } } } }); @@ -331,7 +389,8 @@ private Observation createObservationFromItemAnswer( // String url = mySdcProperties.getExtract().getEndpoint(); // if (null == url || url.length() < 1) { // throw new IllegalArgumentException( - // "Unable to transmit observation bundle. No observation.endpoint defined in sdc properties."); + // "Unable to transmit observation bundle. No observation.endpoint defined in + // sdc properties."); // } // String user = mySdcProperties.getExtract().getUsername(); // String password = mySdcProperties.getExtract().getPassword(); diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/QuestionnaireResponseProcessor.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/QuestionnaireResponseProcessor.java index 0e48c5c97..c91ba8b0e 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/QuestionnaireResponseProcessor.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/QuestionnaireResponseProcessor.java @@ -3,6 +3,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -18,12 +19,14 @@ import org.hl7.fhir.r5.model.Coding; import org.hl7.fhir.r5.model.DateTimeType; import org.hl7.fhir.r5.model.DateType; +import org.hl7.fhir.r5.model.DomainResource; import org.hl7.fhir.r5.model.Enumerations.FHIRTypes; import org.hl7.fhir.r5.model.Enumerations.ObservationStatus; import org.hl7.fhir.r5.model.Expression; import org.hl7.fhir.r5.model.Extension; import org.hl7.fhir.r5.model.IdType; import org.hl7.fhir.r5.model.InstantType; +import org.hl7.fhir.r5.model.Meta; import org.hl7.fhir.r5.model.Observation; import org.hl7.fhir.r5.model.Property; import org.hl7.fhir.r5.model.Questionnaire; @@ -165,6 +168,34 @@ private Property getSubjectProperty(Resource resource) { return property; } + private Property getAuthorProperty(Resource resource) { + var property = resource.getNamedProperty("recorder"); + if (property == null && resource.fhirType().equals(FHIRTypes.OBSERVATION.toCode())) { + property = resource.getNamedProperty("performer"); + } + + return property; + } + + private List getDateProperties(Resource resource) { + List results = new ArrayList<>(); + results.add(resource.getNamedProperty("onset")); + results.add(resource.getNamedProperty("issued")); + results.add(resource.getNamedProperty("effective")); + results.add(resource.getNamedProperty("recordDate")); + + return results.stream().filter(p -> p != null).collect(Collectors.toList()); + } + + private void resolveMeta(DomainResource resource, String definition) { + var meta = new Meta(); + // Consider setting source and lastUpdated here? + if (definition != null && !definition.isEmpty()) { + meta.addProfile(definition.split("#")[0]); + resource.setMeta(meta); + } + } + private List getExpressionResult(Expression expression, String itemLinkId) { if (expression == null || expression.getExpression().isEmpty()) { return null; @@ -207,11 +238,42 @@ private void processDefinitionItem( var resourceType = getDefinitionType(item.getDefinition()); var resource = (Resource) newValue(resourceType); - resource.setId(new IdType(resourceType, getExtractId(questionnaireResponse) + "." + item.getLinkId())); + resource.setId(new IdType(resourceType, getExtractId(questionnaireResponse) + "-" + item.getLinkId())); + resolveMeta((DomainResource) resource, item.getDefinition()); var subjectProperty = getSubjectProperty(resource); if (subjectProperty != null) { resource.setProperty(subjectProperty.getName(), subject); } + var authorProperty = getAuthorProperty(resource); + if (authorProperty != null && questionnaireResponse.hasAuthor()) { + resource.setProperty(authorProperty.getName(), questionnaireResponse.getAuthor()); + } + var dateProperties = getDateProperties(resource); + if (dateProperties != null && !dateProperties.isEmpty() && questionnaireResponse.hasAuthored()) { + dateProperties.forEach(p -> { + try { + var propertyDef = fhirContext() + .getElementDefinition( + p.getTypeCode().contains("|") + ? p.getTypeCode().split("\\|")[0] + : p.getTypeCode()); + if (propertyDef != null) { + modelResolver.setValue( + resource, + p.getName(), + propertyDef + .getImplementingClass() + .getConstructor(Date.class) + .newInstance(questionnaireResponse.getAuthored())); + } + } catch (Exception ex) { + var message = String.format( + "Error encountered attempting to set property (%s) on resource type (%s): %s", + p.getName(), resource.fhirType(), ex.getMessage()); + logger.error(message); + } + }); + } item.getItem().forEach(childItem -> { if (childItem.hasDefinition()) { var definition = childItem.getDefinition().split("#"); @@ -220,11 +282,7 @@ private void processDefinitionItem( path = path.replace(resourceType + ".", ""); var answerValue = childItem.getAnswerFirstRep().getValue(); if (answerValue != null) { - // if (path.contains(".")) { - // nestedValueResolver.setNestedValue(resource, path, answerValue); - // } else { modelResolver.setValue(resource, path, answerValue); - // } } } }); @@ -328,7 +386,8 @@ private Observation createObservationFromItemAnswer( // String url = mySdcProperties.getExtract().getEndpoint(); // if (null == url || url.length() < 1) { // throw new IllegalArgumentException( - // "Unable to transmit observation bundle. No observation.endpoint defined in sdc properties."); + // "Unable to transmit observation bundle. No observation.endpoint defined in + // sdc properties."); // } // String user = mySdcProperties.getExtract().getUsername(); // String password = mySdcProperties.getExtract().getPassword(); diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/child-routine-visit/child_routine_visit_careplan.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/child-routine-visit/child_routine_visit_careplan.json index a68f5accd..43183277f 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/child-routine-visit/child_routine_visit_careplan.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/child-routine-visit/child_routine_visit_careplan.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "ChildRoutineVisit-PlanDefinition-1.0.0", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "definition": [ { "reference": "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/ChildRoutineVisit-PlanDefinition-1.0.0" diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/extract-questionnaireresponse/careplan.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/extract-questionnaireresponse/careplan.json index c1830c59b..b939c8944 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/extract-questionnaireresponse/careplan.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/extract-questionnaireresponse/careplan.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "prepopulate", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "definition": [ { "reference": "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/prepopulate|1.0.0" diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/hello-world/hello-world-careplan.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/hello-world/hello-world-careplan.json index abacfeb49..20a0ac80a 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/hello-world/hello-world-careplan.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/dstu3/hello-world/hello-world-careplan.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "hello-world-patient-view", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "definition": [ { "reference": "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/hello-world-patient-view|1.0.0" diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/output-careplan.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/output-careplan.json index fe1a08b49..07e2f0b9e 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/output-careplan.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/output-careplan.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "ANCDT17", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/who/anc-cds/PlanDefinition/ANCDT17" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/Bundle-ANCDT17.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/Bundle-ANCDT17.json index ab179e7f1..bfdcb4ab5 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/Bundle-ANCDT17.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/Bundle-ANCDT17.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestGroup", "id": "ANCDT17", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/who/anc-cds/PlanDefinition/ANCDT17" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/CarePlan-ANCDT17.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/CarePlan-ANCDT17.json index e76cd7748..5c7729c26 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/CarePlan-ANCDT17.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-dak/tests/CarePlan-ANCDT17.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "ANCDT17", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/who/anc-cds/PlanDefinition/ANCDT17" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_bundle.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_bundle.json index f53bc347c..caac665df 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_bundle.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_bundle.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestGroup", "id": "AncVisit-PlanDefinition", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/resource-pertainsToGoal", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_careplan.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_careplan.json index 3515f1cf6..efad1f376 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_careplan.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/anc-visit/anc_visit_careplan.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "AncVisit-PlanDefinition", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/AncVisit-PlanDefinition" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_bundle.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_bundle.json index 26bb82b29..55cbe5294 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_bundle.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_bundle.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestGroup", "id": "CdsHooksMultipleActions-PlanDefinition-1.0.0", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://example.com/PlanDefinition/CdsHooksMultipleActions-PlanDefinition-1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_careplan.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_careplan.json index b39f0dda9..618cf8894 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_careplan.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/cds-hooks-multiple-actions/cds_hooks_multiple_actions_careplan.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "CdsHooksMultipleActions-PlanDefinition-1.0.0", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://example.com/PlanDefinition/CdsHooksMultipleActions-PlanDefinition-1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_bundle.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_bundle.json index ee3988807..6a49c54f3 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_bundle.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_bundle.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestGroup", "id": "ChildRoutineVisit-PlanDefinition-1.0.0", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/resource-pertainsToGoal", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_careplan.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_careplan.json index 4058aaec6..89963b7b7 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_careplan.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/child-routine-visit/child_routine_visit_careplan.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "ChildRoutineVisit-PlanDefinition-1.0.0", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/ChildRoutineVisit-PlanDefinition-1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/Bundle-opioidcds-10-patient-view.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/Bundle-opioidcds-10-patient-view.json index b4bc9a7d1..8959d8358 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/Bundle-opioidcds-10-patient-view.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/Bundle-opioidcds-10-patient-view.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestGroup", "id": "opioidcds-10-patient-view", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "contained": [ { "resourceType": "OperationOutcome", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/CarePlan-opioidcds-10-patient-view.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/CarePlan-opioidcds-10-patient-view.json index ded7baf85..9c32bd074 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/CarePlan-opioidcds-10-patient-view.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/opioid-Rec10-patient-view/tests/CarePlan-opioidcds-10-patient-view.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "opioidcds-10-patient-view", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "extension": [ { "url": "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-messages", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-generate-questionnaire.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-generate-questionnaire.json index 6aee06e93..ee2a18916 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-generate-questionnaire.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-generate-questionnaire.json @@ -7,14 +7,8 @@ "resource": { "resourceType": "RequestGroup", "id": "generate-questionnaire", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire|1.0.0", - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/route-one|1.0.0" + "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire|1.0.0" ], "status": "draft", "intent": "proposal", @@ -44,11 +38,6 @@ "resource": { "resourceType": "RequestGroup", "id": "route-one", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/route-one|1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-hello-world-patient-view.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-hello-world-patient-view.json index 4a8f5b62c..7876cd89b 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-hello-world-patient-view.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-hello-world-patient-view.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestGroup", "id": "hello-world-patient-view", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/hello-world-patient-view|1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-prepopulate.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-prepopulate.json index 066bc91bf..9e9f376af 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-prepopulate.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/Bundle-prepopulate.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestGroup", "id": "prepopulate", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/prepopulate|1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-generate-questionnaire.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-generate-questionnaire.json index 88b914f63..240097cc7 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-generate-questionnaire.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-generate-questionnaire.json @@ -5,14 +5,8 @@ { "resourceType": "RequestGroup", "id": "generate-questionnaire", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire|1.0.0", - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/route-one|1.0.0" + "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire|1.0.0" ], "status": "draft", "intent": "proposal", @@ -439,11 +433,6 @@ { "resourceType": "RequestGroup", "id": "route-one", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/route-one|1.0.0" ], @@ -469,8 +458,7 @@ } ], "instantiatesCanonical": [ - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire|1.0.0", - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/route-one|1.0.0" + "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire|1.0.0" ], "status": "draft", "intent": "proposal", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-hello-world-patient-view.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-hello-world-patient-view.json index b26234217..545d4419f 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-hello-world-patient-view.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-hello-world-patient-view.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "hello-world-patient-view", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/hello-world-patient-view|1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-prepopulate.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-prepopulate.json index b55be97f4..d6320cb55 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-prepopulate.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r4/tests/CarePlan-prepopulate.json @@ -5,11 +5,6 @@ { "resourceType": "RequestGroup", "id": "prepopulate", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/prepopulate|1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/child-routine-visit/child_routine_visit_bundle.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/child-routine-visit/child_routine_visit_bundle.json index 36c18b1fb..b27fa6c91 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/child-routine-visit/child_routine_visit_bundle.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/child-routine-visit/child_routine_visit_bundle.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestOrchestration", "id": "ChildRoutineVisit-PlanDefinition-1.0.0", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/resource-pertainsToGoal", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/extract-questionnaireresponse/bundle.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/extract-questionnaireresponse/bundle.json index 7b9666287..74a19767c 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/extract-questionnaireresponse/bundle.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/extract-questionnaireresponse/bundle.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestOrchestration", "id": "prepopulate", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "instantiatesCanonical": [ "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/prepopulate|1.0.0" ], diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/hello-world/hello-world-bundle.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/hello-world/hello-world-bundle.json index edf41809c..2972896ed 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/hello-world/hello-world-bundle.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/hello-world/hello-world-bundle.json @@ -7,11 +7,6 @@ "resource": { "resourceType": "RequestOrchestration", "id": "hello-world-patient-view", - "meta": { - "profile": [ - "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-strategy" - ] - }, "contained": [ { "resourceType": "OperationOutcome", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/tests/Bundle-generate-questionnaire.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/tests/Bundle-generate-questionnaire.json index 006dd7467..1567a2d3e 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/tests/Bundle-generate-questionnaire.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/plandefinition/r5/tests/Bundle-generate-questionnaire.json @@ -8,8 +8,7 @@ "resourceType": "RequestOrchestration", "id": "generate-questionnaire", "instantiatesCanonical": [ - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire", - "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/route-one" + "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/generate-questionnaire" ], "status": "draft", "intent": "proposal", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/tests/Bundle-OutpatientPriorAuthorizationRequest.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/tests/Bundle-OutpatientPriorAuthorizationRequest.json index 78f24e4d8..8054c6153 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/tests/Bundle-OutpatientPriorAuthorizationRequest.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/dstu3/tests/Bundle-OutpatientPriorAuthorizationRequest.json @@ -6,18 +6,28 @@ { "resource": { "resourceType": "Organization", - "id": "extract-OutpatientPriorAuthorizationRequest.1", + "id": "extract-OutpatientPriorAuthorizationRequest-1", + "meta": { + "profile": [ + "http://hl7.org/fhir/Organization" + ] + }, "name": "Test Facility" }, "request": { "method": "PUT", - "url": "Organization/extract-OutpatientPriorAuthorizationRequest.1" + "url": "Organization/extract-OutpatientPriorAuthorizationRequest-1" } }, { "resource": { "resourceType": "Patient", - "id": "extract-OutpatientPriorAuthorizationRequest.2", + "id": "extract-OutpatientPriorAuthorizationRequest-2", + "meta": { + "profile": [ + "http://hl7.org/fhir/Patient" + ] + }, "identifier": [ { "system": "http://hl7.org/fhir/sid/us-medicare", @@ -32,12 +42,12 @@ ] } ], - "birthDate": "1950-01-01", - "gender": "male" + "gender": "male", + "birthDate": "1950-01-01" }, "request": { "method": "PUT", - "url": "Patient/extract-OutpatientPriorAuthorizationRequest.2" + "url": "Patient/extract-OutpatientPriorAuthorizationRequest-2" } } ] diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/Bundle-extract-OutpatientPriorAuthorizationRequest.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/Bundle-extract-OutpatientPriorAuthorizationRequest.json index 78f24e4d8..14db70f87 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/Bundle-extract-OutpatientPriorAuthorizationRequest.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/Bundle-extract-OutpatientPriorAuthorizationRequest.json @@ -6,18 +6,18 @@ { "resource": { "resourceType": "Organization", - "id": "extract-OutpatientPriorAuthorizationRequest.1", + "id": "extract-OutpatientPriorAuthorizationRequest-1", "name": "Test Facility" }, "request": { "method": "PUT", - "url": "Organization/extract-OutpatientPriorAuthorizationRequest.1" + "url": "Organization/extract-OutpatientPriorAuthorizationRequest-1" } }, { "resource": { "resourceType": "Patient", - "id": "extract-OutpatientPriorAuthorizationRequest.2", + "id": "extract-OutpatientPriorAuthorizationRequest-2", "identifier": [ { "system": "http://hl7.org/fhir/sid/us-medicare", @@ -37,7 +37,7 @@ }, "request": { "method": "PUT", - "url": "Patient/extract-OutpatientPriorAuthorizationRequest.2" + "url": "Patient/extract-OutpatientPriorAuthorizationRequest-2" } } ] diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/QuestionnaireResponse-cc-screening-pathway-definition-answers.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/QuestionnaireResponse-cc-screening-pathway-definition-answers.json index db0dd15d0..bd5df61c3 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/QuestionnaireResponse-cc-screening-pathway-definition-answers.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r4/tests/QuestionnaireResponse-cc-screening-pathway-definition-answers.json @@ -3,7 +3,13 @@ "id": "cc-screening-pathway-definition-answers", "questionnaire": "http://example.org/sdh/demo/Questionnaire/cc-screening-pathway-definition", "status": "completed", + "subject": { + "reference": "Patient/coverage-concern" + }, "authored": "2023-08-24", + "author": { + "reference": "Practitioner/practitioner1" + }, "item": [ { "linkId": "1", diff --git a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/tests/Bundle-OutpatientPriorAuthorizationRequest.json b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/tests/Bundle-OutpatientPriorAuthorizationRequest.json index 78f24e4d8..8054c6153 100644 --- a/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/tests/Bundle-OutpatientPriorAuthorizationRequest.json +++ b/cqf-fhir-cr/src/test/resources/org/opencds/cqf/fhir/cr/questionnaireresponse/r5/tests/Bundle-OutpatientPriorAuthorizationRequest.json @@ -6,18 +6,28 @@ { "resource": { "resourceType": "Organization", - "id": "extract-OutpatientPriorAuthorizationRequest.1", + "id": "extract-OutpatientPriorAuthorizationRequest-1", + "meta": { + "profile": [ + "http://hl7.org/fhir/Organization" + ] + }, "name": "Test Facility" }, "request": { "method": "PUT", - "url": "Organization/extract-OutpatientPriorAuthorizationRequest.1" + "url": "Organization/extract-OutpatientPriorAuthorizationRequest-1" } }, { "resource": { "resourceType": "Patient", - "id": "extract-OutpatientPriorAuthorizationRequest.2", + "id": "extract-OutpatientPriorAuthorizationRequest-2", + "meta": { + "profile": [ + "http://hl7.org/fhir/Patient" + ] + }, "identifier": [ { "system": "http://hl7.org/fhir/sid/us-medicare", @@ -32,12 +42,12 @@ ] } ], - "birthDate": "1950-01-01", - "gender": "male" + "gender": "male", + "birthDate": "1950-01-01" }, "request": { "method": "PUT", - "url": "Patient/extract-OutpatientPriorAuthorizationRequest.2" + "url": "Patient/extract-OutpatientPriorAuthorizationRequest-2" } } ]