use of org.hl7.fhir.r4.model.PlanDefinition in project cqf-ruler by DBCG.
the class DiscoveryElementStu3 method getAsJson.
public JsonObject getAsJson() {
JsonObject service = new JsonObject();
if (planDefinition != null) {
if (planDefinition.hasAction()) {
// TODO - this needs some work - too naive
if (planDefinition.getActionFirstRep().hasTriggerDefinition()) {
if (planDefinition.getActionFirstRep().getTriggerDefinitionFirstRep().hasEventName()) {
service.addProperty("hook", planDefinition.getActionFirstRep().getTriggerDefinitionFirstRep().getEventName());
}
}
}
if (planDefinition.hasName()) {
service.addProperty("name", planDefinition.getName());
}
if (planDefinition.hasTitle()) {
service.addProperty("title", planDefinition.getTitle());
}
if (planDefinition.hasDescription()) {
service.addProperty("description", planDefinition.getDescription());
}
service.addProperty("id", planDefinition.getIdElement().getIdPart());
if (prefetchUrlList == null) {
prefetchUrlList = new PrefetchUrlList();
}
JsonObject prefetchContent = new JsonObject();
int itemNo = 0;
if (!prefetchUrlList.stream().anyMatch(p -> p.equals("Patient/{{context.patientId}}") || p.equals("Patient?_id={{context.patientId}}") || p.equals("Patient?_id=Patient/{{context.patientId}}"))) {
prefetchContent.addProperty("item1", "Patient?_id={{context.patientId}}");
++itemNo;
}
for (String item : prefetchUrlList) {
prefetchContent.addProperty("item" + Integer.toString(++itemNo), item);
}
service.add("prefetch", prefetchContent);
return service;
}
return null;
}
use of org.hl7.fhir.r4.model.PlanDefinition in project pathling by aehrc.
the class LightweightFhirEncodersTest method testIdCollection.
@Test
public void testIdCollection() {
final ExpressionEncoder<PlanDefinition> encoder = fhirEncoders.of(PlanDefinition.class);
final PlanDefinition planDefinition = new PlanDefinition();
final PlanDefinitionActionComponent actionComponent = planDefinition.getActionFirstRep();
actionComponent.addGoalId(new IdType("Condition", "goal-1", "1").getValue());
actionComponent.addGoalId(new IdType("Condition", "goal-2", "2").getValue());
actionComponent.addGoalId(new IdType("Patient", "goal-3", "3").getValue());
assertSerDeIsIdentity(encoder, planDefinition);
}
use of org.hl7.fhir.r4.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePlanDefinitionPlanDefinitionActionConditionComponent.
protected void composePlanDefinitionPlanDefinitionActionConditionComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionActionConditionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "condition", name, element, index);
if (element.hasKindElement())
composeEnum(t, "PlanDefinition", "kind", element.getKindElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "PlanDefinition", "description", element.getDescriptionElement(), -1);
if (element.hasLanguageElement())
composeString(t, "PlanDefinition", "language", element.getLanguageElement(), -1);
if (element.hasExpressionElement())
composeString(t, "PlanDefinition", "expression", element.getExpressionElement(), -1);
}
use of org.hl7.fhir.r4.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method cacheResource.
public void cacheResource(Resource r) throws FHIRException {
synchronized (lock) {
Map<String, Resource> map = allResourcesById.get(r.fhirType());
if (map == null) {
map = new HashMap<String, Resource>();
allResourcesById.put(r.fhirType(), map);
}
map.put(r.getId(), r);
if (r instanceof MetadataResource) {
MetadataResource m = (MetadataResource) r;
String url = m.getUrl();
if (!allowLoadingDuplicates && hasResource(r.getClass(), url))
throw new DefinitionException("Duplicate Resource " + url);
if (r instanceof StructureDefinition)
seeMetadataResource((StructureDefinition) m, structures, false);
else if (r instanceof ValueSet)
seeMetadataResource((ValueSet) m, valueSets, false);
else if (r instanceof CodeSystem)
seeMetadataResource((CodeSystem) m, codeSystems, false);
else if (r instanceof ImplementationGuide)
seeMetadataResource((ImplementationGuide) m, guides, false);
else if (r instanceof CapabilityStatement)
seeMetadataResource((CapabilityStatement) m, capstmts, false);
else if (r instanceof SearchParameter)
seeMetadataResource((SearchParameter) m, searchParameters, false);
else if (r instanceof PlanDefinition)
seeMetadataResource((PlanDefinition) m, plans, false);
else if (r instanceof OperationDefinition)
seeMetadataResource((OperationDefinition) m, operations, false);
else if (r instanceof Questionnaire)
seeMetadataResource((Questionnaire) m, questionnaires, true);
else if (r instanceof ConceptMap)
seeMetadataResource((ConceptMap) m, maps, false);
else if (r instanceof StructureMap)
seeMetadataResource((StructureMap) m, transforms, false);
else if (r instanceof NamingSystem)
systems.add((NamingSystem) r);
}
}
}
use of org.hl7.fhir.r4.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePlanDefinitionPlanDefinitionActionParticipantComponent.
protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionActionParticipantComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "participant", name, element, index);
if (element.hasTypeElement())
composeEnum(t, "PlanDefinition", "type", element.getTypeElement(), -1);
if (element.hasRole())
composeCodeableConcept(t, "PlanDefinition", "role", element.getRole(), -1);
}
Aggregations