Skip to content

Commit

Permalink
Merge pull request #87 from kids-first/feat/timeline
Browse files Browse the repository at this point in the history
✨Add Timeline to Patient resource
  • Loading branch information
abgeorge7 authored Jul 1, 2020
2 parents 698ec2c + f617611 commit 3fde5b9
Show file tree
Hide file tree
Showing 14 changed files with 917 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
"resource": [
{
"type": "Condition",
"searchInclude": ["*", "Condition:patient"]
"searchInclude": ["*", "Condition:observation", "Condition:patient"]
},
{
"type": "Observation",
"searchInclude": ["*", "Observation:patient"]
},
{
"type": "Patient",
"searchInclude": ["*", "Patient:observation"]
}
]
}
Expand Down
70 changes: 3 additions & 67 deletions cypress/fixtures/resourceIdDetails/conditionDetails.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"lastUpdated": "2020-05-18T15:33:58.157+00:00"
},
"type": "searchset",
"total": 2,
"total": 1,
"link": [
{
"relation": "self",
"url": "http://localhost:8000/Condition?patient=Patient%2F123"
"url": "http://localhost:8000/Patient?observation=Condition%2F123"
}
],
"entry": [
Expand All @@ -21,72 +21,8 @@
"meta": {
"profile": ["http://fhir.kids-first.io/StructureDefinition/Condition"]
},
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/condition-category",
"code": "condition1",
"display": "Condition 1"
}
]
}
],
"code": {
"coding": [
{
"system": "http://purl.obolibrary.org/obo/mondo.owl",
"code": "MONDO:456"
},
{
"system": "http://ncit.nci.nih.gov",
"code": "NCIT:456"
}
],
"text": "Condition 1"
},
"subject": {
"reference": "Patient/123"
}
},
"search": {
"mode": "match"
}
},
{
"fullUrl": "http://localhost:8000/Condition/Condition.789",
"resource": {
"resourceType": "Condition",
"id": "789",
"meta": {
"profile": ["http://fhir.kids-first.io/StructureDefinition/Condition"]
},
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/condition-category",
"code": "condition2",
"display": "Condition 2"
}
]
}
],
"code": {
"coding": [
{
"system": "http://purl.obolibrary.org/obo/mondo.owl",
"code": "MONDO:789"
},
{
"system": "http://ncit.nci.nih.gov",
"code": "NCIT:789"
}
],
"text": "Condition 2"
},
"subject": {
"reference": "Patient/123"
"reference": "Observation/123"
}
},
"search": {
Expand Down
49 changes: 49 additions & 0 deletions cypress/fixtures/resourceIdDetails/patientDetails.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"resourceType": "Bundle",
"id": "456",
"meta": {
"lastUpdated": "2020-05-18T15:33:58.157+00:00"
},
"type": "searchset",
"total": 2,
"link": [
{
"relation": "self",
"url": "http://localhost:8000/Patient?observation=Observation%2F123"
}
],
"entry": [
{
"fullUrl": "http://localhost:8000/Patient/Patient.456",
"resource": {
"resourceType": "Patient",
"id": "456",
"meta": {
"profile": ["http://fhir.kids-first.io/StructureDefinition/Patient"]
},
"subject": {
"reference": "Observation/123"
}
},
"search": {
"mode": "match"
}
},
{
"fullUrl": "http://localhost:8000/Patient/Patient.789",
"resource": {
"resourceType": "Patient",
"id": "789",
"meta": {
"profile": ["http://fhir.kids-first.io/StructureDefinition/Patient"]
},
"subject": {
"reference": "Observation/123"
}
},
"search": {
"mode": "match"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"gender": "male",
"id": "123",
"resourceType": "Patient",
"meta": {
"lastUpdated": "2020-04-24T19:04:06",
"profile": ["http://fhir.kids-first.io/StructureDefinition/Patient"]
}
}
89 changes: 89 additions & 0 deletions cypress/fixtures/resourceIdDetails/patientStructureDefinition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"resourceType": "Bundle",
"id": "789",
"meta": {
"lastUpdated": "2020-05-18T15:33:59.235+00:00"
},
"type": "searchset",
"total": 1,
"link": [
{
"relation": "self",
"url": "http://localhost:8000/StructureDefinition?url=http%3A%2F%2Ffhir.kids-first.io%2FStructureDefinition%2FCondition"
}
],
"entry": [
{
"fullUrl": "http://localhost:8000/StructureDefinition/Patient",
"resource": {
"resourceType": "StructureDefinition",
"id": "Patient",
"url": "http://fhir.kidsfirst.org/StructureDefinition/Patient",
"name": "Patient",
"title": "Patient",
"type": "Patient",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
"snapshot": {
"element": [
{
"id": "Patient",
"path": "Patient"
},
{
"id": "Patient.address",
"path": "Patient.address",
"type": [
{
"code": "Address"
}
]
},
{
"id": "Patient.name",
"path": "Patient.name",
"type": [
{
"code": "HumanName"
}
]
},
{
"id": "Patient.email",
"path": "Patient.email",
"type": [
{
"code": "ContactPoint"
}
]
},
{
"id": "Patient.deceased",
"path": "Patient.deceased",
"type": [
{
"code": "boolean"
}
]
},
{
"id": "Patient.extension:karyotypic-sex",
"path": "Patient.extension",
"sliceName": "karyotypic-sex",
"label": "karyotypicSex",
"min": 0,
"max": "1",
"type": [
{
"code": "Extension",
"profile": [
"http://fhir.kids-first.io/StructureDefinition/karyotypic-sex"
]
}
]
}
]
}
}
}
]
}
5 changes: 2 additions & 3 deletions cypress/fixtures/resourceIdDetails/resourceDetails.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"gender": "male",
"id": "123",
"resourceType": "Patient",
"resourceType": "Observation",
"meta": {
"lastUpdated": "2020-04-24T19:04:06",
"profile": ["http://fhir.kids-first.io/StructureDefinition/patient"]
"profile": ["http://fhir.kids-first.io/StructureDefinition/Observation"]
}
}
67 changes: 67 additions & 0 deletions cypress/integration/patientIdDetails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
describe('Resource ID Details page - Patient resources', () => {
before(() => {
cy.server();
cy.route({
method: 'GET',
url:
'https://damp-castle-44220.herokuapp.com/http://hapi.fhir.org/baseR4/StructureDefinition/**',
response: {type: 'Patient'},
}).as('getStructureDefinition');
cy.route({
method: 'GET',
url:
'https://damp-castle-44220.herokuapp.com/http://hapi.fhir.org/baseR4/Patient/123',
response: 'fixture:resourceIdDetails/patientResourceDetails.json',
}).as('getResource');
cy.visit('/resources/Patient/id=123');
cy.wait(['@getStructureDefinition', '@getResource']);
});

it('loads the resource details', () => {
cy.url().should('include', '/resources/Patient/id=123');
cy.contains('Payload');
});

it('loads timeline', () => {
cy.server();
cy.route({
method: 'GET',
url:
'https://damp-castle-44220.herokuapp.com/http://hapi.fhir.org/baseR4/metadata',
response: 'fixture:resourceIdDetails/capabilityStatementReferences.json',
}).as('getCapabilityStatementReferences');
cy.route({
method: 'GET',
url:
'https://damp-castle-44220.herokuapp.com/http://hapi.fhir.org/baseR4/Condition?patient=Patient/123',
response: 'fixture:resourceIdDetails/conditionDetails.json',
}).as('getConditionDetails');
cy.route({
method: 'GET',
url:
'https://damp-castle-44220.herokuapp.com/http://hapi.fhir.org/baseR4/StructureDefinition?url=http://fhir.kids-first.io/StructureDefinition/Condition',
response: 'fixture:resourceIdDetails/conditionStructureDefinition.json',
}).as('getConditionSD');
cy.route({
method: 'GET',
url:
'https://damp-castle-44220.herokuapp.com/http://hapi.fhir.org/baseR4/Observation?patient=Patient/123',
response: 'fixture:resourceIdDetails/observationDetails.json',
}).as('getObservationDetails');
cy.route({
method: 'GET',
url:
'https://damp-castle-44220.herokuapp.com/http://hapi.fhir.org/baseR4/StructureDefinition?url=http://fhir.kids-first.io/StructureDefinition/Observation',
response: 'fixture:resourceIdDetails/observationStructureDefinition.json',
}).as('getObservationSD');
cy.contains('Timeline').click();
cy.wait([
'@getCapabilityStatementReferences',
'@getConditionDetails',
'@getConditionSD',
'@getObservationDetails',
'@getObservationSD',
]);
cy.contains('No data to show');
});
});
Loading

0 comments on commit 3fde5b9

Please sign in to comment.