Search in sources :

Example 1 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project beneficiary-fhir-data by CMSgov.

the class V2Server method configureServerInfoMetadata.

/**
 * Configures various metadata fields that will be included in this server's {@link
 * CapabilityStatement}.
 */
private void configureServerInfoMetadata() {
    setServerName(CAPABILITIES_SERVER_NAME);
    /*
     * Read in some of the project metadata from a Maven-filtered properties
     * file, which ensures that it's always up to date.
     */
    Properties projectProps = new Properties();
    try (InputStream projectPropsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("project.properties")) {
        projectProps.load(projectPropsStream);
        setImplementationDescription(projectProps.getProperty("project.id"));
        setServerVersion(projectProps.getProperty("project.version"));
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    // Lightly customize the capability provider to set publisher name.
    ServerCapabilityStatementProvider capabilityStatementProvider = new ServerCapabilityStatementProvider();
    capabilityStatementProvider.setPublisher(CAPABILITIES_PUBLISHER);
    setServerConformanceProvider(capabilityStatementProvider);
}
Also used : InputStream(java.io.InputStream) ServerCapabilityStatementProvider(org.hl7.fhir.r4.hapi.rest.server.ServerCapabilityStatementProvider) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) Properties(java.util.Properties)

Example 2 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project kindling by HL7.

the class Publisher method addToResourceFeed.

private void addToResourceFeed(CapabilityStatement cs, Bundle dest) throws Exception {
    if (cs.getId() == null)
        throw new Exception("Resource has no id");
    if (ResourceUtilities.getById(dest, ResourceType.ValueSet, cs.getId()) != null)
        throw new Exception("Attempt to add duplicate Conformance " + cs.getId());
    if (!cs.hasText() || !cs.getText().hasDiv()) {
        RendererFactory.factory(cs, page.getRc().copy()).render(cs);
    }
    if (!cs.hasText() || cs.getText().getDiv() == null)
        System.out.println("WARNING: Example CapabilityStatement " + cs.getId() + " does not have any narrative");
    // Changed this from an exception to a warning because generateConformanceStatement doesn't produce narrative if
    // "register" is 'false'
    ResourceUtilities.meta(cs).setLastUpdated(page.getGenDate().getTime());
    if (!cs.getUrl().equals("http://hl7.org/fhir/" + cs.getResourceType().toString() + "/" + cs.getId()))
        throw new Exception("URL mismatch on CapabilityStatement");
    dest.getEntry().add(new BundleEntryComponent().setResource(cs).setFullUrl("http://hl7.org/fhir/" + cs.fhirType() + "/" + cs.getId()));
}
Also used : BundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent) TransformerException(javax.xml.transform.TransformerException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 3 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project cqf-ruler by DBCG.

the class OAuthProvider method extend.

@Override
public void extend(CapabilityStatement metadata) {
    metadata.getRestFirstRep().getSecurity().setCors(securityProperties.getOAuth().getSecurityCors());
    Extension securityExtension = metadata.getRestFirstRep().getSecurity().addExtension();
    securityExtension.setUrl(securityProperties.getOAuth().getSecurityUrl());
    // security.extension.extension
    Extension securityExtExt = securityExtension.addExtension();
    securityExtExt.setUrl(securityProperties.getOAuth().getSecurityExtAuthUrl());
    securityExtExt.setValue(new UriType(securityProperties.getOAuth().getSecurityExtAuthValueUri()));
    Extension securityTokenExt = securityExtension.addExtension();
    securityTokenExt.setUrl(securityProperties.getOAuth().getSecurityExtTokenUrl());
    securityTokenExt.setValue(new UriType(securityProperties.getOAuth().getSecurityExtTokenValueUri()));
    // security.extension.service
    Coding coding = new Coding();
    coding.setSystem(securityProperties.getOAuth().getServiceSystem());
    coding.setCode(securityProperties.getOAuth().getServiceCode());
    coding.setDisplay(securityProperties.getOAuth().getServiceDisplay());
    CodeableConcept codeConcept = new CodeableConcept();
    codeConcept.addCoding(coding);
    metadata.getRestFirstRep().getSecurity().getService().add(codeConcept);
// metadata.getRestFirstRep().getSecurity().getService() //how do we handle "text" on the sample not part of getService
}
Also used : Extension(org.hl7.fhir.dstu3.model.Extension) Coding(org.hl7.fhir.dstu3.model.Coding) UriType(org.hl7.fhir.dstu3.model.UriType) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 4 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project quality-measure-and-cohort-service by Alvearie.

the class FhirTestBase method getCapabilityStatement.

protected CapabilityStatement getCapabilityStatement() {
    CapabilityStatement metadata = new CapabilityStatement();
    metadata.setFhirVersion(Enumerations.FHIRVersion._4_0_1);
    return metadata;
}
Also used : CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement)

Example 5 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project quality-measure-and-cohort-service by Alvearie.

the class MeasureEvaluatorTest method in_populations_evaluated_boolean_define_only_returned.

@Test
public void in_populations_evaluated_boolean_define_only_returned() throws Exception {
    CapabilityStatement metadata = getCapabilityStatement();
    mockFhirResourceRetrieval("/metadata?_format=json", metadata);
    Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
    mockFhirResourceRetrieval(patient);
    Library library = setupDefineReturnLibrary();
    expressionsByPopulationType.clear();
    expressionsByPopulationType.put(MeasurePopulationType.INITIALPOPULATION, INITIAL_POPULATION);
    expressionsByPopulationType.put(MeasurePopulationType.DENOMINATOR, DENOMINATOR);
    expressionsByPopulationType.put(MeasurePopulationType.NUMERATOR, NUMERATOR);
    Measure measure = getProportionMeasure("ProportionMeasureName", library, expressionsByPopulationType);
    mockFhirResourceRetrieval(measure);
    MeasureReport report = evaluator.evaluatePatientMeasure(measure.getId(), patient.getId(), null, new MeasureEvidenceOptions(false, DefineReturnOptions.BOOLEAN));
    assertNotNull(report);
    assertTrue(report.getEvaluatedResource().isEmpty());
    assertFalse(report.getExtensionsByUrl(CDMConstants.EVIDENCE_URL).isEmpty());
}
Also used : CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Measure(org.hl7.fhir.r4.model.Measure) Patient(org.hl7.fhir.r4.model.Patient) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) Library(org.hl7.fhir.r4.model.Library) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions) Test(org.junit.Test)

Aggregations

CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)39 Test (org.junit.Test)24 Patient (org.hl7.fhir.r4.model.Patient)22 Library (org.hl7.fhir.r4.model.Library)20 Measure (org.hl7.fhir.r4.model.Measure)20 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)18 ArrayList (java.util.ArrayList)17 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)16 MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)15 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)14 CapabilityStatement (org.hl7.fhir.dstu3.model.CapabilityStatement)13 HashMap (java.util.HashMap)12 Test (org.junit.jupiter.api.Test)11 Date (java.util.Date)10 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)10 StringType (org.hl7.fhir.r4.model.StringType)10 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)9 Coding (org.hl7.fhir.r4.model.Coding)9 CapabilityStatement (org.hl7.fhir.r5.model.CapabilityStatement)9 Extension (org.hl7.fhir.r4.model.Extension)8