Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) University College London Hospitals NHS Foundation Trust
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Story/Task
description: Create a new story or task
projects: ["UCLH-DHCT/4"]
body:
- type: markdown
attributes:
value: |
Let's add a new task/story to the project
- type: textarea
id: definition_of_done
attributes:
label: Definition of Done / Acceptance Criteria
description: What can someone see/do when this task is done.
placeholder: "- [ ] The export data is available in the xxx format, including age of the patient at the time of imaging..."
validations:
required: true
- type: textarea
id: testing
attributes:
label: Testing
description: Specific testing considerations for this task to be done
placeholder: "- [ ] Passed integration testing that uses the correct modality..."
validations:
required: false
- type: textarea
id: documentation
attributes:
label: Documentation
description: Documentation to be completed along with this task
placeholder: "- [ ] Update module README and user guide..."
validations:
required: false
- type: textarea
id: dependencies
attributes:
label: Dependencies
description: Enter the github issue number that the requirement is dependent on, in the form `- [ ] #1` to make a checklist
placeholder: "- [ ] #1"
validations:
required: false
- type: textarea
id: details
attributes:
label: Details and Comments
description: Other details or comments
placeholder: The algorithm used is based on...
validations:
required: false
2 changes: 1 addition & 1 deletion .github/workflows/comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout documentation
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: SAFEHR-data/internal_emap_documentation
token: ${{ secrets.GH_PAT_READ_AND_COMMENT }}
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Emap

A monorepo for all core Emap functions
Experimental Medicine Application Platform (EMAP) produces a near real-time database
containing clinical data for research and dashboard development within UCLH.

This is a non-operational “mirror” of a subset of UCLH data (historical and live).
The underpinning aim is to ensure that no clinical data are corrupted or destroyed during the interaction
between the research process and the hospital’s systems and that the systems are not compromised
(for instance, that they are not interrupted or slowed down by research enquiries).

For more information about EMAP, please see the [docs](https://github.com/SAFEHR-data/emap/tree/main/docs)

## Developer onboarding

- How to [configure IntelliJ](docs/dev/intellij.md) to build emap and run tests.
- [Onboarding](docs/dev/onboarding.md) gives details on how data items are processed and the test strategies used.

# Setup

Expand All @@ -20,12 +33,6 @@ EMAP [your root emap directory]
│ ├── [etc.]
```

## Developer onboarding

- How to [configure IntelliJ](docs/dev/intellij.md) to build emap and run tests.
- [Onboarding](docs/dev/onboarding.md) gives details on how data items are processed and the test strategies used.


# Monorepo migration

How were [old repos migrated into this repo?](docs/dev/migration.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void processMsg(HospitalVisit visit, PendingTransfer msg, Instant validFr
RowState<PlannedMovement, PlannedMovementAudit> plannedState = getOrCreate(
allFromRequest, visit, plannedLocation, msg.getPendingEventType().toString(), msg.getEventOccurredDateTime(), validFrom, storedFrom
);
addHospitalService(msg, plannedState);
PlannedMovement plannedMovement = plannedState.getEntity();
// If we receive a cancelled message before the original request then add it in
if (plannedMovement.getEventDatetime() == null) {
Expand Down Expand Up @@ -159,8 +160,20 @@ private void deletePlannedMovement(PlannedMovement plannedMovement, Instant dele
plannedMovementAuditRepo.save(plannedMovement.createAuditEntity(deletionTime, storedUntil));
plannedMovementRepo.delete(plannedMovement);
}

/**
* Add hospital service.
* @param msg PendingTransfer
* @param movementState movement wrapped in state class
*/
private void addHospitalService(final PendingTransfer msg, RowState<PlannedMovement, PlannedMovementAudit> movementState) {
PlannedMovement movement = movementState.getEntity();
movementState.assignInterchangeValue(msg.getHospitalService(), movement.getHospitalService(), movement::setHospitalService);
}
}



/**
* Interface to allow passing of the repository method as a parameter.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void testPendingCreatesPlannedMovement() throws Exception {
assertEquals(EVENT_TIME, plannedMovement.getEventDatetime());
assertEquals(PendingType.TRANSFER.toString(), plannedMovement.getEventType());
assertNull(plannedMovement.getCancelledDatetime());
assertEquals("Head and Neck - OMFS", plannedMovement.getHospitalService());
}

/**
Expand Down
4 changes: 4 additions & 0 deletions docs/Glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@

## T

- <a id="tdl">**TCI**</a>

To Come In (a patient is TCI for ward X if they are on the way to the ward but not admitted).

- <a id="tdl">**TDL**</a>

The Doctors Laboratory provide the biochemistry and microbiology analysis for the hospital.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
public class CancelPendingTransfer extends AdtMessage implements PendingEvent, AdtCancellation {
private PendingType pendingEventType = PendingType.TRANSFER;
private InterchangeValue<String> pendingDestination = InterchangeValue.unknown();
private InterchangeValue<String> hospitalService = InterchangeValue.unknown();
private Instant cancelledDateTime;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ public interface PendingEvent {
* @param location Concatenated location string
*/
void setPendingDestination(InterchangeValue<String> location);


/**
* @return Hospital service from PV1-10.
*/
InterchangeValue<String> getHospitalService();

/**
* @param hospitalService
*/
void setHospitalService(InterchangeValue<String> hospitalService);

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public class PendingTransfer extends AdtMessage implements PendingEvent {
private PendingType pendingEventType = PendingType.TRANSFER;
private InterchangeValue<String> pendingDestination = InterchangeValue.unknown();
private InterchangeValue<String> hospitalService = InterchangeValue.unknown();

@Override
public void processMessage(EmapOperationMessageProcessor processor) throws EmapOperationMessageProcessingException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ modeOfArrival:
"@class": "uk.ac.ucl.rits.inform.interchange.InterchangeValue"
status: "SAVE"
value: "Walk-in"

hospitalService:
"@class": "uk.ac.ucl.rits.inform.interchange.InterchangeValue"
status: "SAVE"
value: "Head and Neck - OMFS"
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public class PlannedMovement extends TemporalCore<PlannedMovement, PlannedMoveme
@Column(columnDefinition = "timestamp with time zone")
private Instant cancelledDatetime;

/**
* \brief The hospital service associated with this planned movement.
*
* Also known as the subspeciality.
*/
private String hospitalService;

/**
* Minimal constructor.
* @param hospitalVisitId associated hospital visit
Expand All @@ -109,6 +116,7 @@ private PlannedMovement(PlannedMovement other) {
eventDatetime = other.eventDatetime;
cancelled = other.cancelled;
cancelledDatetime = other.cancelledDatetime;
hospitalService = other.hospitalService;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ private AdtMessage buildAdtMessageSubclass(final PV1Wrap pv1Wrap, final Message
case "A15":
PendingTransfer pendingTransfer = new PendingTransfer();
setPendingDestination(pv1Wrap, pendingTransfer);
setHospitalService(pv1Wrap, pendingTransfer);
msg = pendingTransfer;
break;
case "A17":
Expand Down Expand Up @@ -448,4 +449,9 @@ private void setPendingDestination(PV1Wrap pv1Wrap, PendingEvent pendingEvent) {
String pendingLocation = pv1Wrap.getPendingLocation();
pendingEvent.setPendingDestination(InterchangeValue.buildFromHl7(pendingLocation));
}

private void setHospitalService(PV1Wrap pv1Wrap, PendingEvent pendingEvent) throws HL7Exception {
String hospitalService = pv1Wrap.getHospitalService();
pendingEvent.setHospitalService(InterchangeValue.buildFromHl7(hospitalService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void testPendingTransferSpecificFields() throws Exception {

assertEquals(PendingType.TRANSFER, msg.getPendingEventType());
assertEquals(InterchangeValue.buildFromHl7("1020100166^SDEC BY02^11 SDEC"), msg.getPendingDestination());
assertEquals(InterchangeValue.buildFromHl7("Head and Neck - OMFS"), msg.getHospitalService());
}

/**
Expand All @@ -48,6 +49,18 @@ void testPendingLocationUnknown() throws Exception {
assertTrue(msg.getPendingDestination().isUnknown());
}

/**
* Given a pending transfer message with no hospital service (PV1-10)
* When processed into an interchange message
* The hospital service should be unknown
* @throws Exception
*/
@Test
void testNoHospitalService() throws Exception {
PendingEvent msg = (PendingEvent) processSingleAdtMessage("Adt/pending/A15_no_hospital_service.txt");
assertTrue(msg.getHospitalService().isUnknown());
}

/**
* Given a cancel pending transfer message
* When processed
Expand Down
2 changes: 1 addition & 1 deletion hl7-reader/src/test/resources/Adt/pending/A15.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ PID|1||40800000^^^MRENTR^MEDREC~9999999999^^^NHS^HN||AGBTESTD^Satesta^^^MRS||198
ZPD||Email~MYCH||ACTIVATED|||N||N|||||||||||||||F
PD1|||GP AT HAND^^E85124~~
NTE|1||EP34C Patient|PatComments
PV1|1|E|ED^COVID MAJORS 16^16-COVID MAJORS^U^R^^^^^^DEPID|Emergency|||1236^BEAR^BLACK^^^^^^PROVID^^^^PROVID|||A\T\E|||||||||123412341234|SELF|||||||||||||||||||||Adm*Conf|1020100166^SDEC BY02^11 SDEC^U^D^^^^^^DEPID||20220421195000||||||123412341234
PV1|1|E|ED^COVID MAJORS 16^16-COVID MAJORS^U^R^^^^^^DEPID|Emergency|||1236^BEAR^BLACK^^^^^^PROVID^^^^PROVID|||Head and Neck - OMFS|||||||||123412341234|SELF|||||||||||||||||||||Adm*Conf|1020100166^SDEC BY02^11 SDEC^U^D^^^^^^DEPID||20220421195000||||||123412341234
PV2|||||||||||||||||||||n|N||||||||||||||||Walk-in
OBX|1|TX|AdminCode^ADMINISTRATIVE CATEGORY CODE|1|1|||||||||20220422
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MSH|^~\&|EPIC|UCLH|||20220422002300|10018372|ADT^A15|39278859|P|2.4|||AL|NE
EVN|A15|20220422002300||PNDTRANSFER|10018372^GIANT^PANDA^^^^^^UCLHS^^^^^UCHC|20220422002258
PID|1||40800000^^^MRENTR^MEDREC~9999999999^^^NHS^HN||AGBTESTD^Satesta^^^MRS||19800601|F||N|^^London^^T5 1TT||0200 000 0000~07777 000 000||BG|N||123412341234||||||||||||N
ZPD||Email~MYCH||ACTIVATED|||N||N|||||||||||||||F
PD1|||GP AT HAND^^E85124~~
NTE|1||EP34C Patient|PatComments
PV1|1|E|ED^COVID MAJORS 16^16-COVID MAJORS^U^R^^^^^^DEPID|Emergency|||1236^BEAR^BLACK^^^^^^PROVID^^^^PROVID||||||||||||123412341234|SELF|||||||||||||||||||||Adm*Conf|1020100166^SDEC BY02^11 SDEC^U^D^^^^^^DEPID||20220421195000||||||123412341234
PV2|||||||||||||||||||||n|N||||||||||||||||Walk-in
OBX|1|TX|AdminCode^ADMINISTRATIVE CATEGORY CODE|1|1|||||||||20220422
Loading