Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #28 from ncpi-fhir/fix-kids-first-refs
Browse files Browse the repository at this point in the history
🐛 Fix Kids First References
  • Loading branch information
znatty22 authored Aug 7, 2020
2 parents 3220939 + befa801 commit c9a9443
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 41 deletions.
6 changes: 3 additions & 3 deletions docs/naming_conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Based on observations, the FHIR spec seems to use PascalCase for
resource types (e.g. `Patient`, `SearchParameter`) and camelCase
(e.g. `gender`, `birthDate`) for resource attributes.

The Kids First resource `id` values will be lowercased with hyphens between
The NCPI resource `id` values will be lowercased with hyphens between
words (e.g. `age-at-event`, `sequencing-experiment`).

## Resource File Name
Expand Down Expand Up @@ -122,8 +122,8 @@ Patient-pt-001.json
## Specific Rules for StructureDefinitions

The following rules apply to non-Extension type `StructureDefinitions` and
are intended to help Kids First separate the constraints for
Protected Health Information (PHI) from the constraints in base Kids First
are intended to help NCPI separate the constraints for
Protected Health Information (PHI) from the constraints in base NCPI
profiles.

All `StructureDefinition.id` values will be split into two tokens. The first
Expand Down
13 changes: 9 additions & 4 deletions ncpi_fhir_utility/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _update_ig_config(
continue

# Create the config entry
entry = _create_resource_config(rd)
entry = _create_resource_config(rd, ig_resource.get("publisher"))

# Add/remove configuration entries
if add:
Expand All @@ -395,13 +395,15 @@ def _update_ig_config(
)


def _create_resource_config(resource_dict):
def _create_resource_config(resource_dict, publisher=""):
"""
Create the expected IG configuration entry for a resource
:param resource_dict: The resource payload from which a config entry will
be created. See ncpi_fhir_utility.loader.load_resources.
:type resource_dict: dict
:param publisher: The value of ImplementationGuide.publisher
:type publisher: str
:returns: IG config entry for the resource
"""
rid = resource_dict["content"].get("id")
Expand All @@ -427,10 +429,13 @@ def _create_resource_config(resource_dict):
if profiles:
suffix = f", Profiles: {profiles}"

if publisher:
publisher = publisher + " "

return {
"reference": {"reference": f"{rtype}/{rid}"},
"name": f"Kids First {rtype}/{rid}",
"description": f"Kids First {rtype} {rid}{suffix}",
"name": f"{publisher}{rtype}/{rid}",
"description": f"{publisher}{rtype} {rid}{suffix}",
"exampleBoolean": is_example,
}

Expand Down
2 changes: 1 addition & 1 deletion ncpi_fhir_utility/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Entry point for the Kids First FHIR Model CLI which lets users:
Entry point for the NCPI FHIR Model CLI which lets users:
- Validate FHIR model files (conformance resources, example resources)
- Convert FHIR model files between xml/json
Expand Down
2 changes: 1 addition & 1 deletion ncpi_fhir_utility/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ def fhir_version_name(fhir_version):
"stu3": ("torinox-latest", "fhir"),
}

OUR_URLS = "http://fhir.kids-first.io,https://fhir.kids-first.io"
OUR_URLS = "http://fhir.ncpi.io,https://fhir.ncpi.io"
2 changes: 1 addition & 1 deletion tests/data/examples/invalid/Patient-pt-001.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"resourceType":"Patient",
"id": "participant-example",
"meta": {
"profile": "http://fhir.kids-first.io/StructureDefinition/DoesNotExist"
"profile": "http://fhir.ncpi.io/StructureDefinition/DoesNotExist"
},
"gender": "female",
"name": [
Expand Down
2 changes: 1 addition & 1 deletion tests/data/examples/valid/Patient-pt-001.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "pt-001",
"meta": {
"profile": [
"http://fhir.kids-first.io/StructureDefinition/participant"
"http://fhir.ncpi.io/StructureDefinition/participant"
]
},
"gender": "female",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/examples/valid/ResearchStudy-rs-001.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"resourceType":"ResearchStudy",
"id": "rs-001",
"meta": {
"profile": ["http://fhir.kids-first.io/StructureDefinition/study"]
"profile": ["http://fhir.ncpi.io/StructureDefinition/study"]
},
"status": "completed",
"title": "Study of Ewing's Sarcoma"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"resourceType":"StructureDefinition",
"id": "proband-status",
"url": "http://fhir.kids-first.io/StructureDefinition/proband-status",
"url": "http://fhir.ncpi.io/StructureDefinition/proband-status",
"name": "Proband status",
"title": "Participant Proband Status",
"date": "2019-07-16",
"publisher": "Kids First DRC",
"publisher": "NCPI DRC",
"description": "Whether or not the participant is a proband or subject of study in the research study",
"status":"draft",
"fhirVersion":"4.0.0",
Expand All @@ -31,7 +31,7 @@
{
"id":"Extension.url",
"path":"Extension.url",
"fixedUri":"http://fhir.kids-first.io/StructureDefinition/proband-status"
"fixedUri":"http://fhir.ncpi.io/StructureDefinition/proband-status"
},
{
"id":"Extension.value[x]:valueBoolean",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "StructureDefinition",
"url": "http://fhir.kids-first.io/StructureDefinition/Participant",
"url": "http://fhir.ncpi.io/StructureDefinition/Participant",
"name": "Participant",
"status": "draft",
"fhirVersion": "4.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"resourceType": "StructureDefinition",
"id": "participant",
"url": "http://fhir.kids-first.io/StructureDefinition/participant",
"url": "http://fhir.ncpi.io/StructureDefinition/participant",
"name": "Participant",
"status": "draft",
"fhirVersion": "4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions tests/data/profiles/valid/StructureDefinition-study.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"resourceType": "StructureDefinition",
"id": "study",
"url": "http://fhir.kids-first.io/StructureDefinition/study",
"url": "http://fhir.ncpi.io/StructureDefinition/study",
"version": "0.1.0",
"name": "ResearchStudy",
"title": "Research Study",
"status": "draft",
"publisher": "Kids First",
"description": "A research study within the Kids First ecosystem",
"publisher": "NCPI",
"description": "A research study within the NCPI ecosystem",
"fhirVersion": "4.0.0",
"kind": "resource",
"abstract": false,
Expand Down
2 changes: 1 addition & 1 deletion tests/data/site_root/ig.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[IG]
ig = input/ImplementationGuide-KidsFirst.json
ig = input/ImplementationGuide-NCPI.json
template = fhir.base.template
usage-stats-opt-out = false
copyrightyear = 2020+
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"contact": [
{
"name": "Kids First DRC",
"name": "NCPI",
"telecom": [
{
"system": "email",
"value": "mailto:support@kidsfirstdrc.org"
"value": "mailto:support@ncpi.org"
}
]
}
Expand All @@ -18,7 +18,7 @@
{
"generation": "markdown",
"nameUrl": "index.html",
"title": "Kids First Implementation Guide"
"title": "NCPI Implementation Guide"
}
],
"title": "Table of Contents"
Expand Down Expand Up @@ -55,18 +55,18 @@
],
"resource": []
},
"description": "Documentation for the Kids First FHIR data model",
"description": "Documentation for the NCPI FHIR data model",
"fhirVersion": [
"4.0.1"
],
"id": "KidsFirst",
"id": "NCPI",
"license": "CC0-1.0",
"name": "KidsFirstImplementationGuide",
"packageId": "kidsfirst",
"publisher": "Kids First DRC",
"name": "NCPIImplementationGuide",
"packageId": "ncpi",
"publisher": "NCPI",
"resourceType": "ImplementationGuide",
"status": "active",
"title": "Kids First Implementation Guide",
"url": "http://fhir.kids-first.io/ImplementationGuide/KidsFirst",
"title": "NCPI Implementation Guide",
"url": "http://fhir.ncpi.io/ImplementationGuide/NCPI",
"version": "0.1.0"
}
2 changes: 1 addition & 1 deletion tests/data/site_root/input/pages/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Description

The Kids First FHIR Implementation Guide
The NCPI FHIR Implementation Guide

### Authors

Expand Down
6 changes: 3 additions & 3 deletions tests/data/site_root/package-list.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"package-id": "kidsfirst",
"title": "KidsFirst Implementation Guide",
"canonical": "http://fhir.kids-first.io",
"title": "NCPI Implementation Guide",
"canonical": "http://fhir.ncpi.io",
"introduction": "An example of how FSH can be used to create an IG about kidsfirst",
"list": [
{
"version": "current",
"desc": "Draft",
"path": "http://fhir.kids-first.io",
"path": "http://fhir.ncpi.io",
"status": "ci-build",
"current": true
}
Expand Down
12 changes: 6 additions & 6 deletions tests/data/site_root/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "kidsfirst",
"version": "0.1.0",
"canonical": "http://fhir.kids-first.io",
"url": "http://fhir.kids-first.io",
"title": "Kids First Implementation Guide",
"description": "Documentation for the Kids First FHIR data model",
"canonical": "http://fhir.ncpi.io",
"url": "http://fhir.ncpi.io",
"title": "NCPI Implementation Guide",
"description": "Documentation for the NCPI FHIR data model",
"dependencies": {
"hl7.fhir.r4.core": "4.0.1"
},
"keywords": [
"Kids First",
"NCPI",
"NIH",
"Pediatric"
],
Expand All @@ -22,4 +22,4 @@
}
],
"license": "CC0-1.0"
}
}

0 comments on commit c9a9443

Please sign in to comment.