Skip to content

Commit

Permalink
REST interfaces for DHIS2 program stage import.
Browse files Browse the repository at this point in the history
  • Loading branch information
volsch committed Jan 22, 2019
1 parent 0342f3e commit 0b883ae
Show file tree
Hide file tree
Showing 36 changed files with 2,803 additions and 79 deletions.
72 changes: 72 additions & 0 deletions fhir/src/main/asciidoc/api-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,78 @@ include::{snippets}/read-tracked-entity-rule/response-body.adoc[]

include::{snippets}/read-tracked-entity-rule/response-fields.adoc[]

[[api-resources-data-fhir-resource-mapping]]
==== FHIR Resource Mapping
Configures how DHIS 2 organization units, DHIS 2 GEO locations, DHIS 2
timestamps and other values can be retrieved from specific FHIR resources.
For all FHIR resource types that must be transformed from and to DHIS 2
events a mapping item must exist.

.Create resource curl snippet
include::{snippets}/create-fhir-resource-mapping/curl-request.adoc[]

include::{snippets}/create-fhir-resource-mapping/request-fields.adoc[]

.Read resource curl snippet
include::{snippets}/read-fhir-resource-mapping/curl-request.adoc[]

.Read resource response body
include::{snippets}/read-fhir-resource-mapping/response-body.adoc[]

include::{snippets}/read-fhir-resource-mapping/response-fields.adoc[]

==== Tracker Program
Configures a DHIS 2 Tracker Program for transformations.

.Create resource curl snippet
include::{snippets}/create-program/curl-request.adoc[]

include::{snippets}/create-program/request-fields.adoc[]

.Read resource curl snippet
include::{snippets}/read-program/curl-request.adoc[]

.Read resource response body
include::{snippets}/read-program/response-body.adoc[]

include::{snippets}/read-program/response-fields.adoc[]

==== Tracker Program Stage
Configures a DHIS 2 Tracker Program Stages for transformations.
The Tracker Program Stages belong to a Tracker Program that must
have been configured before.

.Create resource curl snippet
include::{snippets}/create-program-stage/curl-request.adoc[]

include::{snippets}/create-program-stage/request-fields.adoc[]

.Read resource curl snippet
include::{snippets}/read-program-stage/curl-request.adoc[]

.Read resource response body
include::{snippets}/read-program-stage/response-body.adoc[]

include::{snippets}/read-program-stage/response-fields.adoc[]

[[api-resources-data-program-stage-rule]]
==== Program Stage Rule
The program stage rule resource defines a rule that is able to transform
a FHIR resource to a DHIS 2 event.

.Create resource curl snippet
include::{snippets}/create-program-stage-rule/curl-request.adoc[]

include::{snippets}/create-program-stage-rule/request-fields.adoc[]

.Read resource curl snippet
include::{snippets}/read-program-stage-rule/curl-request.adoc[]

.Read resource response body
include::{snippets}/read-program-stage-rule/response-body.adoc[]

include::{snippets}/read-program-stage-rule/response-fields.adoc[]

[[api-resources-administration]]
=== Adapter Administration Resources

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.model;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -48,7 +48,7 @@ public class ApplicableEnrollmentStatus implements Serializable
private boolean cancelled;

@Basic
@Column( name = "enrollment_active_applicable", nullable = false )
@Column( name = "enrollment_active_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE NOT NULL" )
public boolean isActive()
{
return active;
Expand All @@ -60,7 +60,7 @@ public void setActive( boolean active )
}

@Basic
@Column( name = "enrollment_completed_applicable", nullable = false )
@Column( name = "enrollment_completed_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isCompleted()
{
return completed;
Expand All @@ -72,7 +72,7 @@ public void setCompleted( boolean completed )
}

@Basic
@Column( name = "enrollment_cancelled_applicable", nullable = false )
@Column( name = "enrollment_cancelled_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isCancelled()
{
return cancelled;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.model;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -51,7 +51,7 @@ public class ApplicableEventStatus implements Serializable
private boolean skipped;

@Basic
@Column( name = "overdue_applicable", nullable = false )
@Column( name = "overdue_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE NOT NULL" )
public boolean isOverdue()
{
return overdue;
Expand All @@ -63,7 +63,7 @@ public void setOverdue( boolean overdue )
}

@Basic
@Column( name = "active_applicable", nullable = false )
@Column( name = "active_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE NOT NULL" )
public boolean isActive()
{
return active;
Expand All @@ -75,7 +75,7 @@ public void setActive( boolean active )
}

@Basic
@Column( name = "schedule_applicable", nullable = false )
@Column( name = "schedule_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE NOT NULL" )
public boolean isSchedule()
{
return schedule;
Expand All @@ -87,7 +87,7 @@ public void setSchedule( boolean schedule )
}

@Basic
@Column( name = "visited_applicable", nullable = false )
@Column( name = "visited_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE NOT NULL" )
public boolean isVisited()
{
return visited;
Expand All @@ -99,7 +99,7 @@ public void setVisited( boolean visited )
}

@Basic
@Column( name = "completed_applicable", nullable = false )
@Column( name = "completed_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isCompleted()
{
return completed;
Expand All @@ -111,7 +111,7 @@ public void setCompleted( boolean completed )
}

@Basic
@Column( name = "skipped_applicable", nullable = false )
@Column( name = "skipped_applicable", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isSkipped()
{
return skipped;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.model;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -47,7 +47,7 @@ public class EventStatusUpdate implements Serializable
private boolean completedToActive;

@Basic
@Column( name = "overdue_to_active_update" )
@Column( name = "overdue_to_active_update", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isOverdueToActive()
{
return overdueToActive;
Expand All @@ -59,7 +59,7 @@ public void setOverdueToActive( boolean overdueToActive )
}

@Basic
@Column( name = "schedule_to_active_update" )
@Column( name = "schedule_to_active_update", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isScheduleToActive()
{
return scheduleToActive;
Expand All @@ -71,7 +71,7 @@ public void setScheduleToActive( boolean scheduleToActive )
}

@Basic
@Column( name = "completed_to_active_update" )
@Column( name = "completed_to_active_update", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isCompletedToActive()
{
return completedToActive;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.model;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -58,6 +58,8 @@ public class MappedTrackerProgram extends VersionedBaseMetadata implements Seria
{
private static final long serialVersionUID = -2784006479143123933L;

public static final int MAX_NAME_LENGTH = 230;

private String name;

private String description;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.model;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -56,6 +56,8 @@ public class MappedTrackerProgramStage extends VersionedBaseMetadata implements
{
private static final long serialVersionUID = 7561285892767275117L;

public static final int MAX_NAME_LENGTH = 230;

private String name;

private String description;
Expand Down Expand Up @@ -258,7 +260,7 @@ public void setBeforePeriodDayType( EventPeriodDayType beforePeriodDayType )
}

@Basic
@Column( name = "before_period_days", nullable = false )
@Column( name = "before_period_days", nullable = false, columnDefinition = "INTEGER DEFAULT 0 NOT NULL" )
public int getBeforePeriodDays()
{
return beforePeriodDays;
Expand All @@ -282,7 +284,7 @@ public void setAfterPeriodDayType( EventPeriodDayType afterPeriodDayType )
}

@Basic
@Column( name = "after_period_days", nullable = false )
@Column( name = "after_period_days", nullable = false, columnDefinition = "INTEGER DEFAULT 0 NOT NULL" )
public int getAfterPeriodDays()
{
return afterPeriodDays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.model;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -119,7 +119,7 @@ public ProgramStageRule()
}

@Basic
@Column( name = "enrollment_creation_enabled", nullable = false )
@Column( name = "enrollment_creation_enabled", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isEnrollmentCreationEnabled()
{
return enrollmentCreationEnabled;
Expand All @@ -131,7 +131,7 @@ public void setEnrollmentCreationEnabled( boolean enrollmentCreationEnabled )
}

@Basic
@Column( name = "event_creation_enabled", nullable = false )
@Column( name = "event_creation_enabled", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isEventCreationEnabled()
{
return eventCreationEnabled;
Expand All @@ -143,7 +143,7 @@ public void setEventCreationEnabled( boolean eventCreationEnabled )
}

@Basic
@Column( name = "update_event_date", nullable = false )
@Column( name = "update_event_date", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE NOT NULL" )
public boolean isUpdateEventDate()
{
return updateEventDate;
Expand Down Expand Up @@ -180,7 +180,7 @@ public void setBeforePeriodDayType( EventPeriodDayType beforePeriodDayType )
}

@Basic
@Column( name = "before_period_days", nullable = false )
@Column( name = "before_period_days", nullable = false, columnDefinition = "INTEGER DEFAULT 0 NOT NULL" )
public Integer getBeforePeriodDays()
{
return beforePeriodDays;
Expand All @@ -204,7 +204,7 @@ public void setAfterPeriodDayType( EventPeriodDayType afterPeriodDayType )
}

@Basic
@Column( name = "after_period_days" )
@Column( name = "after_period_days", columnDefinition = "INTEGER DEFAULT 0 NOT NULL" )
public Integer getAfterPeriodDays()
{
return afterPeriodDays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.model;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -57,6 +57,8 @@ public class RuleDhisDataReference extends VersionedBaseMetadata implements Seri
{
private static final long serialVersionUID = -2784006479143123933L;

public static final int MAX_SCRIPT_ARG_NAME_LENGTH = 230;

private AbstractRule rule;

private Reference dataReference;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dhis2.fhir.adapter.fhir.metadata.repository;

/*
* Copyright (c) 2004-2018, University of Oslo
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -37,6 +37,7 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.security.access.prepost.PreAuthorize;

Expand All @@ -51,6 +52,7 @@
* @author volsch
*/
@CacheConfig( cacheManager = "metadataCacheManager", cacheNames = "resourceMapping" )
@RepositoryRestResource
@PreAuthorize( "hasRole('DATA_MAPPING')" )
public interface FhirResourceMappingRepository extends JpaRepository<FhirResourceMapping, UUID>, QuerydslPredicateExecutor<FhirResourceMapping>
{
Expand Down
Loading

0 comments on commit 0b883ae

Please sign in to comment.