Search in sources :

Example 1 with IAnyResource

use of org.hl7.fhir.instance.model.api.IAnyResource in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method createExtensionCoding.

/**
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link Extension}
 *     will be contained in
 * @param ccwVariable the {@link CcwCodebookInterface} being coded
 * @param code the value to use for {@link Coding#getCode()} for the resulting {@link Coding}
 * @return the output {@link Extension}, with {@link Extension#getValue()} set to a new {@link
 *     Coding} to represent the specified input values
 */
static Extension createExtensionCoding(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Optional<?> code) {
    if (!code.isPresent())
        throw new IllegalArgumentException();
    Coding coding = createCoding(rootResource, ccwVariable, code.get());
    String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
    Extension extension = new Extension(extensionUrl, coding);
    return extension;
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) Coding(org.hl7.fhir.dstu3.model.Coding)

Example 2 with IAnyResource

use of org.hl7.fhir.instance.model.api.IAnyResource in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method createExtensionCoding.

/**
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link Extension}
 *     will be contained in
 * @param ccwVariable the {@link CcwCodebookInterface being coded
 * @param code the value to use for {@link Coding#getCode()} for the resulting {@link Coding}
 * @return the output {@link Extension}, with {@link Extension#getValue()} set to a new {@link
 *     Coding} to represent the specified input values
 */
static Extension createExtensionCoding(IAnyResource rootResource, CcwCodebookInterface ccwVariable, String yearMonth, Optional<?> code) {
    if (!code.isPresent())
        throw new IllegalArgumentException();
    Coding coding = createCoding(rootResource, ccwVariable, yearMonth, code.get());
    String extensionUrl = String.format("%s/%s", CCWUtils.calculateVariableReferenceUrl(ccwVariable), yearMonth);
    Extension extension = new Extension(extensionUrl, coding);
    return extension;
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) Coding(org.hl7.fhir.dstu3.model.Coding)

Example 3 with IAnyResource

use of org.hl7.fhir.instance.model.api.IAnyResource in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method createCodeableConcept.

/**
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link
 *     CodeableConcept} will be contained in
 * @param ccwVariable the {@link CcwCodebookInterface} being coded
 * @param code the value to use for {@link Coding#getCode()} for the resulting (single) {@link
 *     Coding}, wrapped within the resulting {@link CodeableConcept}
 * @return the output {@link CodeableConcept} for the specified input values
 */
static CodeableConcept createCodeableConcept(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Optional<?> code) {
    if (!code.isPresent())
        throw new IllegalArgumentException();
    Coding coding = createCoding(rootResource, ccwVariable, code.get());
    CodeableConcept concept = new CodeableConcept();
    concept.addCoding(coding);
    return concept;
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 4 with IAnyResource

use of org.hl7.fhir.instance.model.api.IAnyResource in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method createCodeableConcept.

/**
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link
 *     CodeableConcept} will be contained in
 * @param ccwVariable the {@link CcwCodebookInterface} being coded
 * @param code the value to use for {@link Coding#getCode()} for the resulting (single) {@link
 *     Coding}, wrapped within the resulting {@link CodeableConcept}
 * @return the output {@link CodeableConcept} for the specified input values
 */
static CodeableConcept createCodeableConcept(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Optional<?> code) {
    if (!code.isPresent()) {
        throw new IllegalArgumentException();
    }
    Coding coding = createCoding(rootResource, ccwVariable, code.get());
    CodeableConcept concept = new CodeableConcept();
    concept.addCoding(coding);
    return concept;
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 5 with IAnyResource

use of org.hl7.fhir.instance.model.api.IAnyResource in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method createCodeableConceptForFieldId.

/**
 * Unlike {@link #createCodeableConcept(IAnyResource, CcwCodebookInterface, Optional)}, this
 * method creates a {@link CodeableConcept} that's intended for use as a field ID/discriminator:
 * the {@link Variable#getId()} will be used for the {@link Coding#getCode()}, rather than the
 * {@link Coding#getSystem()}.
 *
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link
 *     CodeableConcept} will be contained in
 * @param codingSystem the {@link Coding#getSystem()} to use
 * @param ccwVariable the {@link CcwCodebookInterface} being coded
 * @return the output {@link CodeableConcept} for the specified input values
 */
private static CodeableConcept createCodeableConceptForFieldId(IAnyResource rootResource, String codingSystem, CcwCodebookInterface ccwVariable) {
    String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
    Coding carinCoding = new Coding().setCode("info").setSystem(TransformerConstants.CARIN_SUPPORTING_INFO_TYPE).setDisplay("Information");
    Coding cmsBBcoding = new Coding(codingSystem, code, ccwVariable.getVariable().getLabel());
    CodeableConcept categoryCodeableConcept = new CodeableConcept();
    categoryCodeableConcept.addCoding(carinCoding);
    categoryCodeableConcept.addCoding(cmsBBcoding);
    return categoryCodeableConcept;
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Aggregations

Coding (org.hl7.fhir.dstu3.model.Coding)4 Coding (org.hl7.fhir.r4.model.Coding)4 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)3 IAnyResource (org.hl7.fhir.instance.model.api.IAnyResource)3 IBaseExtension (org.hl7.fhir.instance.model.api.IBaseExtension)3 Extension (org.hl7.fhir.dstu3.model.Extension)2 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)2 Extension (org.hl7.fhir.r4.model.Extension)2 BaseRuntimeChildDefinition (ca.uhn.fhir.context.BaseRuntimeChildDefinition)1 BaseRuntimeElementCompositeDefinition (ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition)1 BaseRuntimeElementDefinition (ca.uhn.fhir.context.BaseRuntimeElementDefinition)1 RuntimeElemContainedResourceList (ca.uhn.fhir.context.RuntimeElemContainedResourceList)1 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)1 Collection (java.util.Collection)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1