use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class TestData method newMedication.
/**
* Returns a FHIR medication to be contained to a medication request for testing purposes.
*/
public static Medication newMedication() {
final Medication medication = new Medication();
medication.setId("test-med");
final MedicationIngredientComponent ingredient = new MedicationIngredientComponent();
final CodeableConcept item = new CodeableConcept();
item.addCoding().setSystem("test/ingredient/system").setCode("test-code");
ingredient.setItem(item);
medication.addIngredient(ingredient);
return medication;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class QueryHelpers method join.
/**
* Joins any number of {@link FhirPath} expressions, using equality between their respective
* resource ID columns.
*
* @param parserContext the current {@link ParserContext}
* @param fhirPaths a list of {@link FhirPath} expressions
* @param joinType a {@link JoinType}
* @return a new {@link Dataset}
*/
@Nonnull
public static Dataset<Row> join(@Nonnull final ParserContext parserContext, @Nonnull final List<FhirPath> fhirPaths, @Nonnull final JoinType joinType) {
checkArgument(fhirPaths.size() > 1, "fhirPaths must contain more than one FhirPath");
final FhirPath left = fhirPaths.get(0);
final List<FhirPath> joinTargets = fhirPaths.subList(1, fhirPaths.size());
// Only non-literal paths will trigger a join.
final List<FhirPath> nonLiteralTargets = joinTargets.stream().filter(t -> t instanceof NonLiteralPath).collect(Collectors.toList());
if (left instanceof NonLiteralPath && nonLiteralTargets.isEmpty()) {
// to join.
return left.getDataset();
} else if (left instanceof LiteralPath && !nonLiteralTargets.isEmpty()) {
// right without any need to join.
return nonLiteralTargets.get(0).getDataset();
}
Dataset<Row> dataset = left.getDataset();
final List<Column> groupingColumns = parserContext.getGroupingColumns();
final Column idColumn = parserContext.getInputContext().getIdColumn();
final List<Column> leftColumns = checkColumnsAndFallback(left.getDataset(), groupingColumns, idColumn);
for (final FhirPath right : nonLiteralTargets) {
final List<Column> resolvedGroupingColumns = checkColumnsAndFallback(right.getDataset(), leftColumns, idColumn);
dataset = join(dataset, resolvedGroupingColumns, right.getDataset(), resolvedGroupingColumns, joinType);
}
return dataset;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class ExtractResponse method toParameters.
/**
* Converts this to a {@link Parameters} resource, based on the definition of the result of the
* "extract" operation within the OperationDefinition.
*
* @return a new {@link Parameters} object
*/
public Parameters toParameters() {
final Parameters parameters = new Parameters();
final ParametersParameterComponent urlParameter = new ParametersParameterComponent();
urlParameter.setName("url");
urlParameter.setValue(new UrlType(url));
parameters.getParameter().add(urlParameter);
return parameters;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class ConformanceProvider method buildResources.
@Nonnull
private List<CapabilityStatementRestResourceComponent> buildResources() {
final List<CapabilityStatementRestResourceComponent> resources = new ArrayList<>();
final Set<ResourceType> supported = FhirServer.supportedResourceTypes();
final Set<ResourceType> supportedResourceTypes = supported.isEmpty() ? EnumSet.noneOf(ResourceType.class) : EnumSet.copyOf(supported);
for (final ResourceType resourceType : supportedResourceTypes) {
final CapabilityStatementRestResourceComponent resource = new CapabilityStatementRestResourceComponent(new CodeType(resourceType.toCode()));
resource.setProfile(FHIR_RESOURCE_BASE + resourceType.toCode());
// Add the search operation to all resources.
final ResourceInteractionComponent search = new ResourceInteractionComponent();
search.setCode(TypeRestfulInteraction.SEARCHTYPE);
resource.getInteraction().add(search);
// Add the create and update operations to all resources.
final ResourceInteractionComponent create = new ResourceInteractionComponent();
final ResourceInteractionComponent update = new ResourceInteractionComponent();
create.setCode(TypeRestfulInteraction.CREATE);
update.setCode(TypeRestfulInteraction.UPDATE);
resource.getInteraction().add(create);
resource.getInteraction().add(update);
// Add the `aggregate` operation to all resources.
final CanonicalType aggregateOperationUri = new CanonicalType(getOperationUri("aggregate"));
final CapabilityStatementRestResourceOperationComponent aggregateOperation = new CapabilityStatementRestResourceOperationComponent(new StringType("aggregate"), aggregateOperationUri);
resource.addOperation(aggregateOperation);
// Add the `fhirPath` search parameter to all resources.
final CapabilityStatementRestResourceOperationComponent searchOperation = new CapabilityStatementRestResourceOperationComponent();
searchOperation.setName("fhirPath");
searchOperation.setDefinition(getOperationUri("search"));
resource.addOperation(searchOperation);
resources.add(resource);
}
// Add the read operation to the OperationDefinition resource.
final String opDefCode = ResourceType.OPERATIONDEFINITION.toCode();
final CapabilityStatementRestResourceComponent opDefResource = new CapabilityStatementRestResourceComponent(new CodeType(opDefCode));
opDefResource.setProfile(FHIR_RESOURCE_BASE + opDefCode);
final ResourceInteractionComponent readInteraction = new ResourceInteractionComponent();
readInteraction.setCode(TypeRestfulInteraction.READ);
opDefResource.addInteraction(readInteraction);
resources.add(opDefResource);
return resources;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class ConformanceProvider method buildRestComponent.
@Nonnull
private List<CapabilityStatementRestComponent> buildRestComponent() {
final List<CapabilityStatementRestComponent> rest = new ArrayList<>();
final CapabilityStatementRestComponent server = new CapabilityStatementRestComponent();
server.setMode(RestfulCapabilityMode.SERVER);
server.setSecurity(buildSecurity());
server.setResource(buildResources());
server.setOperation(buildOperations());
server.setInteraction(buildSystemLevelInteractions());
rest.add(server);
return rest;
}
Aggregations