Java Code Examples for org.hl7.fhir.dstu3.model.Extension#setUrl()

The following examples show how to use org.hl7.fhir.dstu3.model.Extension#setUrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static Extension makeIssueSource(Source source) {
  Extension ex = new Extension();
  // todo: write this up and get it published with the pack (and handle the redirect?)
  ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE);
  CodeType c = new CodeType();
  c.setValue(source.toString());
  ex.setValue(c);
  return ex;
}
 
Example 2
Source File: FhirStu3.java    From synthea with Apache License 2.0 5 votes vote down vote up
/**
 * Create an extension in with a valueMoney in USD.
 * @param url The url of the extension.
 * @param value The value in USD.
 * @return the Extension
 */
private static Extension createMoneyExtension(String url, double value) {
  Money money = new Money();
  money.setValue(value);
  money.setSystem("urn:iso:std:iso:4217");
  money.setCode("USD");

  Extension extension = new Extension();
  extension.setUrl(url);
  extension.setValue(money);

  return extension;
}
 
Example 3
Source File: TestData.java    From bunsen with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a new Patient for testing.
 *
 * @return a FHIR Patient for testing.
 */
public static Patient newPatient() {

  Patient patient = new Patient();

  patient.setId("test-patient");
  patient.setGender(AdministrativeGender.MALE);
  patient.setActive(true);
  patient.setMultipleBirth(new IntegerType(1));

  patient.setBirthDateElement(new DateType("1945-01-02"));

  patient.addGeneralPractitioner().setReference("Practitioner/12345");

  Identifier practitionerIdentifier = new Identifier();
  practitionerIdentifier.setId("P123456");
  practitionerIdentifier.getAssigner().setReference("Organization/123456");
  patient.getGeneralPractitionerFirstRep().setIdentifier(practitionerIdentifier);

  Address address = patient.addAddress();
  address.addLine("123 Fake Street");
  address.setCity("Chicago");
  address.setState("IL");
  address.setDistrict("12345");

  Extension birthSex = patient.addExtension();

  birthSex.setUrl(US_CORE_BIRTHSEX);
  birthSex.setValue(new CodeType("M"));

  Extension ethnicity = patient.addExtension();
  ethnicity.setUrl(US_CORE_ETHNICITY);
  ethnicity.setValue(null);

  Coding ombCoding = new Coding();

  ombCoding.setSystem("urn:oid:2.16.840.1.113883.6.238");
  ombCoding.setCode("2135-2");
  ombCoding.setDisplay("Hispanic or Latino");

  // Add category to ethnicity extension
  Extension ombCategory = ethnicity.addExtension();

  ombCategory.setUrl("ombCategory");
  ombCategory.setValue(ombCoding);

  // Add multiple detailed sub-extension to ethnicity extension
  Coding detailedCoding1 = new Coding();
  detailedCoding1.setSystem("urn:oid:2.16.840.1.113883.6.238");
  detailedCoding1.setCode("2165-9");
  detailedCoding1.setDisplay("South American");

  Coding detailedCoding2 = new Coding();
  detailedCoding2.setSystem("urn:oid:2.16.840.1.113883.6.238");
  detailedCoding2.setCode("2166-7");
  detailedCoding2.setDisplay("Argentinean");

  final Extension detailed1 = ethnicity.addExtension();
  detailed1.setUrl("detailed");
  detailed1.setValue(detailedCoding1);

  final Extension detailed2 = ethnicity.addExtension();
  detailed2.setUrl("detailed");
  detailed2.setValue(detailedCoding2);

  // Add text display to ethnicity extension
  Extension ethnicityText = ethnicity.addExtension();
  ethnicityText.setUrl("text");
  ethnicityText.setValue(new StringType("Not Hispanic or Latino"));

  // Human Name
  HumanName humanName = new HumanName();
  humanName.setFamily("family_name");
  humanName.addGiven("given_name");
  humanName.addGiven("middle_name");
  patient.addName(humanName);

  return patient;
}
 
Example 4
Source File: MeasureOperationsProvider.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
@Operation(name = "$evaluate-measure", idempotent = true, type = Measure.class)
public MeasureReport evaluateMeasure(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart,
        @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "measure") String measureRef,
        @OptionalParam(name = "reportType") String reportType, @OptionalParam(name = "patient") String patientRef,
        @OptionalParam(name = "productLine") String productLine,
        @OptionalParam(name = "practitioner") String practitionerRef,
        @OptionalParam(name = "lastReceivedOn") String lastReceivedOn,
        @OptionalParam(name = "source") String source, @OptionalParam(name = "user") String user,
        @OptionalParam(name = "pass") String pass) throws InternalErrorException, FHIRException {
    LibraryLoader libraryLoader = LibraryHelper.createLibraryLoader(this.libraryResolutionProvider);
    MeasureEvaluationSeed seed = new MeasureEvaluationSeed(this.factory, libraryLoader, this.libraryResolutionProvider);
    Measure measure = this.measureResourceProvider.getDao().read(theId);

    if (measure == null) {
        throw new RuntimeException("Could not find Measure/" + theId.getIdPart());
    }

    seed.setup(measure, periodStart, periodEnd, productLine, source, user, pass);

    // resolve report type
    MeasureEvaluation evaluator = new MeasureEvaluation(seed.getDataProvider(), this.registry, seed.getMeasurementPeriod());
    if (reportType != null) {
        switch (reportType) {
        case "patient":
            return evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef);
        case "patient-list": 
            return evaluator.evaluatePatientListMeasure(seed.getMeasure(), seed.getContext(), practitionerRef);
        case "population":
            return evaluator.evaluatePopulationMeasure(seed.getMeasure(), seed.getContext());
        default:
            throw new IllegalArgumentException("Invalid report type: " + reportType);
        }
    }

    // default report type is patient
    MeasureReport report = evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef);
    if (productLine != null)
    {
        Extension ext = new Extension();
        ext.setUrl("http://hl7.org/fhir/us/cqframework/cqfmeasures/StructureDefinition/cqfm-productLine");
        ext.setValue(new StringType(productLine));
        report.addExtension(ext);
    }

    return report;
}