pepfar-datim / matches Goto Github PK
View Code? Open in Web Editor NEWData source to target mapping utility
License: Apache License 2.0
Data source to target mapping utility
License: Apache License 2.0
Please add ability to upload generated questionnaire response set to a url.
For iteration 1, let's do this as:
application/json
and receiver can handle it;Rather than just list rows with unmapped values, list the unmapped values themselves.
E.g.
not
unmapped values: 1, 2, 3
but ideally
女: 1,2
男: 3
On first click to upload mappings from another map, the map being populated gets the new headers,
but on the second/subsequent clicks, the matching headers get removed
currently back end looks at path to get relevant table name e.g. knows to interact with maps
table when /api/maps/map100
is called...
may want to avoid this because path could be different based on host environment. Could look into passing table name to callback (if possible) or could
front-end may generally need a configuration to know where to go to (e.g. particularly for redirects)
Probably easiest to start with is to make configuration file with the expected base path. For now, it would just be /
Add upload button (redirect to upload data) and make it disabled until map is valid
upload=true
)string values are not being passed to QuestionnaireResponse
(This is because there is no validation check that handles a string type)
Build out UI to accept CSV file on Upload page and then trigger handling (#17)
If implementing "properly" a DELETE request on a questionnaire would remove related maps...but maybe don't want to do this as it could cause problems for users...e.g. so DELETE of questionnaire should maybe fail when there are related maps
Probably want maps dashboard to act as the "home page", so make server/
redirect to server/maps
Make CSV file upload consistent across mAppr and handle special processing in a callback function
Maybe also have initial preprocessing separated out
From #24
Consider how to handle interactions with backend if they fail...maybe warning about being offline/update problems?
Current set up for delete request doesn't alert properly when ID does not exist (because query works, it returns as deleted)
clean up file structure (aka decide structure for files :-) ) and summarize for others (maybe in README)
sanitize parameters on backend requests to prevent SQL injection
pool.query('SELECT * FROM maps WHERE uid=$1', ['abcdef'], function (err, res) { //do something })
FYI @vshioshvili
Add checks for other valueTypes (integer, date, dateTime)
Table with list of maps (landing screen) with navigation options
add boxes for handling map add
200
response to appropriate edit resourceValidation checks need to be expanded to handle more checks: https://github.com/pepfar-datim/mAppr/blob/master/src/services/validateFile.js
Need to also define those checks more concretely: https://github.com/pepfar-datim/PLM/issues/95
per @vshioshvili's suggestion, look into using MongoDB for backend (and storing json maps there)
Output of the mAppr tool needs to be a bundle type structure that has each questionnaire response as an entry.
Note that reference used for structure definition is a placeholder, and I believe we need to create one - I think it will be same for all mAppr exports, and won't vary based on the questionnaire.
Here is what it looks without any QR, followed by sample with two QR entries.
{
"resourceType": "Bundle",
"id": "auto-generated",
"meta": {
"profile": [
"http://datim.org/fhir/StructureDefinition/PLM-QuestionnaireResponse-Bundle"
]
},
"type": "message",
"timestamp": "1970-01-01T00:00:00.001-00:00",
"entry": []
}
{
"resourceType": "Bundle",
"id": "auto-generated",
"meta": {
"profile": [
"http://datim.org/fhir/StructureDefinition/PLM-QuestionnaireResponse-Bundle"
]
},
"type": "message",
"timestamp": "1970-01-01T00:00:00.001-00:00",
"entry": [
{
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "R7eJnv-2019-10-11T13:09:17.752Z-row0",
"status": "completed",
"questionnaire": "http://datim.org/fhir/Questionnaire/PLM-FP-Questionnaire",
"item": [
{
"linkId": "/Patient",
"text": "Patient ID",
"item": [
{
"linkId": "/Patient/id",
"text": "Patient ID",
"answer": {
}
},
{
"linkId": "/Patient/birthDate",
"text": "Birth Date",
"answer": {
"valueDate": "1980-01-01"
}
},
{
"linkId": "/Patient/gender",
"text": "Gender",
"answer": {
"valueCoding": {
"system": "http://hl7.org/fhir/ValueSet/administrative-gender",
"code": "female"
}
}
}
]
},
{
"linkId": "/Encounter",
"text": "Encounter",
"item": [
{
"linkId": "/Encounter/location",
"text": "Location ID",
"answer": {
"valueString": "DATIM OU UID"
}
}
]
},
{
"linkId": "/MedicationStatement",
"text": "MedicationStatement",
"item": [
{
"linkId": "/MedicationStatement/method",
"text": "Family Planning Modern Method",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "LA27903-6"
}
}
]
},
{
"linkId": "/MedicationStatement/startDate",
"text": "ART Start Date",
"answer": {
"valueDateTime": "2010-01-01"
}
}
]
}
]
}
},
{
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "R7eJnv-2019-10-11T13:09:17.752Z-row1",
"status": "completed",
"questionnaire": "http://datim.org/fhir/Questionnaire/PLM-FP-Questionnaire",
"item": [
{
"linkId": "/Patient",
"text": "Patient ID",
"item": [
{
"linkId": "/Patient/id",
"text": "Patient ID",
"answer": {
"valueString": "124"
}
},
{
"linkId": "/Patient/birthDate",
"text": "Birth Date",
"answer": {
"valueDate": "1981-01-01"
}
},
{
"linkId": "/Patient/gender",
"text": "Gender",
"answer": {
"valueCoding": {
"system": "http://hl7.org/fhir/ValueSet/administrative-gender",
"code": "male"
}
}
}
]
},
{
"linkId": "/Encounter",
"text": "Encounter",
"item": [
{
"linkId": "/Encounter/location",
"text": "Location ID",
"answer": {
"valueString": "DATIM OU UID"
}
}
]
},
{
"linkId": "/MedicationStatement",
"text": "MedicationStatement",
"item": [
{
"linkId": "/MedicationStatement/method",
"text": "Family Planning Modern Method",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "LA27903-6"
}
}
]
},
{
"linkId": "/MedicationStatement/startDate",
"text": "ART Start Date",
"answer": {
"valueDateTime": "2011-01-01"
}
}
]
}
]
}
}
]
}
Build
-left bar with map (informational)
-upload csv file
-need request to back end to parse map + csv file (basis is here: https://github.com/pepfar-datim/mAppr/blob/master/csvConversion/QuestionnaireResponse/convert.js)
-handle error display
-if success: download array of questionnaireResponse data
here is redirecting to correct URL but not rendering
https://github.com/pepfar-datim/mAppr/issues/new
Have tried to export with withRouter()
but that didn't change things. Also tried changing syntax several ways without success. This was originally working without component references, but removing them also does not work
• add questionnaire url from questionnaire into questionnaire response (and update questionnaires to include url as well)
• change structure of valueCoding
responses
• confirm with @lduncan-intrah re: DateTime, ValueCoding.System
page for submitting data
Tried a variety of approaches for columns (
After discussion with @vshioshvili, it was decided that we should let the CSV file be processed (with a warning) if there are extra headers in the CSV file. There will be an error if there are extra headers in the map that don't correspond to the CSV (e.g you map Gender
in your map, but use Sex
in your CSV file...in this case Gender
being missing from CSV is an error, but Sex
in the CSV file would be a warning)
Requires some backend redo because of logic in when the file should be handled
Get response of PayloadTooLargeError: request entity too large
with larger csv uploads (testing at 10,000 lines)
@tomzemp having a UUID might be good. But it can be left as the literal text if UUID is not possible.
Originally posted by @vshioshvili in #41 (comment)
To define what we want for UUID before implementing
Make errors more readable (easiest to change how errors are returned on the back end, so that they are like {"key":{"errorType":[1,2,3]}
create basic header bar component to be used throughout app
-mAppr name (+ placeholder for logo)
-organization name (from configuration file)
-icons for "menu" (list of maps), configuration, help
From #24
Allow users to edit map's name from within edit page
Design approach to let users use existing map as the basis for new map.
Front-end approaches are outlined here: https://whimsical.com/QopncHDGwNVsjWoh7iJi1W
Ultimately, Option 1 and Option 2 are desired, but Option 1 is priority.
This can probably run client-side, in which case "flatQuestionnaire" can be leveraged, but that may need to be revisited.
When initially creating a map, it appears that if you create a header but don't associate it with a map, when you navigate away/back, the code to process the questionnaire fails because it expects there to be associations in the map between the header and the questionnaire. Need to add handling in validateMap service
Need to check that everything is mapped when going to upload page before allowing actual upload
From edit screen, it would be better for performance to have the check running as changes are made, but could also be useful as a "final" check when background check alerts that map is completed
Hi @tomzemp,
I like the code! Looks well organized and makes sense when reading!
However, since I was asked to provide feedback I will put a few comments here :)
cc @benguaraldi
Make README
Return 500
status code and direct to error page when invalid resource is requested.
From #24
Check for completeness/validity as map gets changed
-are all headers/questions mapped
-no "1:many" mappings
create file for configuration that contains name and decide where in backend it should be
"name": "Tanzania Ministry of Health"
}```
Will need to be loaded from Main component
Can eventually contain things like language, etc,.
Need to add callback to delete icon to actually remove map
Work on building page for this:
-Convert map properties to Chip "Headers" in side bar (with handlers for add/delete)
-In main space, have parsed questionnaire with links to map's headers/properties
-For initial stage, probably have question use a select of the available headers/properties from the map
-api calls to back-end to update map as user makes changes
From #24
Work on handling of value maps...
for ease of use at the moment (for proof of concept), probably want to put code system definition within questionnaires (e.g. don't go fetch from external source as we define requirements/vision for questionnaire storage)
Might be useful to prepopulate the value map with the definitions expected by the code system definition and then allow users to update
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.